Commit graph

9860 commits

Author SHA1 Message Date
Jan Alexander Steffens (heftig)
2a16160b57 rtph264pay: Replace fragmentation while-loop with for-loop 2019-07-03 19:05:29 +00:00
Jan Alexander Steffens (heftig)
00936a8362 rtph264pay: Calculate the right max_fragments 2019-07-03 19:05:29 +00:00
Jan Alexander Steffens (heftig)
fe99982dec rtph264pay: Rename payload_len to max_fragment_size 2019-07-03 19:05:29 +00:00
Jan Alexander Steffens (heftig)
5051569713 rtph264pay: Clean up _payload_nal_fragment 2019-07-03 19:05:29 +00:00
Jan Alexander Steffens (heftig)
d97c3f045c rtph264pay: Clean up _payload_nal
Move determining whether we need to fragment at all into the fragmenter.
2019-07-03 19:05:29 +00:00
Jan Alexander Steffens (heftig)
166c49b800 rtph264pay: Clean up _payload_nal_single 2019-07-03 19:05:29 +00:00
Jan Alexander Steffens (heftig)
b3291620ca rtph264pay: Extract sending fragments into _payload_nal_fragment 2019-07-03 19:05:29 +00:00
Jan Alexander Steffens (heftig)
e493f0ba09 rtph264pay: Extract sending a single packet into _payload_nal_single 2019-07-03 19:05:29 +00:00
Jan Alexander Steffens (heftig)
40c23c06b1 rtph264pay: Define and use FU_A_TYPE_ID 2019-07-03 19:05:29 +00:00
Jan Alexander Steffens (heftig)
bc0018370b rtph264pay: Use snake_case variables 2019-07-03 19:05:29 +00:00
Jan Alexander Steffens (heftig)
28d6dfa51f rtph264pay: Clean up whitespace and syntax 2019-07-03 19:05:29 +00:00
Olivier Crête
37d22186ff rtpjitterbuffer: Unlock output if the queue is full 2019-07-03 18:03:42 +00:00
Thomas Bluemel
080eba64de rtpjitterbuffer: Ignore unsolicited rtx packets.
If an rtx packet arrives that hasn't been requested (it might
have been requested from prior to a reset), ignore it so that
it doesn't inadvertently trigger a clock skew.
2019-07-03 06:23:07 -06:00
Thomas Bluemel
8d955fc32b rtpjitterbuffer: Only calculate skew or reset if no gap.
In the case of reordered packets, calculating skew would cause
pts values to be off. Only calculate skew when packets come
in as expected. Also, late RTX packets should not trigger
clock skew adjustments.

Fixes #612
2019-07-03 06:23:07 -06:00
Mart Raudsepp
ade531183f qtdemux: Provide a 30 frames lead-in for MP3
mpegaudioparse suggests MP3 needs 10 or 30 frames of lead-in (depending on
mpegaudioversion, which we don't know here), thus provide at least 30 frames
lead-in for such cases as a followup to commit cbfa4531ee.
2019-07-02 20:50:21 +00:00
Olivier Crête
af618cb081 rtpjitterbuffer: max-dropout-time gets cast to int32
So any value over MAXINT32 gets considered as negative and is silently ignored.
2019-07-02 19:59:49 +00:00
Mathieu Duponchelle
f4f11530c2 qtdemux: do_seek can never be called with a NULL event 2019-07-02 13:39:55 +02:00
Mathieu Duponchelle
83704e32e6 qtdemux: only adjust segment time when adjusting segment start
We ended up setting segment.time to segment.position when doing
reverse playback, which is obviously wrong.
2019-07-02 13:39:55 +02:00
Mathieu Duponchelle
33277da781 rtspsrc: unref the event in element seek handler 2019-07-01 13:54:13 +02:00
Mathieu Duponchelle
bcd367b81d rtspsrc: handle seek event on the element
Without this, the user has to wait for rtspsrc to have sent a PLAY
request and exposed its pads before seeking it.
2019-06-29 00:25:26 +02:00
Nicolas Dufresne
2c3c1072f7 multiudpsink: Add missing socket.h include
Without this include, macro like SO_BINDTODEVICE is not visible and
associated feature gets out-compiled. This also affects the support for
SO_SNDBUF.
2019-06-26 18:03:29 -04:00
Jan Alexander Steffens (heftig)
152b002658
flvmux: Clear new_tags if sending metadata in header
This avoids sending an additional metadata object right after the
headers.
2019-06-24 17:37:51 +02:00
Mart Raudsepp
ab6e49e9cc audioparsers: add back segment clipping to parsers that have lost it
The pre_push_frame default clipping behaviour was introduced in 2010
with commit 30be03004e and modified with commit 4163969a24 in 2011,
when most parsers didn't implement a pre_push_frame yet. Not having it
meant that clipping was done by default. Those that did implement a
pre_push_frame (flacparse and mpegaudioparse) at the time, had the flag
adjusted as part of the 2011 refactor work.

All other parsers got a pre_push_frame vfunc implementation only in
2013, but seem to have forgot to keep the clipping behaviour, as
was done automatically when a pre_push_frame implementation doesn't
exist for the parser. aacparse lost it with commit 91d4abcea in
July 2013; the others in Dec 2013 as part of AUDIO_CODEC tag posting
in commits 6f89b430e, d2ab5199b, 29f2cae12, 753d3c23a and 292780574.
2019-06-24 14:40:58 +03:00
Jan Alexander Steffens (heftig)
9528bfd78f
flvmux: Simplify an if-else chain
Merge the identical branches and turn the condition around to make it
easier to read.
2019-06-19 14:36:21 +02:00
Jan Alexander Steffens (heftig)
9a70ce87db
flvmux: Avoid crash when changing caps without both streams
mux->video_pad and mux->audio_pad can be NULL if the corresponding pad
has not been requested.
2019-06-19 14:36:21 +02:00
Sebastian Dröge
b18ad8b54c rtpgstpay: Send caps anyway if caps are pending in the adapter but are different from the new ones
Otherwise it can happen that we receive a caps event, then another caps
event and only then buffers. We would then send out the first caps event
in the stream but mark buffers with the caps version of the second caps
event.
2019-06-18 08:35:12 +00:00
Sebastian Dröge
44a697deba rtpgstdepay: Only store the current caps and drop old caps immediately
Otherwise it can happen that we already collected 7 caps, miss the 8th
caps packet (packet loss) and then re-use the 1st caps for the following
buffers instead of the 8th caps which will likely cause errors further
downstream unless both caps are accidentally the same.

Keeping old caps around does not seem to have any value other than
potentially causing errors. We would always receive new caps whenever
they change (even if they were previous ones) and it's very unlikely
that they happen to be exactly the same as the previous ones.

Also after having received new caps or a buffer with a next caps
version, no buffers with old caps version will arrive anymore.
2019-06-18 08:35:12 +00:00
Jan Schmidt
53b3f2ddbb rtpjitterbuffer: Clear clock master before unreffing
Make sure to clear any master clock on the media_clock
before unreffing it to release the timer callback that's
updating the clock and keeping it reffed.
2019-06-16 20:36:55 +10:00
Jan Schmidt
2479ccac7d matroska: Initialise a video_context field to satisfy valgrind
Clear the mastering_display_info_present field explicitly
after reallocating the track context into a video context
to avoid uninitialised warnings in valgrind
2019-06-16 11:10:41 +10:00
Thibault Saunier
ac55681bbf docs: Fix link to strings
We can't link to #gchar* this way.
2019-06-14 17:34:43 -04:00
Mathieu Duponchelle
ebe2756434 jitterbuffer: unset DTS on output buffers 2019-06-14 16:02:59 +02:00
Mathieu Duponchelle
ddbbe5d277 splitmuxsink: set the same seqnum on flush_start / flush_stop
It's currently not made mandatory by aggregator, but it might
eventually be, and is more consistent behaviour

See https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/977
2019-06-13 16:44:47 +02:00
Mikhail Fludkov
ec5fa49631 rtpjitterbuffer: late packets shouldn't affect PTS of the following packet
If, say, a rtx-packet arrives really late, this can have a dramatic
effect on the jitterbuffer clock-skew logic, having it being reset
and losing track of the current dts-to-pts calculations, directly affecting
the packets that arrive later.

This is demonstrated in the test, where a RTX packet is pushed in really
late, and without this patch the last packet will have its PTS affected
by this, where as a late RTX packet should be redundant information, and
not affect anything.
2019-06-13 11:55:10 +02:00
Mikhail Fludkov
b9c3e354ee rtpjitterbuffer: fix rtx delay calulation when large packet spacing 2019-06-12 11:39:32 +02:00
Stian Selnes
6269ed49ab rtpjitterbuffer: Fix delay for EXPECTED timers added by gaps
This patch corrects the delay set on EXPECTED timers that are added when
processing gaps. Previously the delay could be too small so that
'timout + delay' was much less than 'now', causing the following retries
to be scheduled too early. (They were sent earlier than
rtx-retry-timeout after the previous timeout.)
2019-06-12 11:39:32 +02:00
Havard Graff
8ed7ab178b rtpjitterbuffer: don't try and calculate packet-rate if seqnum are jumping
Turns out that the "big-gap"-logic of the jitterbuffer has been horribly
broken.

For people using lost-events, an RTP-stream with a gap in sequencenumbers,
would produce exactly that many lost-events immediately.
So if your sequence-numbers jumped 20000, you would get 20000 lost-events
in your pipeline...

The test that looks after this logic "test_push_big_gap", basically
incremented the DTS of the buffer equal to the gap that was introduced,
so that in fact this would be more of a "large pause" test, than an
actual gap/discontinuity in the sequencenumbers.

Once the test was modified to not increment DTS (buffer arrival time) with
a similar gap, all sorts of crazy started happening, including adding
thousands of timers, and the logic that should have kicked in, the
"handle_big_gap_buffer"-logic, was not called at all, why?

Because the number max_dropout is calculated using the packet-rate, and
the packet-rate logic would, in this particular test, report that
the new packet rate was over 400000 packets per second!!!

I believe the right fix is to don't try and update the packet-rate if
there is any jumps in the sequence-numbers, and only do these calculations
for nice, sequential streams.
2019-06-12 11:39:31 +02:00
Jan Schmidt
f6b91fe303 splitmuxsrc: Protect initial pad configuration with the object lock
gst_splitmux_src_activate_part() configures the pad information
before starting the pad task, but occasionally the changes it makes
to the pad are not seen in the pad task because they're not
protected by the right locking. Use the pad's object lock to
protect those variables.
2019-06-12 02:46:48 +10:00
Jan Schmidt
715c6896a2 splitmuxsrc: Restart pad task on a reconfigure
On a reconfigure event, restart streaming on the pad so
that switching tracks in playbin works cleanly
2019-06-12 02:46:48 +10:00
Jan Schmidt
86c131b668 splitmuxsrc: Use an RW lock instead of a mutex to protect the pad list
Fix a deadlock around the pads list by using an RW lock to
allow simultaneous readers. The pad list doesn't really changes
except at startup and shutdown.
2019-06-12 02:46:48 +10:00
Jan Schmidt
26d6532702 splitmuxsrc: Ignore duplicate seeks
Use the seqnum to ignore duplicated seek events.
2019-06-12 02:46:41 +10:00
Jan Schmidt
18a7c10d4e splitmuxsink: Improve debug output
Make the debug output less confusing by not mentioning a src
pad when doing calculations on the sink pad side.

Improve debug around why a GOP is considered overflowing a fragment
2019-06-06 10:55:42 +10:00
Jan Schmidt
5ae55a4633 splitmuxsink: Give internal queues useful names
Makes debug output more useful
2019-06-06 10:55:42 +10:00
Mart Raudsepp
cbfa4531ee qtdemux: Provide a 2 frames lead-in for audio decoders
AAC and various other audio codecs need a couple frames of lead-in to
decode it properly. The parser elements like aacparse take care of it
via gst_base_parse_set_frame_rate, but when inside a container, the
demuxer is doing the seek segment handling and never gives lead-in
data downstream.
Handle this similar to going back to a keyframe with video, in the
same place. Without a lead-in, the start of the segment is silence,
when it shouldn't, which becomes especially evident in NLE use cases.
2019-06-05 23:13:33 +03:00
Mart Raudsepp
9b348e755c qtdemux: remove indent exception and reindent
As the indent disabling isn't playing along for a following fix,
remove the indent disabling and reindent in a way that doesn't
look too stupid.
2019-06-05 23:11:13 +03:00
Aaron Boxer
7bd1909f4f matroskamux: fix typo in property description 2019-06-05 07:37:17 +01:00
Nicolas Dufresne
f7c712d0b8 rtpssrcdemux: Avoid taking streamlock out-of-band
In this change we now protect the internal srcpads list using the
stream lock and limit usage of the internal stream lock to
preventing data flowing on the other src pad type while creating
and signalling the new pad.

This fixes a deadlock with RTPBin shutdown lock. These two locks would
end up being taken in two different order, which caused a deadlock. More
generally, we should not rely on a streamlock when handling out-of-band
data, so as a side effect, we should not take a stream lock when
iterating internal links.
2019-06-04 09:26:06 -04:00
Niels De Graef
f3970565f0 meson: Bump minimal GLib version to 2.44
This means we can use some newer features and get rid of some
boilerplate code using the G_DECLARE_* macros.

As discussed on IRC, 2.44 is old enough by now to start depending on it.
2019-06-03 16:18:55 +00:00
Sebastian Dröge
2bed2687bb qtmux: Use size of first closed caption buffer in prefill mode
It must be accurate for all samples to work in Final Cut properly, so
the best we can do is to assume that all samples are the same as the
first. Bigger samples are truncated, smaller samples are padded.
2019-06-03 12:46:34 +03:00
Mathieu Duponchelle
f554369ed5 doc: remove xml from comments 2019-05-29 22:20:40 +02:00
Sebastian Dröge
cced65ee21 matroskamux: Add new property to offset all streams to start at zero
This takes the timestamp of the earliest stream and offsets it so that
it starts at 0. Some software (VLC, ffmpeg-based) does not properly
handle Matroska files that start at timestamps much bigger than zero.

Closes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/449
2019-05-29 11:53:02 +00:00