Commit graph

5493 commits

Author SHA1 Message Date
Michael Olbrich
93ec45a6df liveadder: round when calculation length from duration
liveadder sometimes calculates the offsets incorrectly before adding. The
resulting errors can easily be heard when mixing silence with a sine.
I'm not sure what the exact conditions are to trigger this, but it definitively
happens when the buffers of two streams have a different duration and buffer
length and duration don't match exactly for one stream because of rounding
errors (e.g.  duration=0:00:00.021333333)

I have to admit, I got lost in the math somewhere but it seems that not
rounding in gst_live_adder_length_from_duration() causes 1 sample overlaps in
consecutive buffers from the same stream.
When using gst_util_uint64_scale_int_round() instead of just truncating the
sine sound correctly again.

https://bugzilla.gnome.org/show_bug.cgi?id=708345
2013-09-28 13:31:13 +02:00
Steve Maynard
17ed696faa mpegts: Add SCTE/EISS sections and table types
https://bugzilla.gnome.org/show_bug.cgi?id=708688
2013-09-28 13:15:44 +02:00
Edward Hervey
0e9ce593bf tsdemux: Wait for valid PCR/offset obvervations
It is quite possible that we might get PTS/DTS before the first
PCR/Offset observation.

In order to end up with valid timestamp we wait until at least one
stream was able to get a proper running-time for any PTS/DTS.
Until then, we queue up the pending buffers to push out.

Once we see a first valid timestamp, we re-evaluate the amount of
running-time elapsed (based on returned inital running-time and amount
of data/DTS queued up) for any given stream.

Taking the biggest amount of elapsed time, we set that on the packetizer
as the initial offset and recalculate all pending buffers running-time
PTS/DTS.

Note: The buffer queueing system can also be used later on for the
dvb fast start proposal (where we queue up all stream packets before
seeing PAT/PMT and then push them once we know if they belong to the
chosen program).
2013-09-28 13:15:43 +02:00
Edward Hervey
2762ead5ef mpegtsdemux: New PCR<=>Offset estimation code
This allows:
* Better duration estimation
* More accurate PCR location
* Overall more accurate running-time location and calculation

Location and values of PCR are recorded in groups (PCROffsetGroup)
with notable PCR/Offset observations in them (when bitrate changed
for example). PCR and offset are stored as 32bit values to
reduce memory usage (they are differences against that group's
first_{pcr|offset}.

Those groups each contain a global PCR offset (pcr_offset) which
indicates how far in the stream that group is.

Whenever new PCR values are observed, we store them in a sliding
window estimator (PCROffsetGroupCurrent).

When a reset/wrapover/gap is detected, we close the current group with
current values and start a new one (the pcr_offset of that new group
is also calculated).

When a notable change in bitrate is observed (+/- 10%), we record
new values in the current group. This is a compromise between
storing all PCR/offset observations and none, while at the same time
providing better information for running-time<=>offset calculation
in VBR streams.

Whenever a new non-contiguous group is start (due to seeking for example)
we re-evaluate the pcr_offset of each groups. This allows detecting as
quickly as possible PCR wrapover/reset.

When wanting to find the offset of a certain running-time, one can
iterate the groups by looking at the pcr_offset (which in essence *is*
the running-time of that group in the overall stream).
Once a group (or neighbouring groups if the running-time is between two
groups) is found, once can use the recorded values to find the most
accurate offset.

Right now this code is only used in pull-mode , but could also
be activated later on for any seekable stream, like live timeshift
with queue2.

Future improvements:
* some heuristics to "compress" the stored values in groups so as to keep
  the memory usage down while still keeping a decent amount of notable
  points.
* After a seek compare expected and obtained PCR/Offset and if the
  difference is too big, re-calculate position with newly observed
  values and seek to that more accurate position.

Note that this code will *not* provide keyframe-accurate seeking, but
will allow a much more accurate PCR/running-time/offset location on
any random stream.
For past (observed) values it will be as accurate as can be.
For future values it will be better than the current situation.
Finally the more you seek, the more accurate your positioning will be.
2013-09-28 13:15:43 +02:00
Edward Hervey
5017ba84a7 mpegtspacketizer: No longer use a private struct
These are not public headers, it just adds complexity for no reason
2013-09-28 13:15:43 +02:00
Sebastian Dröge
d7c7f54734 mpegtsparse: Queue buffers until we have enough to know the caps
https://bugzilla.gnome.org/show_bug.cgi?id=708222
2013-09-27 16:10:54 +02:00
Arnaud Vrac
467e0151d3 mpegtspacketizer: rework TS packet sync and extraction
The previous code could enter an infinite loop because the adapter state
could get out of sync with its mapped data state after sync was lost.
The code was pretty confusing so it's been rewritten to be clearer.

The easiest way to reproduce the infinite loop is to use the breakmydata
element before tsdemux to trigger a resync.

https://bugzilla.gnome.org/show_bug.cgi?id=708161
2013-09-27 15:17:24 +02:00
Arnaud Vrac
85ad4f3ad6 tsdemux: fix buffer overflow
This can happen with a corrupt TS file, found with breakmydata element
plugged before tsdemux.

https://bugzilla.gnome.org/show_bug.cgi?id=708161
2013-09-27 15:10:23 +02:00
Sebastian Dröge
f33a73b359 sdpdemux: Change rank to NONE until it can be autoplugged properly
https://bugzilla.gnome.org/show_bug.cgi?id=702495
2013-09-23 16:19:05 +02:00
Sebastian Dröge
92c696b22a audiofxbad: Change plugin name to audiofxbad from audiochannelmix 2013-09-19 20:17:01 +02:00
Sudip Jain
27739e8bb6 mpegtspacketizer: Correct condition check for current next indicator
https://bugzilla.gnome.org/show_bug.cgi?id=708106
2013-09-16 11:00:16 +02:00
Wim Taymans
b15177645b rawparse: fix event order
Delay forwarding the segment event until we pushed caps.
Send STREAM_START in pull mode.
2013-09-12 14:14:03 +02:00
Thiago Santos
efb27f19ec tsdemux: respect seqnums on seeks
Pass the seqnum to other events that are consequence of the
original seek event
2013-09-10 19:44:24 -03:00
Matej Knopp
a41e8698b1 h264parse: don't update src caps if only codec_data differs
https://bugzilla.gnome.org/show_bug.cgi?id=705333
2013-09-09 15:09:10 +02:00
Alex Ashley
31d1c05871 h264parse: Add support for stream-format=avc3
When outputting in AVC3 stream format, the codec_data should not
contain any SPS or PPS, because they are embedded inside the stream.

In case of avc->bytestream h264parse will push the SPS and PPS from
codec_data downstream at the start of the stream, at intervals
controlled by "config-interval" and when there is a codec_data change.

In the case of avc3->bytstream h264parse detects that there is
already SPS/PPS in the stream and sets h264parse->push_codec to FALSE.
Therefore avc3->bytstream was already supported, except for the stream
type.

In the case of bystream->avc h264parse will generate codec_data caps
from the parsed SPS/PPS in the stream. However it does not remove these
SPS/PPS from the stream. bytestream->avc3 is the same as bytestream->avc
except that the codec_data must not have any SPS/PPS in it.

|--------------+-------------+-------------------|
|stream-format | SPS in-band | SPS in codec_data |
|--------------+-------------+-------------------|
| avc          | maybe       | always            |
|--------------+-------------+-------------------|
| avc3         | always      | never             |
|--------------+-------------+-------------------|

Amendment 2 of ISO/IEC 14496-15 (AVC file format) is defining a new
structure for fragmented MP4 called "avc3". The principal difference
between AVC1 and AVC3 is the location of the codec initialisation
data (e.g. SPS, PPS). In AVC1 this data is placed in the initial MOOV box
(moov.trak.mdia.minf.stbl.stsd.avc1) but in AVC3 this data goes in the
first sample of every fragment.

https://bugzilla.gnome.org/show_bug.cgi?id=702004
2013-09-04 13:32:36 +02:00
Tim-Philipp Müller
310a633afb mpegpsdemux: minor clean-up 2013-09-02 23:28:38 +01:00
Matej Knopp
e43d1959a8 mpegdemux: send events on pads that are not linked
Someone might be waiting for certain events with a probe.

https://bugzilla.gnome.org/show_bug.cgi?id=707317
2013-09-02 23:24:08 +01:00
Edward Hervey
865ad4cdad h264parse: Use codecparsers macros
note: I/SI also covers the S_I/S_SI variants
2013-08-30 09:05:43 +02:00
Sebastian Dröge
03420d1e2a Release 1.1.4 2013-08-28 13:07:27 +02:00
Tim-Philipp Müller
cf791f6cb0 mpegtsdemux: fix possible read beyond end of buffer when resyncing 2013-08-27 17:05:44 +01:00
Matthieu Bouron
4b10f278b6 h264parse: only update src CAPS when it's necessary
https://bugzilla.gnome.org/show_bug.cgi?id=705452
2013-08-27 15:00:45 +02:00
Matthieu Bouron
43dcebe2a0 h264parse: do not set CAPS and passthrough mode if SPS/PPS have not been parsed
https://bugzilla.gnome.org/show_bug.cgi?id=705452
2013-08-27 15:00:35 +02:00
Edward Hervey
fd4fd13dc8 tsdemux: Refuse negative rates which we don't support yet
And remove a check which was done before
2013-08-21 14:44:38 +02:00
Jesper Larsen
e4a0c4d509 mpegtsmux: Set the program number from prog-map
The prog-map property of mpegtsmux only allows you to group pids together in a program.
The program number set in the PAT/PMT tables cannot be set explicitly.

This patch will set the program number according to the prog-map.
If a program id of 0 is given, the first vacant program number starting from 1 will be used.

https://bugzilla.gnome.org/show_bug.cgi?id=697239
2013-08-21 13:02:02 +02:00
Edward Hervey
d6b55b8a66 mpegtsbase: Adapt for latest mpegts lib changes 2013-08-21 08:59:42 +02:00
Edward Hervey
7667b79205 ivtc: Use input framerate when possible
if input is 30000/1001 ... use 24000/1001 as the output fixated framerate
2013-08-20 16:02:59 +02:00
Matthieu Bouron
f0eda4b54c id3mux: handle publisher, interpreted-by and musical-key tags
https://bugzilla.gnome.org/show_bug.cgi?id=705999
2013-08-20 14:45:22 +02:00
Sebastian Dröge
32a65dc5f3 mpegvideoparse: Fix switch statement in level detection code
Properly fall through the cases without re-assigning the level to
the wrong value.

https://bugzilla.gnome.org/show_bug.cgi?id=706369
2013-08-20 13:30:15 +02:00
Edward Hervey
ce81c4eb48 jpegparse: Forward segment event after caps
Store it until we know what our caps are.
2013-08-20 10:16:00 +02:00
Tim-Philipp Müller
63d629aba5 aiffparse: don't leak adapter 2013-08-17 00:25:49 +01:00
Matthieu Bouron
ddcfe3ddf3 aiffparse: s/newsegment/segment/
https://bugzilla.gnome.org/show_bug.cgi?id=705993
2013-08-17 00:25:49 +01:00
Matthieu Bouron
d69b6e53e4 aiffparse: fix push mode
Fix push mode by handling sink events (CAPS, SEGMENT) properly.

https://bugzilla.gnome.org/show_bug.cgi?id=705993
2013-08-17 00:25:49 +01:00
Olivier Crête
27bceba4ad mpeg4videoparse: Reparse the config if the size changed
Also only re-issue the caps update if the part of the config that
changed is one we care about.
2013-08-16 15:46:18 -04:00
Tim-Philipp Müller
e861c72efc interaudiosrc: make silence memory actually contain silence
instead of random data. Reported by Marco Micheletti on
gstreamer-devel.
2013-08-14 18:19:21 +01:00
Edward Hervey
21ebc7708d pesparse: Refactory secondary PES extension handling
Some streams had wrong values for the stream_id_extension, make sure
we only remember the valid ones.

For streams with PES_extension_field_length == 0, assume there's nothing
else.

For streams that state they have a TREF extension but don't have enough
data to store it, just assume it was produced by a non-compliant muxer
and skip the remaining data.

Only store remaining data in stream_id_extension_data instead of storing
data we already parse.
2013-08-14 13:41:37 +02:00
Zaheer Abbas Merali
131c263248 pcapparse: Remove unneeded unref and only set pad caps if we have caps
Fixes crashes due to invalid unrefs.

https://bugzilla.gnome.org/show_bug.cgi?id=705957
2013-08-14 10:48:26 +02:00
Edward Hervey
ddee83ef0b pesparse: Fix pes extension data length check
And remove length/data updates (we use the header size just below to
properly set them).

Based on feedback from Stas Sergeev <stsp@list.ru>

https://bugzilla.gnome.org/show_bug.cgi?id=657343
2013-08-14 10:39:46 +02:00
Edward Hervey
5208b8a050 pesparse: Remove unused argument
We always provided 0 as the offset and never used the returned value.

Based on feedback from Stas Sergeev <stsp@list.ru>

https://bugzilla.gnome.org/show_bug.cgi?id=657343
2013-08-14 10:33:14 +02:00
Matej Knopp
e5ebd7d846 mpegvideoparse: support field encoding for interlaced video
https://bugzilla.gnome.org/show_bug.cgi?id=705144
2013-08-13 14:00:57 +02:00
Sreerenj Balachandran
b4c52425f2 vc1parse: Fix the SequenceLayer handling for advanced profile.
The Sequence Header Data Structure STRUCT_C for Advanced Profile
has only a one valid field which is the profile indicator. Don't
use the reserved fields for fps update like Simple/Main profile.

https://bugzilla.gnome.org/show_bug.cgi?id=705667
2013-08-12 16:12:52 +01:00
Sreerenj Balachandran
ea213f826c vc1parse: Fix seq hdr STRUCT_A handling for advanced profile.
The Sequence Header Data Structure STRUCT_A for advanced profile
may be eight consecutive zero bytes.Don't try to override the
width and height values in this case.

https://bugzilla.gnome.org/show_bug.cgi?id=705667
2013-08-12 16:12:52 +01:00
Matthieu Bouron
0d4c2f42e9 aiffparse: fix SSND data size
AIFF chunk size does not include the chunk header size (8 bytes), so the
SSND data size is equal to the chunk size minus the SSND header size (8
bytes).

https://bugzilla.gnome.org/show_bug.cgi?id=705675
2013-08-12 16:12:51 +01:00
Arnaud Vrac
c4140f9c25 mpegdemux: send codec tag for each stream 2013-08-12 14:32:09 +02:00
Tim-Philipp Müller
ed69b2896f aiffparse: fix CAPS query
Was causing criticals in decodebin/playbin because the caps
query done when exposing pads would return ANY caps.
2013-08-10 19:44:15 +01:00
Tim-Philipp Müller
48734bd522 aiffparse: don't unref NULL buffer 2013-08-10 19:43:41 +01:00
Matthieu Bouron
8c4241e546 aiffparse: set missing layout field in srcpad caps
https://bugzilla.gnome.org/show_bug.cgi?id=705674
2013-08-09 23:41:30 +01:00
Matthieu Bouron
5a066fd6dd aiffparse: send start stream event
https://bugzilla.gnome.org/show_bug.cgi?id=705674
2013-08-09 23:40:08 +01:00
Matthieu Bouron
86edc51333 aiffparse: fix buffers initialisation
https://bugzilla.gnome.org/show_bug.cgi?id=705674
2013-08-09 23:36:33 +01:00
Edward Hervey
8074a48594 h264parse: Use slice type to determine if frame is keyframe
This is the same behaviour as pre-baseparse-refactoring

https://bugzilla.gnome.org/show_bug.cgi?id=705598
2013-08-09 08:42:43 +02:00
Edward Hervey
b17676a1d5 h264parse: Do not trigger caps update if we only have PPS updates
Updating caps results in downstream elements potentially reconfiguring themselves
(such as decoders). If we do this in the middle of keyframes, we would result
in those elements being reconfigured and handling garbage until the next keyframe.

Instead of this only send (potentially) new codec_data when we have *both* SPS and
PPS.

https://bugzilla.gnome.org/show_bug.cgi?id=705333
2013-08-04 12:08:57 +02:00