Commit graph

1070 commits

Author SHA1 Message Date
Nicolas Dufresne
a53ffb6e11 tests: jitterbuffer: Demacroify some helpers
There is no reason for these to be macros anymore. This makes the
test helper much more readable.
2019-09-27 13:02:16 -04:00
Jan Schmidt
31be44c47f splitmux: Add muxer-pad-map property
Add a property which explicitly maps splitmuxsink pads to the
muxer pads they should connect to, overriding the implicit logic
that tries to match pads but yields arbitrary names.
2019-09-06 12:38:56 +00:00
Mathieu Duponchelle
e58ca79741 valgrind: suppress Cond error coming from gnutls
taken from fb4a8dda21
2019-08-08 14:39:17 +00:00
Antonio Ospite
1c5c90ea23 test: rtpbin_buffer_list: add a test for invalid packets in buffer list
Upstream elements can send all kinds of data in a buffer list, so cover
the case of an invalid RTP packet mixed with valid RTP packets.
2019-08-07 15:32:30 -04:00
Antonio Ospite
12b420168c test: rtpbin_buffer_list: add a test for multiplexed RTP and RTCP
RTP and RTCP packets can be muxed together on the same channel (see
RFC5761) and can arrive in the same buffer list.

The GStreamer rtpsession element support RFC5761, so add a test to cover
this case for buffer lists too.
2019-08-07 15:32:30 -04:00
Antonio Ospite
6a5f38a325 test: rtpbin_buffer_list: add a test for different timestamps in buffer list
Buffers with different timestamps (e.g. packets belonging to different
frames) can arrive together in the same buffer list,

Add a test to cover this case.
2019-08-07 15:32:30 -04:00
Antonio Ospite
b158be0d98 test: rtpbin_buffer_list: add function to check timestamp 2019-08-07 15:32:30 -04:00
Antonio Ospite
31f221f89d test: rtpbin_buffer_list: add a test about reordered or duplicated seqnums 2019-08-07 15:32:30 -04:00
Antonio Ospite
1d337b704e test: rtpbin_buffer_list: add a test for lange jump in seqnums with recovery 2019-08-07 15:32:30 -04:00
Antonio Ospite
ae5d4b8cf0 test: rtpbin_buffer_list: add a test for large jump in sequence numbers 2019-08-07 15:32:30 -04:00
Antonio Ospite
fb46c6bf08 test: rtpbin_buffer_list: add a test for wrapping sequence numbers 2019-08-07 15:32:30 -04:00
Antonio Ospite
d9d0461aeb test: rtpbin_buffer_list: add a test for permissible gap in sequence numbers 2019-08-07 15:32:30 -04:00
Antonio Ospite
92be4121e8 test: rtpbin_buffer_list: add a test for the case of failed probation
When a new source fails to pass the probation period (i.e. new packets
have non-consecutive sequence numbers), then no buffer shall be pushed
downstream. Add a test to validate this case.
2019-08-07 15:32:30 -04:00
Antonio Ospite
0537925c3a test: rtpbin_buffer_list: add function to check sequence number 2019-08-07 15:32:30 -04:00
Antonio Ospite
ec56e2fb78 test: rtpbin_buffer_list: add test to verify that receiving stats are correct
Add a test to verify that stats about received packets are correct when
using buffer lists in the rtpsession receive path.

Split get_session_source_stats() in two to be able to get stats from
a GstRtpSession object directly.
2019-08-07 15:32:30 -04:00
Antonio Ospite
80daea90f0 test: rtpbin_buffer_list: add a test for buffer lists on the recv path 2019-08-07 15:32:30 -04:00
Jan Schmidt
436d33b288 splitmuxsink: add the ability to mux auxilliary video streams
The primary video stream is used to select fragment cut points
at keyframe boundaries. Auxilliary video streams may be
broken up at any packet - so fragments may not start with a keyframe
for those streams.
2019-07-15 11:46:36 +00:00
Olivier Crête
efed059b9a rtp session: Add test for collision loopback detection
Ignore further collisions if the remote SSRC change with ours, it's
probably because someone is sending us back the packets we send out.
2019-07-06 14:23:20 +00:00
Olivier Crête
b5faed910e rtpsession tests: Add test for third-party collision detection
Add tests to validate the code that ignores the same packets coming
from 2 different sources (an third-party collision).
2019-07-06 14:23:20 +00:00
Olivier Crête
3574e6c176 rtpsession: Add test for collision on incoming packets
Make sure that the collision is properly detected on incoming packets.
2019-07-06 14:23:20 +00:00
Olivier Crête
4e18567863 rtpsession test: Verify that on-ssrc-collision message is emitted 2019-07-06 14:23:20 +00:00
Olivier Crête
9d9d543d5c rtpsession: Also send conflict event when sending packet
If the conflict is detected when sending a packet, then also send an
upstream event to tell the source to reconfigure itself.

Also ignore the collision if we see more than one collision from the same
remote source to avoid problems on loops.
2019-07-06 14:23:20 +00:00
Olivier Crête
061afa33ee rtph265pay: Also immediately send packet if it is a suffix NAL
Immediately send packet if it contains any suffix NAL, this is required
in case they come after the VCL nal to not have to wait until the next frame.
2019-07-03 19:05:29 +00:00
Olivier Crête
97f2fb4cc8 rtph26xpay: Wait until there is a VCL or suffix NAL to send
With unit tests.
2019-07-03 19:05:29 +00:00
Olivier Crête
4810c93222 rtph265pay test: Add unit tests for aggregation 2019-07-03 19:05:29 +00:00
Olivier Crête
1b32cb1eae rtph265pay: Implement Aggregation packets
Align with rtph264pay
2019-07-03 19:05:29 +00:00
Olivier Crête
42d775dfbe rtph264pay test: Add unit tests for aggregation 2019-07-03 19:05:29 +00:00
Olivier Crête
cede4f993d rtph264pay: Default to not adding latency when aggregating
Send the bundle as soon as there is one VCL unit in the packet at
the end of an incoming buffer.

The DELTA_UNIT flag is not reliable, so ignore it.
2019-07-03 19:05:29 +00:00
Olivier Crête
0c094612be rtp-payloading test: Fix working to 1.0 buffers instead of groups 2019-07-03 19:05:29 +00:00
Jan Alexander Steffens (heftig)
b46dab13d2 rtph264pay: Support STAP-A bundling
Add a new property "do-aggregate"* to the H.264 RTP payloader which
enables STAP-A aggregation as per [RFC-6184][1]. With aggregation enabled,
packets are bundled instead of sent immediately, up until the MTU size.
Bundles also end at access unit boundaries or when packets have to be
fragmented.

*: The property-name is kept generic since it might apply more widely,
   e.g. STAP-B or MTAP.
[1]: https://tools.ietf.org/html/rfc6184#section-5.7

Closes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/434
2019-07-03 19:05:29 +00:00
Havard Graff
4d4e8f99b9 rtpjitterbuffer: Add unit test for unsolicited rtx affecting 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
Jan Alexander Steffens (heftig)
91e858dcbe
test: flvmux: Test changing caps with one sinkpad
These tests segfault without the preceding crash fix.
2019-06-19 14:36:21 +02:00
Jan Alexander Steffens (heftig)
daafce54ac
test: flvmux: Use gst_harness_sink_push_many
And check its return value.
2019-06-19 14:36:21 +02:00
Mathieu Duponchelle
ebe2756434 jitterbuffer: unset DTS on output buffers 2019-06-14 16:02:59 +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
Havard Graff
dd422f0b7f rtpjitterbuffer: fix unused variables 2019-06-12 11:39:31 +02:00
Nicolas Dufresne
f227f65947 supp: Ignore leaks caused by shout/sethostent
sethostent() seems to be using a global state and we endup with leaks from
that API when called through shout_init(). We had the option to only
ignore the shout case, but the impression is that if we have shout and
another sethostend user, as it's a global state, we may endup with a
different stack trace for the same leak. So in the end, we just ignore
memory allocated by sethostent in general.
2019-06-04 13:41:30 -04: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
Nicolas Dufresne
947a37f3c8 rtpsession: Always keep at least one NACK on early RTCP
We recently added code to remove outdate NACK to avoid using bandwidth
for packet that have no chance of arriving on time. Though, this had a
side effect, which is that it was to get an early RTCP packet with no
feedback into it. This was pretty useless but also had a side effect,
which is that the RTX RTT value would never be updated. So we we stared
having late RTX request due to high RTT, we'd never manage to recover.

This fixes the regression by making sure we keep at least one NACK in
this situation. This is really light on the bandwidth and allow for
quick recover after the RTT have spiked higher then the jitterbuffer
capacity.
2019-05-17 19:13:22 +00:00
Nicolas Dufresne
84c102b6fe rtpsession: Call on-new-ssrc earlier
Right now, we may call on-new-ssrc after we have processed the first
RTP packet. This prevents properly configuring the source as some
property like "probation" are copied internally for use as a
decreasing counter. For this specific property, it prevents the
application from disabling probation on auxiliary sparse stream.

Probation is harmful on sparse streams since the probation algorithm
assume frequent and contiguous RTP packets.
2019-05-02 14:44:58 -04:00
Nicolas Dufresne
a8ea9f0d05 test: rtpsession: Verify on-sending-nacks callback 2019-04-07 12:00:49 -04:00
Mathieu Duponchelle
280d86a841 rtpsession: Add disable-sr-timestamp property
The Onvif Streaming Spec, in section 6.11, mandates that when
Rate-Control is disabled potential RTCP packets shall have
their timestamps set to 0.

<https://www.onvif.org/specs/stream/ONVIF-Streaming-Spec.pdf>
2019-04-05 20:23:08 +02:00
Nicolas Dufresne
464ada3f29 test: rtpsession: Test FB Nack packing
We used to split the NACK if a smaller seqnum of a range of seqnum was
submited. This test also make sure that the three operations (append,
prepend, update) works properly.
2019-04-05 14:53:09 +00:00
Nicolas Dufresne
a31569713f test: rtpsession: Test handling of NACK surplus
This test verify that NACKs that didn't fit in one packet are properly
filtered and inserted into the following pipeline.
2019-04-05 14:53:09 +00:00
John Bassett
74a74bfc99 rtpsession: Fix race when sending PLI, FIR and NACK packets
Calling rtp_session_send_rtcp before marking the source as requiring a
pli/fir/nack meant the rtcp_thread could be scheduled and start running
before the source was updated. This meant the request would not be sent
early but instead was transmitted with the next regular RTCP packet.

Add test for nack generation.
2019-04-05 14:53:09 +00:00
Antonio Ospite
6f12f1cecc test: rtpbin_buffer_list: add test to verify that stats are correct
Add a test to verify that stats about sent and received packets are
correct even when using buffer lists.

NOTE: the newly introduced get_session_source_stats() selects the
desired source (sender or receiver) by filtering them by type (using the
get_sender parameter) rather than by ssrc because this simplifies the
code and it's good enough for testing purposes as there is usually one
source per type in the test setup.

Filtering by ssrc would have required handling asynchronous signals like
"on-new-sender-ssrc", with the relative locking, just to retrieve the
actual ssrc of the sender.
2019-04-02 13:02:28 +02:00