Commit graph

10065 commits

Author SHA1 Message Date
Sebastian Dröge
35a1cedb97 qtmux: Add support for 8k resolutions in prefill mode with ProRes 2020-02-25 15:46:44 +02:00
Sebastian Dröge
3998b7cb4c rtpjitterbuffer: Include string.h for memcpy() / memset()
Usually something else is pulling it in somehow already, but not on
Windows.
2020-02-25 09:07:47 +00:00
Håvard Graff
fdf002d069 rtpsession: fix crash when no extension-header present for twcc 2020-02-24 13:06:27 +00:00
Johan Bjäreholt
ce802f033c matroska-mux: Fix incorrect rounding of timestamps
Previously we saved the buffer_timestamp straight into
mux->cluster_time. Since the cluster time saved into the file does not
have as high precision as GstClockTime depending on the timecodescale
the rounding of relative_timestamp was invalid as mux->cluster_time
which it was calculated relative to was not equal to the cluster time
written to the matroska file.

Example of "mkvinfo -v" of how it looks before and after this change in
an scenario where previously timestamps got out of order because of this
issue.

Notice the timestamp of the SimpleBlock right before and right after the
Cluster now being in order. The consequence of this however is that the
cluster timestamp is not necessarily the same as the timestamp of the
first buffer in the cluster however (in case it's rounded up).

Before

| + SimpleBlock (track number 1, 1 frame(s), timecode 126.922s = 00:02:06.922)
|  + Frame with size 432
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.933s = 00:02:06.933)
|  + Frame with size 329
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.955s = 00:02:06.955)
|  + Frame with size 333
|+ Cluster
| + Cluster timecode: 126.954s
| + Cluster previous size: 97344
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 126.954s = 00:02:06.954)
|  + Frame with size 61239
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.975s = 00:02:06.975)
|  + Frame with size 338

After

| + SimpleBlock (track number 1, 1 frame(s), timecode 135.456s = 00:02:15.456)
|  + Frame with size 2260
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.468s = 00:02:15.468)
|  + Frame with size 332
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.490s = 00:02:15.490)
|  + Frame with size 335
|+ Cluster
| + Cluster timecode: 135.489s
| + Cluster previous size: 158758
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 135.490s = 00:02:15.490)
|  + Frame with size 88070
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.511s = 00:02:15.511)
|  + Frame with size 336
2020-02-21 12:49:28 +00:00
Stefano Buora
2d3dccdba7 rtspsrc: remove useless function calls
Comparing gst_rtspsrc_loop_interleaved and gst_rtspsrc_loop_udp, and investigating on timeout issues, it sounds like a piece of code has been originally copied from udp to the interleaved one. The timeout variable is never used inside the interleaved one. No side effect has been seen in the removed function calls.

The debug message removed is pointless as the timeout used is "src->tcp_timeout" that is fixed.

The presence of the two timeout drove my team in investigating if the reference to the tcp_timeout was correct (it is). Hence we removed the misleading reference to the local timeout variable.
2020-02-20 08:27:35 +00:00
Matthew Waters
1326fcdbcc rtpbin: fix typo setting max-dropout/misorder-time
we were setting the max-dropout-time to the value of the
max-misorder-time which by default has a factor of 30 difference in
value.
2020-02-20 13:46:06 +11:00
Seungha Yang
f286f30640 qtdemux: Parse VP Codec Configuration Box
The VP Codec Configuration Box (vpcC) contains vp9 profile and
colorimetry information. Especially the profile information might
be useful for downstream to select capable decoder element.
2020-02-19 23:18:51 +09:00
Yeongjin Jeong
e836640bd5 flvmux: Support rollover in timestamp
For live streams, if we keep the stream for a long time, the timestamp
will be larger than max_uint32. In that case, timestamp should be handled
as a rollover timestamp rather than a backward timestamp.
2020-02-18 18:39:31 +09:00
Havard Graff
63ae338c24 rtpjitterbuffer: don't use the timer-object after JBUF_UNLOCK
It could have been freed (rtp_timer_free) in the meantime.
2020-02-17 15:04:45 +01:00
Havard Graff
1df706448c rtpmanager: Google Transport-Wide Congestion Control RTP Extension
Generating and parsing the RTCP-messages described in:
https://tools.ietf.org/html/draft-holmer-rmcat-transport-wide-cc-extensions-01
2020-02-14 10:09:02 +00:00
Håvard Graff
9ba9837058 rtpfunnel: various cleanups
* Organize GstRtpFunnelPad and GstRtpFunnel separately
* Use G_GNUC_UNUSED instead of (void) casts
* Don't call an event "caps"
* Use semicolons after GST_END_TEST (helps gst-indent)
2020-02-14 10:08:05 +00:00
Sebastian Dröge
9593a3679e qtdemux: Merge sample tables for raw audio streams with one container sample per audio sample
Instead of having chunks with one sample per raw audio sample, have
chunks with a single sample that contains lots of raw audio samples. If
necessary these are still split again later when reading the stream.

With this we are allocating a lot less memory for the parsed sample
tables and can play files that previously triggered our limit of 200MB
for the sample table. For example, one file here would previously
allocate 3.5GB for the sample table and now only allocates 70KB.
2020-02-14 08:48:01 +00:00
Sebastian Dröge
be1c97d3c9 qtdemux: Add a minimum buffer size for raw audio to not output one buffer per frame
Outputting 48000 buffers per second is not a good idea performance-wise.
If a container sample is less than 1024 raw audio frames, combine
multiple samples to get at least 1024 raw audio samples as long as
they're stored contiguous in the file.

For the other direction, if a container sample contains more than 4096
samples there is already code for splitting them up.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=692750
2020-02-14 08:48:01 +00:00
Mathieu Duponchelle
1471100f37 rtspsrc: fix requested range
When the server replies with a range "now-", it is presumed to
be a "live" stream and we should request a similar range.

This was the case prior to my refactoring to make use of
gst_rtsp_range_to_string in 5f1a732bc7,
this commit restores the behaviour for that case.
2020-02-12 05:47:54 +00:00
Mikhail Fludkov
57b0522cd7 rtpptdemux: set payload to caps inside gst_rtp_pt_demux_get_caps
Refactoring to remove duplicate code and add test
2020-02-11 18:39:22 +00:00
Stian Selnes
629b71ac9c rtpptdemux: Fix debug to use GST_DEBUG_OBJECT 2020-02-11 18:39:22 +00:00
Mikhail Fludkov
851a2b7925 rtpbin: use max-streams on rtpssrcdemux
The proper way of capping on max-streams is to do it in rtpssrcdemux.
This patch uses the newly introduced property on rtpssrcdemux. Previous
behavior would not prevent rtpssrcdemux spawning new pads for every new
ssrc and potentialy causing performance trouble during teardown.
2020-02-11 15:12:07 +01:00
John Bassett
16d750bc01 rtpssrcdemux: Handle RTCP APP packets
Fix crash when processing RTCP APP packets.
2020-02-11 15:12:07 +01:00
John Bassett
5800950a2d rtpssrcdemux: Bad RTP/RTCP packet is not fatal
When used for processing bundled media streams within rtpbin the rtpssrcdemux element may
receive bad RTP and RTCP packets, these should not be treated as a fatal error.
2020-02-11 15:10:12 +01:00
Mikhail Fludkov
35596e7fac rtpssrcdemux: introduce max-streams property
The property is useful against atacks when the sender changes SSRC for
every RTP packet. The property with the same name introduced in rtpbin
was not enough, because we still can end up with thousands of pads
allocated in rtpssrcdemux.
2020-02-11 15:10:12 +01:00
Alexander Lapajne
54c4ba82f8 rtspsrc: Fix for segmentation fault when handling set/get_parameter requests
gstrtspsrc uses a queue, set_get_param_q, to store set param and get
param requests. The requests are put on the queue by calling
get_parameters() and set_parameter(). A thread which executs in
gst_rtspsrc_thread() then pops requests from the queue and processes
them. The crash occured because the queue became empty and a NULL
request object was then used. The reason that the queue became empty
is that it was popped even when the thread was NOT processing a get
parameter or set parameter command. The fix is to make sure that the
queue is ONLY popped when the command being processed is a set
parameter or get parameter command.
2020-02-10 09:43:17 +01:00
Olivier Crête
c00796eaa5 rtpsession: Add test for packet rate maths 2020-02-06 14:01:38 -05:00
olivier.crete@collabora.com
774ddb15b8 rtpstats: Base the packet rate average on the packet rate itself
Do this so that the average update speed is in time instead of varying
based on the actual packet arrival rate.
2020-02-06 14:00:48 -05:00
olivier.crete@collabora.com
a637ec3da8 rtpstats: Don't save the ts & seqnum if the avg is not updated
This makes it update correctly when you have more than one packet per
frame.
2020-02-06 14:00:48 -05:00
Sebastian Dröge
f6e383b749 splitmuxsink: Include actual sink element in the fragment-opened/closed messages
If not configuring the sinks via the "location" property this can be
useful to know for which sink the fragment was actually opened/closed,
especially if finalization of the fragments is happening asynchronously.
2020-01-29 13:30:00 +00:00
Juergen Werner
755dba4561 rtpjitterbuffer: fix scaling from RTP-time to NTP-time
The scaling was inverse.
2020-01-29 12:05:07 +01:00
Mathieu Duponchelle
a245e85fb1 rtprtxsend: allow generic input caps
When connected to an upstream rtpfunnel element, payload-type,
ssrc and clock-rate will not be present in the received caps.

rtprtxsend can already deal with only the clock rate being
present there, a new property is exposed to allow users to
provide a payload-type -> clock-rate map, this enables the
use of the max-size-time property for bundled streams.
2020-01-28 15:44:13 +00:00
Sebastian Dröge
eb0b676fae splitmuxsink: Check the correct sink class for the existence of the "location" property 2020-01-27 15:53:40 +02:00
Sebastian Dröge
5877d945a4 qtdemux: Always prefer information from v1/v2 sound sample description over sample description entry
ffmpeg is doing the same and various files in the wild have bogus
information in the sample description if the same information is also
duplicated afterwards in the v1/v2 sound sample desription.

Previously we only did this for non-raw audio due to
  https://bugzilla.gnome.org/show_bug.cgi?id=374914
but this specific file is already worked around differently. It still
works after this change.

Also remove ad-hoc GST_READ_DOUBLE_BE re-implementation and move the
switch for legacy audio formats after reading all the sample
descriptions as we want to override the values from there.
2020-01-27 14:14:50 +02:00
Sebastian Dröge
c4f6ce789d avimux: Add support for >2 raw audio channels
For this case write a WAVEFORMATEXTENSIBLE header and also reorder the
raw audio channels to the AVI channel order if needed.
2020-01-19 12:09:38 +00:00
Sebastian Dröge
451fc5c112 wavenc: Fix writing of the channel mask with >2 channels
The channel position is an enum but the conversion code assumed it's a
mask. Convert accordingly.
2020-01-13 19:50:06 +00:00
Kristofer Björkström
9c86414279 rtph265pay: TID for NALU type 48 was always set to 7
A typo bug: | instead of & resulted in TID alwasy being set to 7
for the aggregated NALU of type 48
2020-01-13 15:41:30 +01:00
Sebastian Dröge
c17d5e36ad imagefreeze: Add support for replacing the output buffer
By default imagefreeze will still reject new buffers after the first one
and immediately return GST_FLOW_EOS but the new allow-replace property
allows to change this.

Whenever updating the buffer we now also keep track of the configured
caps of the buffer and from the source pad task negotiate correctly
based on the potentially updated caps.

Only the very first time negotiation of a framerate with downstream is
performed, afterwards only the caps themselves apart from the framerate
are updated.
2020-01-11 08:04:43 +00:00
Alicia Boya García
8dd42666e3 qtdemux: Fix race on pad reconnection
Elements emitting frames through several srcpads should use a
flow combiner to aggregate the chain returns and therefore only return
GST_FLOW_NOT_LINKED to upstream when all the downstream pads have
received GST_FLOW_NOT_LINKED.

In addition to that, in order to handle pads being relinked downstream,
the flow combiner should be reset in response to RECONFIGURE events.
This ensures that a both srcpads process a chain operation before a
GST_FLOW_NOT_LINKED can be propagated upstream (which would usually stop
the pipeline).

Otherwise, in a configuration with two srcpads, only one linked at a
time, after the relink the element could chain data through the now
unlinked pad and the flow combiner would resolve as GST_FLOW_NOT_LINKED
(stopping the pipeline) just because the now linked pad has not been
chained yet to update the flow combiner.

This patch adds handling of RECONFIGURE events to qtdemux. Also, since
this event handling causes the flow combiner to be used from a thread
other than the qtdemux streaming thread, usages of the flow combiner
has been guarded by the object lock.
2020-01-09 18:43:02 +00:00
Seungha Yang
8445685a21 splitmuxsink: Fix assertion failure on set_property()
GValue might have null object.

(gst-inspect-1.0:10304): GStreamer-CRITICAL ...
    gst_object_ref_sink: assertion 'object != NULL' failed
2020-01-07 01:24:01 +09:00
Daniel Molkentin
bb1ce82e39 videocrop: allow properties to be animated by GstController 2020-01-03 15:16:02 +01:00
Aaron Boxer
09d4514814 rtspsrc: improved handling of control concatenation with base
Also, `control_url` variable has been renamed to `control_path`,
as it is actually a path.
2019-12-30 16:52:45 +00:00
Aaron Boxer
ed6b5a3a63 rtspsrc: append aggregate control string to base URL before query string
Appending control string to end of query changes meaning of query string
Fixes #650
2019-12-30 16:52:45 +00:00
Niels De Graef
acab06b2e8 alpha: Cleanup using G_DECLARE_FINAL_TYPE
We started depending on GLib 2.44, so we can clean up all the GObject
boilerplate macros.
2019-12-28 04:05:13 +00:00
Stéphane Cerveau
b928517f1e good: use of g_value_dup_string
Use helper method to get string from GValue.
2019-12-20 09:30:26 +00:00
Havard Graff
8b96d8ee8d rtpbin: fix shutdown crash in rtpbin
The key is to make sure the jitterbuffer is set to NULL *before* the
ptdemux.

The race that existed would basically happen when ptdemux had reached
READY, and the jitterbuffer would then push a buffer, triggering a new
pad with a new payloadtype being added and ghosted to the rtpbin itself.

However, the srcpad of the ptdemux would now be inactive, and all the
sticky-event pushed on it would be swallowed, not allowing any to reach
the ghost-pad. Then the buffer in-flight would come to the ghostpad,
and we would assert that a buffer arrived before the necessary
events.

By simply re-ordering the state-changes, we ensure that there will be
no buffer racing into the ptdemux while its state is being changed,
and the problem disappears completely.

Notice also that there is not point in disconnecting the signals on the
ptdemux before this point, since we need the push-thread to settle
down before we can do this in a non-racy way.
2019-12-20 08:27:07 +00:00
Aaron Boxer
4155c59cc4 rtspsrc: avoid seek DISCONT when only rate changes in same direction
Not setting DISCONT avoids a noticable delay when seeking
with only rate changing, in the same direction as current
rate.
2019-12-19 05:54:38 +00:00
Olivier Crête
9db1d740e8 rtspsrc: Remove deprecated GTimeVal
GTimeVal won't work past 2038
2019-12-18 19:48:34 +00:00
Sebastian Dröge
04806a75bd avimux: Add support for S24LE and S32LE raw audio
avidemux already handles this correctly.
2019-12-18 11:16:30 +00:00
Sebastian Dröge
4dbaff424f avimux: Allow muxing v210 video into AVI
avidemux already handles this.
2019-12-18 10:20:25 +00:00
Vivia Nikolaidou
7cbc351e05 flvdemux: Don't replace video codec data when we receive a PAR
Receiving a pixel-aspect-ratio should trigger a caps change, but not
replace the existing video codec tag
2019-12-16 21:51:38 +00:00
Mathieu Duponchelle
5766731bd4 qtmux: protect access to GstElement.sinkpads 2019-12-16 14:17:38 +00:00
Mathieu Duponchelle
e2462005fb qtmux: port to GstAggregator 2019-12-16 14:17:38 +00:00
Joakim Johansson
4d7d577496 gstrtspsrc: Add missing lock on free set_get_param_q
Otherwise is it possible to get a crash in gst_rtspsrc_set_parameter.
2019-12-16 13:13:00 +01:00
Sebastian Dröge
9f6ed9ec72 splitmuxsink: Increment fragment_id even if no fragment location was provided
Applications might handle locations and generally configuration of the
sink by themselves instead of having splitmuxsink set the location on
the sink. Nonetheless it makes sense to increment the fragment_id that
is passed to the signal so that applications know which fragment is
requested.
2019-12-13 22:59:55 +00:00
Jan Alexander Steffens (heftig)
9e0eb77810
flvmux: Use the last DTS for the metadata timestamp
This avoids creating a timestamp regression during a stream.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/merge_requests/429
2019-12-12 11:09:31 +01:00
Mathieu Duponchelle
625eb00c06 qtdemux: send GAP events for lagging audio and video streams too
The logic is taken straight from matroskademux, see
77403d0afe
2019-12-11 19:59:13 +00:00
Seungha Yang
5009cad220 flvmux: Use thread-safe gmtime_r if available
gmtime on *nix is not thread-safe.
2019-12-10 23:48:35 +09:00
Stéphane Cerveau
b44d37a338 splitmuxsink: provides a start-index property
Allow to change the fragment-id start index.
2019-12-05 14:58:40 +00:00
Tim-Philipp Müller
1df530eaa7 rtpjpegdepay: outputs framed jpeg
Add parsed=true to output caps, as we always output
whole frames, timestamped and all. Means also that
the output can be decoded by avdec_mjpeg wihout
plugging an extra parser (which has no rank).
2019-12-04 13:02:54 +00:00
Jan Alexander Steffens (heftig)
06600b2cd9
flvmux: Correct metadata handling in file and stream mode
In file mode, only push one onMetaData at the start of the stream.

In stream mode, always push complete onMetaData. They get replaced, not
merged.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/merge_requests/418
2019-12-03 14:01:19 +01:00
Jan Alexander Steffens (heftig)
6fdb6ece6e
flvmux: Don't calculate duration in streamable mode
There's no header to rewrite, so the duration is left unused.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/merge_requests/418
2019-12-03 14:01:14 +01:00
Havard Graff
a7c887b197 rtpL16depay: don't crash if data is not modulo channels*width 2019-12-03 00:02:48 +00:00
Havard Graff
690c15bd78 rtpopuspay: use baseclass allocator for buffers
That way we get some of the meta -> rtp-extension goodies.
2019-12-02 13:05:12 +01:00
Havard Graff
f997859913 rtpsession: add locking for clear-pt-map
...or it will segfault from time to time...
2019-11-29 14:23:49 +01:00
Linus Svensson
08060dd97b matroskamux: Add property to set DateUTC
Add a property that makes it possible for an application to set the
DateUTC header field in matroska files. This is useful for live feeds,
where the DateUTC header can be set to a UTC timestamp, matching the
beginning of the file.

Needs gstreamer!323

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/481
2019-11-25 14:01:48 +01:00
Linus Svensson
0690bd1b21 matroskamux: Use nanosecond precision for DateUTC
DateUTC is specified with nanosecond precision in matroska, make use of
that.
2019-11-22 16:30:50 +01:00
Jan Alexander Steffens (heftig)
1e7d2e2bbd
matroskamux: Pass the right size to gst_collect_pads_add_pad
We were lucky that GstMatroskamuxPad is larger than GstMatroskaPad.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/merge_requests/393
2019-11-19 14:57:11 +01:00
aogun
a6e28ca268 aacparse: fix wrong offset of adts channel 2019-11-18 01:06:41 +00:00
Seungha Yang
a441779d39 splitmuxsink: Don't take lock during posting message
An application might try to access splitmuxsink from sync message handler
by g_object_{get,set} which takes lock also. In general, we don't
take lock around message handler.
2019-11-18 00:08:36 +00:00
Niels De Graef
7cf4ab6229 Don't pass default GLib marshallers for signals
By passing `NULL` to `g_signal_new` instead of a marshaller, GLib will
actually internally optimize the signal (if the marshaller is available
in GLib itself) by also setting the valist marshaller. This makes the
signal emission a bit more performant than the regular marshalling,
which still needs to box into `GValue` and call libffi in case of a
generic marshaller.

Note that for custom marshallers, one would use
`g_signal_set_va_marshaller()` with the valist marshaller instead.
2019-11-17 15:32:30 +00:00
Nicolas Dufresne
db187eec19 rtpjitterbuffer: Check the exit condition after executing timers
The do_expected_timeout() function may release the JBUF_LOCK, so we need
to check if nothing wanted the timer thread to exit after this call.
The side effect was that we may endup going back into waiting for a timer
which will cause arbitrary delay on tear down (or deadlock when test
clock is used).

Fixes #653
2019-11-14 17:52:16 -05:00
Nicolas Dufresne
fd6cd6f545 rtpjitterbuffer: Check exit condition immediately after JBUF_WAIT
JBUF_WAIT_QUEUE drops the JBUF_LOCK, which means the stop condition
for the chain function may have changed (change_state to NULL). Check
this immediately after the wait so that we don't delay shutting down.
2019-11-14 17:51:31 -05:00
Nicolas Dufresne
e66a4b64b3 videocrop: Also update the coordinate when in-place
This update is needed when the output caps is not changed (e.g. we are
moving a viewport around).

Fixes #669
2019-11-12 17:28:22 -05:00
Nicolas Dufresne
98a5726eba videocrop: Don't always re-run the allocation query
When in-place, running an allocation is not useful since videocrop
is not implicated in the allocation. So only force the allocation
query for the case it was in passthrough. This is needed since the
change in the crop region will likely pull us out of this mode. For the
case we where neither in passthrough or in-place, the allocation query
is already ran by the baseclass, so nothing special is needed.

This fixes performance issues when changing the crop region per frame.
This was reproduced using videocrop2-test.
2019-11-11 16:05:24 -05:00
Nicolas Dufresne
e09b4e9cde videocrop: Cleanup spurious assignment
These are just writing the same thing a second time.
2019-11-11 14:09:47 -05:00
Stéphane Cerveau
9dc1a32d5a splitmuxsink: add fakesink support
fakesink does not support "location" property and was generating
a warning.
2019-11-07 12:28:58 +01:00
Sergey Nazaryev
b4b79a211f multiudpsink: don't lose scope_id 2019-11-05 23:50:11 +00:00
Havard Graff
87457a862d rtpjitterbuffer: make sure not to drop packets based on skew
One of the jitterbuffers functions is to try and make sense of weird
network behavior.

It is quite unhelpful for the jitterbuffer to start dropping packets
itself when what you are trying to achieve is better network resilience.

In the case of a skew, this could often mean the sender has restarted
in some fashion, and then dropping the very first buffer of this "new"
stream could often mean missing valuable information, like in the case
of video and I-frames.

This patch simply reverts back to the old behavior, prior to 8d955fc32b
and includes the simplest test I could write to demonstrate the behavior,
where a single packet arrives "perfectly", then a 50ms gap happens,
and then two more packets arrive in perfect order after that.

# Conflicts:
#	tests/check/elements/rtpjitterbuffer.c
2019-11-02 23:05:32 +00:00
Patricia Muscalu
203ad39d53 qtmux: Fix memory leak while pushing fragmented data
The memory leak occurs in the case when the buffer has been
added to the fragment_buffers array of the current pad and
never been sent because of the push failure of the previous
buffers: moof or mdat header or fragmented buffer(s).
2019-10-24 10:21:11 +00:00
Edward Hervey
8e1c224fbc good: Avoid usage of deprecated API
GTimeval and related functions are now deprecated in glib.
Replacement APIs have been present since 2.26
2019-10-16 07:46:58 +00:00
Tim-Philipp Müller
c9a47c0c8d Remove autotools build system 2019-10-14 11:04:18 +01:00
Aaron Boxer
46989dca96 documentation: fix a number of typos 2019-10-05 22:38:11 +00:00
Simon Arnling Bååth
8173596ed2 gstrtpjitterbuffer: Custom messages when dropping packets
This commit adds custom element messages for when gstrtpjitterbuffer
drops an incoming rtp packets due to for example arriving too late.
Applications can listen to these messages on the bus which enables
actions to be taken when packets are dropped due to for example high
network jitter.

Two properties has been added, one to enable posting drop messages and
one to set a minimum time between each message to enable throttling the
posting of messages as high drop rates.
2019-10-04 20:31:56 +00:00
Thibault Saunier
a55576d1fd qtdemux: Specify REDIRECT information in error message
There are in the wild (mp4) streams that basically contain no tracks
but do have a redirect info[0], in which case, we won't be able
to expose any pad (there are no tracks) so we can't post anything but
an error on the bus, as:

- it can't send EOS downstream, it has no pad,
- posting an EOS message will be useless as PAUSED state can't be
  reached and there is no sink in the pipeline meaning GstBin will
  simply ignore it

The approach here is to to add details to the ERROR message with a
`redirect-location` field which elements like playbin handle and use right
away.

[0]: http://movietrailers.apple.com/movies/paramount/terminator-dark-fate/terminator-dark-fate-trailer-2_480p.mov
2019-09-30 12:15:43 -03:00
Olivier Crête
a24596423a rtpjitterbuffer: Cancel timers instead of just unlocking loop thread
When the queue is full (and adding more packets would risk a seqnum
roll-over), the best approach is to just start pushing out packets
from the other side.  Just pushing out the packets results in the
timers being left hanging with old seqnums, so it's safer to just
execute them immediately in this case. It does limit the timer space
to the time it takes to receiver about 32k packets, but without
extended sequence number, this is the best RTP can do.

This also results in the test no longer needed to have timeouts or
timers as pushing packets in drives everything.

Fixes #619
2019-09-28 07:47:54 -04:00
Nicolas Dufresne
4a9f42430a rtpjitterbuffer: Optimize offset update
As we are applying the same offset over all timers, there timer
ordering won't change, so we can safely skip time-reordering.
2019-09-27 17:34:04 -04:00
Nicolas Dufresne
af1c586c7b rtptimerqueue: Optimize reschedule optations
This basically add ability to choose between inserting from head, tail
or in-place in order to try and minimize the distance to walk through in
the timer queue. This removes an overhead we had seen on high drop rate.
2019-09-27 17:34:04 -04:00
Nicolas Dufresne
1897c1fbe6 rtpjitterbuffer: Fix a typo in comment 2019-09-27 17:34:04 -04:00
Nicolas Dufresne
9ebcadb349 rtpjitterbuffer: Don't use stats timer on the timers queue
The timer passed to update_timers may be from the stats timer. At the
moment, we could endup rescheduling (reusing) that timer onto the normal
timer queue, unschedul it as if it was from the normal timer queue or
duplicate it into the stats timer queue again. This was protected before
as the with the fact the stats timer didn't have a valid idx.
2019-09-27 17:34:04 -04:00
Nicolas Dufresne
81bffb5e5c rtpjitterbuffer: Update timers on ts-offset changes
As the offset is already applied now, we need to update and reschedule
all timers each time the offset is changed. I'm not sure who expect this
to be retro-actively applied, but there was a unit test for it.
2019-09-27 17:34:04 -04:00
Nicolas Dufresne
d4c6c335c5 rtpjitterbuffer: No need to wake the timer thread on head changes
If the jitterbuffer head change, there is no need to systematically
wakeup the timer thread. The timer thread will be waken up on if
an earlier timeout has been pushed. This prevent some more spurious
wakeup when the system is loaded. As a side effect, cranking the clock
may set the clock at an earlier position.
2019-09-27 17:34:04 -04:00
Nicolas Dufresne
36771b75e9 rtpjittterbuffer: Port timers array to RtpTimerQueue
In this patch we now make use of the new RtpTimerQueue instead of the
old GArray. This required a lot of changes all over the place, some of
the important changes are that `timer->timeout` is no longer a PTS but
the actual timeout. This was required to get the RtpTimerQueue sorting
right. The applied offset is saved as `timer->offset`, this allow
retreiving back the PTS when needed.

The clockid updates only happens once per incoming packet. If the
currently schedule timer is before the earliest timer in the queue, we
no longer wakeup the thread. This way, if other timers get setup in the
meantime, this will reduce the number of wakup.

The timer loop code has been mostly rewritten, though the behaviour of
running the lost timers first has been kept (even though there is no
test to show what would be the side effect of doing this differently).

Fixes #608
2019-09-27 17:34:04 -04:00
Nicolas Dufresne
d4b2231de2 rtpjittterbuffer: Port from TimerQueue to RtpTimerQueue 2019-09-27 17:34:04 -04:00
Nicolas Dufresne
f5e3280dbe rtpjitterbuffer: Port use the new RtpTimer structure
First iteration toward porting to the new timer queue.
2019-09-27 17:34:04 -04:00
Nicolas Dufresne
37742cd36d rtptimerqueue: Consolidate a data structure for timers
Implement a single timer queue for all timers. The goal is to always use
ordered queues for storing timers. This way, extracting timers for
execution becomes O(1). This also allow separating the clock wait
scheduling from the timer itself and ensure that we only wake up the
timer thread when strictly needed.

The knew data structure is still O(n) on insertions and reschedule,
but we now use proximity optimization so that normal cases should be
really fast. The GList structure is also embeded intot he RtpTimer
structure to reduce the number of allocations.
2019-09-27 17:34:04 -04:00
Nicolas Dufresne
c917f11ae8 rtpjitterbuffer: Move item structure outside of the element
This moves the RtpJitterBufferStructure type, alloc, free into
rtpjitterbuffer.c/h implementation. jitterbuffer.c strictly rely on
the fact this structure is compatible with GList, and so it make more
sense to keep encapsulate it. Also, anything that could possibly
reduce the amount of code in the element is a win.

In order to support that move, a function pointer to free the data
was added. This also allow making the free function option when
flushing the jitterbuffer.
2019-09-27 13:02:16 -04:00
Nicolas Dufresne
9b706b6220 rtpjitterbuffer: Constify timer pointers where possible
This helps understanding which function modify the Timerdata
and which one does not. This is not always obvious from thelper
name considering recalculate_timer() does not.
2019-09-27 13:02:16 -04:00
Mathieu Duponchelle
b5e414cdc2 rtpbin: add request-jitterbuffer signal
This can be used to pass the threadsharing jitterbuffer from
gst-plugins-rs for example.
2019-09-24 15:33:21 +00:00
Matthew Waters
5ffd733317 build: fix werror build with newer gcc
In file included from ../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/gst.h:55,
                 from ../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/tag/tag.h:25,
                 from ../gst/isomp4/qtdemux.c:56:
In function ‘qtdemux_inspect_transformation_matrix’,
    inlined from ‘qtdemux_parse_trak’ at ../gst/isomp4/qtdemux.c:10676:5,
    inlined from ‘qtdemux_parse_tree’ at ../gst/isomp4/qtdemux.c:14210:5:
../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/gstinfo.h:645:5: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  645 |     gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  646 |         (GObject *) (object), __VA_ARGS__);    \
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/gstinfo.h:1062:35: note: in expansion of macro ‘GST_CAT_LEVEL_LOG’
 1062 | #define GST_DEBUG_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG,   obj,  __VA_ARGS__)
      |                                   ^~~~~~~~~~~~~~~~~
../gst/isomp4/qtdemux.c:10294:5: note: in expansion of macro ‘GST_DEBUG_OBJECT’
10294 |     GST_DEBUG_OBJECT (qtdemux, "Transformation matrix rotation %s",
      |     ^~~~~~~~~~~~~~~~
../gst/isomp4/qtdemux.c: In function ‘qtdemux_parse_tree’:
../gst/isomp4/qtdemux.c:10294:64: note: format string is defined here
10294 |     GST_DEBUG_OBJECT (qtdemux, "Transformation matrix rotation %s",
      |                                                                ^~
2019-09-23 18:46:16 +10:00
Sebastian Dröge
d7738da285 qtmux: Use the new helper functions for mapping the colr atom values to colorimetry 2019-09-18 18:32:02 +03:00
Sebastian Dröge
5d4a46aa63 qtdemux: Use the new helper functions for mapping the colr atom values to colorimetry 2019-09-18 18:29:27 +03:00
Mathieu Duponchelle
eeccb330d0 smpte: don't register transition types twice 2019-09-10 20:52:17 +00:00
Doug Nazar
42dea672fa alpha: Fix one_over_kc calculation
On arm/aarch64, converting from float directly to unsigned int uses
a different opcode and negative numbers result in 0. Cast to
signed int first.
2019-09-09 00:51:53 -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