Commit graph

10202 commits

Author SHA1 Message Date
Tim-Philipp Müller
10f07e84a5 rtpfunnel: protect internal srccaps with lock
These are modified from sink pad event handlers, so
could be accessed from multiple threads at the same
time.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/681>
2020-07-28 07:08:04 +00:00
Havard Graff
f5fc34ae83 rtpfunnel: copy caps before sending them in a caps-event
Reason being we don't want downstream to own a ref to our
internal caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/681>
2020-07-28 07:08:04 +00:00
Mathieu Duponchelle
aa34c29d3b rtpmanager: fix various documentation issues
Improper naming of properties, improper links, misc

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/684>
2020-07-27 13:51:15 +00:00
Stéphane Cerveau
c943be8b25 qtdemux: add Dolby Vision fourcc
This identifiers are registered in the MPEG-RA and defined
to be used by the Dolby Vision AVC/HEVC streams.

This is a first step to present the stream to the decoder.
Additional box parsing of DOVIConfigurationBox is necessary
to complete the media presentation with proper Dolby Vision
enhancements.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/658>
2020-07-21 15:53:52 +00:00
Luke Yelavich
1e39fe66ad imagefreeze: Copy GstCapsFeatures to caps for source pad
Allows using imagefreeze with buffers in GLMemory. The following pipeline
works.

gst-launch-1.0 filesrc location=image.jpg ! jpegdec ! glupload ! \
imagefreeze ! glcolorconvert ! glimagesinkelement

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/594>
2020-07-20 21:12:09 +00:00
Tim-Philipp Müller
913e17e19e rtpmanager: fix "redefinition of typedef RTPTWCCManager" compiler warning
G_DECLARE_FINAL_TYPE includes this typedef as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/675>
2020-07-20 18:20:59 +01:00
Olivier Crête
7effe918d1 rtp*pay: Allocate using the base class for audio codecs
This is required to add RTP header extensions from the
meta automatically.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/674>
2020-07-17 16:53:40 -04:00
Ognyan Tonchev
adb044c9ed rtspsrc: Fix segfault with illegal free
set_get_param_q is not a pointer so it is illegal to call g_queue_free_full().
Freeing the requests by popping them from the queue instead.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/669>
2020-07-15 13:19:38 +00:00
Justin Chadwell
738f32d5d0 qtdemux: fix allocation explosion with stsd entries
Previously, the user input for stsd entries is trusted completely, and
so a maliciously crafted file could choose the length of the stsd
entries arbitrarily and cause qtdemux to try to allocate up to 2GB of
memory (half of a 32 bit max int).

This patch fixes this by sanity checking the stsd input against the
size of the entire stsd atom.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/670>
2020-07-15 12:10:45 +00:00
Justin Chadwell
e6f66f4681 qtdemux: fix crashes when input stream contained no stsd entries
During trak parsing, we need to check for the existence of stsd_entries,
otherwise, we end up with a NULL pointer to them. It is entirely
possible for the stsd to exist, but for it to have no entries, which the
previous checks did not take into account.

This patch adds a simply check to ensure that all files that do not
contain a stsd entry are deemed corrupt, and adds a test case to prevent
a regression.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/670>
2020-07-15 12:10:45 +00:00
Sebastian Dröge
54bc0157b5 qtmux: Don't lock object lock twice in prefill mode
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/762

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/663>
2020-07-07 12:36:01 +03:00
Tim-Philipp Müller
31ff328727 meson: add update-orc-dist target
Add target to update backup orc -dist.[ch] files.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/662>
2020-07-04 15:04:59 +01:00
Nirbheek Chauhan
c7f8c8d4ef deinterlace: Disable nasm support on x32
The assembly assumes pointers are 64-bit, so just disable it.

Closes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/757

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/660>
2020-07-02 07:53:14 +05:30
Nirbheek Chauhan
3fe4626e3c deinterlace: Fix build on x32
Need to pass `-f elfx32` to nasm in that case.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/757

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/657>
2020-07-01 19:43:41 +00:00
Jan Schmidt
7ae40045ba matroska-mux: Wait for caps on sparse streams
Don't set sparse streams to non-waiting at the collectpads
level until after capa arrive, as we need caps on all
pads before the file headers get written, or else the
subtitle track will be silently absent in the final file.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/724

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/656>
2020-07-01 19:24:49 +01:00
Jan Schmidt
ed5e935fb7 matroska-mux: Warn on late caps arrival
As well as warning when caps change after the headers
were already written, make sure to warn if the *first* caos
arrive late too.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/656>
2020-07-01 16:13:27 +10:00
Sebastian Dröge
e589a950c3 imagefreeze: Return TRUE from the LATENCY query handling
We always answer it successfully no matter what.

The default return value in the function is FALSE even if the code below
sets it again to FALSE.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/654>
2020-06-30 18:37:06 +03:00
Sebastian Dröge
8345caf6e0 imagefreeze: Add a live mode
Previously imagefreeze would always operate as non-live element and
output frames as fast as possible according to the configured segment
(via SEEK events) and the negotiated framerate from start to stop or the
other way around.

With the new live mode (enabled via the is-live property) it would only
output frames in PLAYING. Frames would be output according to the
negotiated framerate unless it would be too late, in which case it would
jump ahead and skip over the requirement amount of frames.

This makes it possible to actually use imagefreeze in live pipelines
without having to manually ensure somehow that it would start outputting
at the current running time and without still risking to fall behind
without recovery.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/653>
2020-06-29 12:07:14 +03:00
Sebastian Dröge
06b29a4aef imagefreeze: Correctly answer the LATENCY query
We never run as a live element, even if upstream is live, and never
output any buffers with latency but immediately generate buffers as
fast as we can according to the negotiated framerate.

Passing the query upstream would proxy whatever mode of operation
upstream has, which has nothing to do with how we produce buffers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/653>
2020-06-28 22:26:23 +03:00
Tim-Philipp Müller
4f555ecf8e splitmuxsink: flesh out docs for format-location* signals
Make explicit that the returned strings need to be g_free()-able.

Fixes #753

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/652>
2020-06-26 18:31:10 +00:00
Havard Graff
57eebe8b05 rtpstats: guard against division by zero
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/646>
2020-06-26 15:29:25 +00:00
Havard Graff
e45cc475bd rtptwcc: fix pruning of ack'ed twcc-packets
Fixes #750

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/645>
2020-06-26 12:53:07 +01:00
Sebastian Dröge
13331e051f splitmuxsink: Add new properties for setting muxer/sink presets
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/644>
2020-06-25 17:53:00 +03:00
Mathieu Duponchelle
8d464c8361 autodetect: mark filter-caps property as DOC_SHOW_DEFAULT
When generating the cache we inspect the base class through
an instance of one of its subclasses. We don't want potential
assignments in subclasses initialization to leak into the
base class documentation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/641>
2020-06-24 17:04:51 +02:00
Mathieu Duponchelle
f97430f6e9 docs: mark GstIirEqualizer as plugin API 2020-06-23 19:04:03 +02:00
Mathieu Duponchelle
c897fe2b73 docs: mark more types as plugin API 2020-06-23 10:25:55 -04:00
He Junyan
15fac84f63 deinterlace: Add the missing ORC_RESTRICT define.
ORC_RESTRICT may not be defined in yadif.c and cause build error.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/637>
2020-06-21 20:11:06 +08:00
Seungha Yang
9122bfdfb7 meson: deinterlace: Check host cpu type for asm build
Add host cpu type check as we would enable asm only for x86_64

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/636>
2020-06-19 20:28:14 +09:00
Jan Schmidt
5c68e06b00 qtdemux: Split tag reading functions out
Move some code out of the enormous qtdemux.c into a separate
qtdemux_tags helper, and make some structs available via qtdemux.h
to accommodate that.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/634>
2020-06-18 14:41:27 +00:00
Jan Schmidt
0ddfc5020f qtdemux: Move some tree parsing files out to a separate file.
Reduce a tiny bit of the bulk of qtdemux.c by moving some
agnostic helper functions out.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/634>
2020-06-18 14:41:27 +00:00
Jan Schmidt
e2d75939bb qtdemux: Factor out svmi parsing. Fix bounds checking.
Move the SVMI stereoscopic atom parsing out to a helper
function to shrink qtdemux_parse_trak a bit.

Add a bounds check that the received atom is large enough
before parsing it.

Add a note to the atom parser that svmi comes from the
MPEG-A spec 23000-11.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/634>
2020-06-18 14:41:27 +00:00
Seungha Yang
8b4f18d53b rtspsrc: Don't return TRUE for unhandled query
Expected return value for unhandled query is FALSE

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/629>
2020-06-16 19:35:30 +09:00
Vivia Nikolaidou
536ff4776f deinterlace: Add yadif ASM optimisations
Measured to be about 3.4x faster than C

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/621>
2020-06-16 12:53:25 +03:00
Vivia Nikolaidou
ef78014d15 deinterlace: Fix invalid read in yadif
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/621>
2020-06-12 13:21:02 +03:00
Sebastian Dröge
556e7ab210 flvdemux: Change a GST_ERROR_OBJECT() back to GST_DEBUG_OBJECT()
It was accidentally changed in https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/436

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/624>
2020-06-12 09:52:56 +03:00
Jordan Petridis
3e2420361a Use gst_element_class_set_metadata when passing dynamic strings
gst_element_class_set_metadata is meant to only be used with
static or inlined strings, which isn't the case for the 2 elements
here resulting in use-after-free later on.

https://gstreamer.freedesktop.org/documentation/gstreamer/gstelement.html?gi-language=c#gst_element_class_set_static_metadata

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/622>
2020-06-11 20:39:33 +03:00
Sebastian Dröge
f8196e06d5 Revert "rtpjitterbuffer: Avoid deadlock on flush"
This reverts commit 54810bf44f

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/620>
2020-06-10 16:31:06 +00:00
U. Artie Eoff
bf0842aa0c rtpjitterbuffer: g_queue_clear_full introduced in glib 2.60
Define g_queue_clear_full if glib < 2.60.

Fixes #747

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/619>
2020-06-09 13:09:20 -07:00
Thibault Saunier
29a661d4a4 rtpsession: Make internal-ssrc as show default for doc 2020-06-09 11:45:13 -04:00
Nicolas Dufresne
5b2ad31583 rtptimerqueue: Fix leak on timer collision
While the caller should make sure this does not happen, make sure timer
collision are not silently ignored and leaked.

Fixes #726

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/616>
2020-06-08 17:54:53 -04:00
Nicolas Dufresne
b4f421e9aa rtpjitterbuffer: Keep JBUF lock while processing timers
Until now, do_expected_timeout() was shortly dropping the JBUF_LOCK in order
to push RTX event event without causing deadlock. As a side effect, some
CPU hung would happen as the timerqueue would get filled while looping over
the due timers. To mitigate this, we were processing the lost timer first and
placing into a queue the remainign to be processed later.

In the gap caused by an unlock, we could endup receiving one of the seqnum
present in the pending timers. In that case, the timer would not be found and
a new one was created. When we then update the expected timer, the seqnum
would already exist and the updated timer would be lost.

In this patch we remove the unlock from do_expected_timeout() and place all
pending RTX event into a queue (instead of pending timer). Then, as soon as
we have selected a timer to wait (or if there is no timer to wait for) we send
all the upstream RTX events. As we no longer unlock, we no longer need to pop
more then one timer from the queue, and we do so with the lock held, which
blocks any new colliding timers from being created.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/616>
2020-06-08 17:54:53 -04:00
Edward Hervey
54810bf44f rtpjitterbuffer: Avoid deadlock on flush
When a GST_EVENT_FLUSH_START reaches the jitterbuffer, there is a chance that
our task is currently blocking waiting for a timer.

There was two problems:
* That wait wasn't checking for flushing situations
* The flushing handling wasn't waking up that conditional (to check whether it
should abort)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/608>
2020-06-08 13:34:26 +02:00
Mathieu Duponchelle
f63299ff2f plugins: uddate gst_type_mark_as_plugin_api() calls 2020-06-06 00:42:25 +02:00
Sebastian Dröge
e527eb3e4c rtpbin: Initialize uninitialized variable correctly
`last_out` would be used uninitialized if the element has no `set-active`
signal. Initialize it to -1 as that's what the "default" value is
further below.

CID 1455443

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/727

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/613>
2020-06-05 11:49:17 +03:00
Thibault Saunier
6f0f41fef0 doc: Fix wrong link to GString in rtpjitterbuffer 2020-06-03 22:44:09 -04:00
Mathieu Duponchelle
37c619f995 plugins: Use gst_type_mark_as_plugin_api() for all non-element plugin types 2020-06-03 22:44:09 -04:00
Sebastian Dröge
b94b9988fa rtspsrc: Use the correct type for storing the max-rtcp-rtp-time-diff property
It's an integer property and rtpbin also expects an integer. Passing it
as a GstClockTime (guint64) to g_object_set() will cause problems, and
on big endian MIPS apparently causes crashes.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/737

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/605>
2020-05-27 22:33:31 +03:00
Thibault Saunier
3fdae346ca rtspsrc: Error out when failling to receive message response
And let it rety twice.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/717

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/601>
2020-05-25 20:13:06 -04:00
Sebastian Dröge
2c278bb2ab flvdemux: Send gap events if one of the streams falls behind the other by more than 3s
Same mechanism and threshold as in other demuxers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/597>
2020-05-20 18:46:41 +00:00
Sebastian Dröge
0bb9880b36 flvdemux: Remove unused audio_linked/video_linked booleans
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/597>
2020-05-20 18:46:41 +00:00
Edward Hervey
5dd3643d94 flvdemux: Answer bitrate queries from upstream
If upstream (such as queue2 in urisourcebin) asks for our bitrate, check if we
have stored audio/video bitrates, and use them.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/596>
2020-05-20 16:51:47 +03:00
Edward Hervey
e8282661b6 flvdemux: Handle empty metadata strings
g_utf8_validate() errors out on empty string. But empty strings are valid,
so only check if they're not

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/596>
2020-05-20 10:48:06 +02:00
Edward Hervey
9f5f906515 flvdemux: Set ACCEPT_TEMPLATE flag on sinkpad
A demuxer can accept any caps matching its sinkpad template caps

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/596>
2020-05-20 10:48:06 +02:00
Jan Schmidt
d8f0deadc3 deinterlace: Split out NULL checks in yadif
Separate out explicit NULL checks for fields we depend on so
that coverity can hopefully verify dependencies better.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/585>
2020-05-09 03:09:03 +10:00
Jan Schmidt
1106eb16b6 deinterlace: Handle NV12/NV21 for the greedyl mode.
Don't fall back on the default interpolate_scanline function, which
blindly tries to copy from the next field, which can be NULL in
mixed progressive/interlaced streams

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/585>
2020-05-09 03:07:33 +10:00
Vivia Nikolaidou
82dc670f1f deinterlace: Support packed formats for YADIF
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/444>
2020-05-06 17:08:06 +00:00
Vivia Nikolaidou
5fce46f5ef deinterlace: Call the planar functions for the Y plane of nv12/nv21
In some algorithms (like yadif), the Y plane has to be handled different
than the UV plane. Therefore, the planar_y functions are now called for
the Y plane, and the nv12/nv21 functions are handling only the UV/VU
planes respectively.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/444>
2020-05-06 17:08:06 +00:00
Jan Schmidt
e9ee7ab0af deinterlace: Add C implementation of YADIF
Import the YADIF deinterlacer from ffmpeg and modify
it to match the simple deinterlace scanlines structure.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/444>
2020-05-06 17:08:06 +00:00
Jan Schmidt
1c1bc56a3b deinterlace: Allow for 5 fields for interpolation
Add an extra field to the simple deinterlace implementation,
so that methods can potentially use 5 fields - the current
field, and 2 before and 2 after.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/444>
2020-05-06 17:08:06 +00:00
Jan Schmidt
5468988223 deinterlace: Force renegotiation when changing mode
Switching the deinterlacing mode on-the-fly from disabled to
auto used to work, but was broken by commit #1f21747c some
years ago.

Force re-negotiation with downstream when the mode or
fields properties are changed, otherwise deinterlace
never switches out of the passthrough mode.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/584>
2020-05-07 01:31:59 +10:00
Sebastian Dröge
e5feaa76ed imagefreeze: Handle flushing correctly
First of all get rid of the atomic seeking boolean, which was only ever
set and never read. Replace it with a flushing boolean that is used in
the loop function to distinguish no buffer because of flushing and no
buffer because of an error as otherwise we could end up in a
GST_FLOW_ERROR case during flushing.

Also only reset the state of imagefreeze in flush-stop when all
processing is stopped instead of doing it as part of flush-start.

And last, get a reference to the imagefreeze buffer in the loop function
in the very beginning and work from that as otherwise it could in theory
be replaced or set to NULL in the meantime as we release and re-take the
mutex a couple of times during the loop function.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/580>
2020-05-06 08:06:33 +00:00
Edward Hervey
756f390f56 videbox: Use MIN instead of CLAMP for uint
an unsigned int is always positive.

CID #206207
CID #206208
CID #206209
CID #206210
CID #206211

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/583>
2020-05-06 06:49:09 +00:00
Edward Hervey
619457ae26 avidemux: Avoid potential double-free
stream->name was being freed (without being NULL-ed) before we were certain it
would be set again.

CID #1456071

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/582>
2020-05-06 04:36:46 +00:00
Edward Hervey
518d192dc5 deinterlace: Don't leak frame in error case
CID #1455494

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/581>
2020-05-05 17:30:48 +02:00
Edward Hervey
cfb9a5d53a slitmuxsrc: Properly stop the loop if not part reader is present
Previously this would end up in a refcounting loop of hell.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/578>
2020-05-05 15:32:58 +02:00
Vivia Nikolaidou
6a38961561 flvmux: Add skip-backwards-streams property
Backwards timestamps confuse librtmp, even if they're only backwards
relative to the other stream. If the timestamp of a stream is going
backwards related to the other stream, this property allows the muxer to
skip a few buffers until it reaches the timestamp of the other stream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/572>
2020-04-27 16:18:34 +03:00
Vivia Nikolaidou
b0855113c6 flvmux: Allow requesting streamable pads after header is written
Allows us to request pads after writing header for streamable flv's.

For non-streamable it doesn't make sense to request a new pad after
writing the header, because the headers have been written already and we
can't add the new stream. But for streamable, any clients that connect
after the new pad has been added will be able to see both streams.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/572>
2020-04-27 14:11:10 +03:00
Olivier Crête
3ae1bae2a3 qtdemux: Add 'mp3 ' fourcc that VLC seems to produce now
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/574>
2020-04-22 15:32:31 -04:00
Sebastian Dröge
7b22397cf5 rtpjitterbuffer: Properly free internal packets queue in finalize()
As we override the GLib item with our own structure, we cannot use any
function from GList or GQueue that would try to free the RTPJitterBufferItem.
In this patch, we move away from g_queue_new() which forces using
g_queue_free(). This this function could use g_slice_free() if there is any items
left in the queue. Passing the wrong size to GSLice may cause data corruption
and crash.

A better approach would be to use a proper intrusive linked list
implementation but that's left as an exercise for the next person
running into crashes caused by this.

Be ware that this regression was introduced 6 years ago in the following
commit [0], the call to flush() looked useless, as there was a g_queue_free()
afterward.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

[0] 479c7642fd

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/573>
2020-04-22 10:28:30 -04:00
Seungha Yang
ca48f5265e splitmuxsink: Enhancement for timecode based split
The calculated threshold for timecode might be varying depending on
"max-size-timecode" and framerate.
For instance, with framerate 29.97 (30000/1001) and
"max-size-timecode=00:02:00;02", every fragment will have identical
number of frames 3598. However, when "max-size-timecode=00:02:00;00",
calculated next keyframe via gst_video_time_code_add_interval()
can be different per fragment, but this is the nature of timecode.
To compensate such timecode drift, we should keep track of expected
timecode of next fragment based on observed timecode.
2020-04-20 21:39:49 +09:00
Seungha Yang
fe73c3b0f3 splitmuxsink: Post error when requested timecode interval is invalid
In case we cannot rely on max-size-timecode for split decision,
post error instead of crashing
2020-04-19 20:23:32 +09:00
Havard Graff
981d0c02de rtpjitterbuffer: don't use RTX packets in rate-calc and reset-logic
The problem was this:

Due to the highly irregular arrival of RTX-packet the max-misorder variable
could be pushed very low. (-10).

If you then at some point get a big in the sequence-numbers (62 in the
test) you end up sending RTX-requests for some of those packets, and then
if the sender answers those requests, you are going to get a bunch of
RTX-packets arriving. (-13 and then 5 more packets in the test)

Now, if max-misorder is pushed very low at this point, these RTX-packets
will trigger the handle_big_gap_buffer() logic, and because they arriving
so neatly in order, (as they would, since they have been requested like
that), the gst_rtp_jitter_buffer_reset() will be called, and two things
will happen:
1. priv->next_seqnum will be set to the first RTX packet
2. the 5 RTX-packet will be pushed into the chain() function

However, at this point, these RTX-packets are no longer valid, the
jitterbuffer has already pushed lost-events for these, so they will now
be dropped on the floor, and never make it to the waiting loop-function.

And, since we now have a priv->next_seqnum that will never arrive
in the loop-function, the jitterbuffer is now stalled forever, and will
not push out another buffer.

The proposed fixes:
1. Don't use RTX in calculation of the packet-rate.
2. Don't use RTX in large-gap logic, as they are likely to be dropped.
2020-04-16 17:06:31 +02:00
Sebastian Dröge
d75ea5b340 splitmuxsink: Do split-at-running-time splitting based on the time of the start of the GOP
If the start of the GOP is >= the requested running time, put it into a
new fragment. That is, split-at-running-time would always ensure that a
split happens as early as possible after the given running time.

Previously it was comparing against the current incoming timestamp,
which does not tell us what we actually want to know as it has no direct
relation to the GOP start/end.
2020-04-15 17:52:41 +03:00
Sebastian Dröge
0ab0f92cac splitmuxsink: Fix off-by-one in running time comparison for split-at-running-time
If we get a keyframe exactly at the requested running time we would only
split on the next keyframe afterwards due to wrong usage of > vs. >=.
2020-04-15 13:33:17 +03:00
Thibault Saunier
fd7ecac793 rtspsrc: Properly set segments seqnums after seeks 2020-04-09 14:03:04 -04:00
Vivia Nikolaidou
9189cdcb1d flvdemux: Don't write an empty string as a tag
To stop warnings like:

GStreamer-WARNING **: 19:47:48.186: Trying to set empty string on
taglist field 'encoder'. Please file a bug.
2020-04-08 20:22:51 +03:00
Thibault Saunier
00539e1277 rtspsrc: Avoid stack overflow recursing waiting for response
Instead of recursing, simply implement a loop with gotos, the same
way it was done before 8121752887

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/710
2020-04-08 09:49:49 -04:00
Sebastian Dröge
cf3fbf57bf qtmux: Add property for enforcing the creation of chunks in single-stream files
This is disabled by default as it unnecessarily creates bigger headers
but it is something that is required by some applications and most
notably the Apple ProRes spec.
2020-04-06 16:25:59 +03:00
Jan Schmidt
a3933ea53d flvmux: Fix invalid padlist accesses.
Request pads can released at any time, so make sure to hold
the object lock when iterating the element sinkpads list where
that's safe, or to use other safe pad iteration patterns in
other places.

When choosing a best pad, return a reference to the pad to make sure it
stays alive for output in the aggregator srcpad task.

Should fix a spurious valgrind error in the CI flvmux tests and some
other potential problems if the request sink pads are released while
the element is running..

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/714
2020-04-05 11:50:43 +00:00
Vivia Nikolaidou
5817c659e6 qtmux: Add option to create a timecode trak in non-mov flavors
Even if timecode trak is officially unsupported in non-mov flavors,
some software still supports it, e.g. Final Cut Pro X:

https://developer.apple.com/library/archive/technotes/tn2174/_index.html

The user might still expect to see the timecode information in the
non-mov file despite it being officially unsupported , because other
software e.g. QuickTime will create a timecode trak even in mp4 files.
Furthermore, software that supports timecode trak in non-mov flavors
will also display the file duration in "timecode units" instead of real
clock time, which is not necessarily the same for 29.97 fps and friends.
This might confuse users, who see a different duration for the same
framerate and amount of frames depending on whether the container is mp4
or mov.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/512
2020-04-03 18:19:38 +00:00
Sebastian Dröge
db69f02dd8 rtpLXXdepay: Set the UNPOSITIONED flag on the audio-info when configuring an unpositioned layout
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/688
2020-04-03 17:57:23 +00:00
Kristofer Björkström
586fc57e55 rtpjpeg: Use gst_memory_map() instead of gst_buffer_map()
gst_buffer_map () results in memcopying when a GstBuffer contains
more than one GstMemory.
This has quite an impact on performance on systems with limited amount
of resources. With this patch the whole GstBuffer will not be mapped at
once, instead each individual GstMemory will be iterated and mapped
separately.
2020-04-03 17:01:24 +02:00
Kristofer Björkström
54b6ee0c55 buffermemory: keep track of buffer size and current offset
Added the possibility to get current offset and the total size of the
buffer.
2020-04-03 17:01:24 +02:00
Havard Graff
d9aaa15a30 rtpopuspay: make depay ! pay work
There is a use-case for a server to re-payload opus going through it.

Problem was that the payloader requires channels in the caps, but
this is not something the depayloader can parse out of the stream, meaning
caps-negotiation would fail.

Removing the requirement of channels in the template-caps fixes this.
2020-04-03 09:04:32 +00:00
Seungha Yang
599066726f splitmuxsink: Don't send too many force key unit event
splitmuxsink should requst keyframe depending on configured
threshold and previously requested time in order to avoid too many
keyframe request.
2020-04-03 15:00:37 +09:00
Jan Schmidt
78eaa7c6ed matroska: Check the return value of gst_segment_do_seek()
gst_segment_do_seek() can fail.
2020-04-02 05:23:17 +00:00
Sebastian Dröge
f757fbe0f7 qtdemux: Send instant-rate-change event if requested in the SEEK event
Handle an instant rate change seek immediately by reflecting
it downstream as an instant-rate-change event, and do no
further seek handling.
2020-04-02 05:23:17 +00:00
Sebastian Dröge
5d0657d4ae matroska-demux: Send instant-rate-change event if requested in the SEEK event
Short-circuit instant rate change events by generating
a downstream instant-rate-change event and doing no further
seek processing.
2020-04-02 05:23:17 +00:00
Seungha Yang
cb8c83e799 matroska: Update for video-hdr struct change
See the change of -base https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/594
2020-04-01 05:19:24 +00:00
Aaron Boxer
3b65663846 rtpbin: make warning messages more meaningful 2020-03-31 15:51:27 -04:00
Nicolas Pernas Maradei
ce0fb9bd29 rtpsession: rename RTCP thread
RTP session starts a new thread for RTCP and names it
"rtpsession-rtcp-thread" which happens to be longer than the maximum 16B
allowed by pthread_setname_np and causes the naming to fail.
See docs for more details.

This commit simply shortens the thread's name so it can actually be set.
2020-03-31 13:34:07 +02:00
Havard Graff
3368ed44a3 rtpjitterbuffer: create specific API for appending buffers, events etc
To avoid specifying a bunch of mystic variables.
2020-03-31 10:02:57 +00:00
Havard Graff
818b38ebdd rtpjitterbuffer: fix waiting timer/queue code
Changing the types from boolean to guint due to the ++ operand used on
them, and only call JBUF_SIGNAL_QUEUE after settling down,
or else you end up signaling the waiting code in chain() for every buffer
pushed out.
2020-03-30 22:32:21 +02:00
Sebastian Dröge
d427b9bddf qtmux: Error out instead of crashing if reserved-max-duration is 0 or no samples could be created in prefill mode 2020-03-27 10:35:04 +00:00
Jan Schmidt
00a08c69ac splitmuxsrc: Fix some deadlock conditions and a crash
When switching the splitmuxsrc state back to NULL quickly, it
can encounter deadlocks shutting down the part readers that
are still starting up, or encounter a crash if the splitmuxsrc
cleaned up the parts before the async callback could run.

Taking the state lock to post async-start / async-done messages can
deadlock if the state change function is trying to shut down the
element, so use some finer grained locks for that.
2020-03-26 14:44:54 -04:00
Seungha Yang
a40eacabb4 splitmuxsink: Split fragment only if queued time is larger than threshold
The queued time includes the duration of the last queued frame
(i.e., new keyframe) so the condition check should not be inclusive.
Note that the new fragment will be cut excluding the last frame
and therefore if the condition is inclusive way,
the fragment might have one frame shorter duration for all keyframe
stream such as jpeg or all-inter video streams.
2020-03-25 13:22:31 +00:00
Seungha Yang
6256fc67e4 splitmuxsink: Don't need to trace next timecode for split decision
Since the commit 94bb76b6b9, splitmuxsink
will split fragments based on queued time and the threshold of that.
So don't need to store the next timecode for split decision.
2020-03-25 13:22:31 +00:00
Seungha Yang
0acd5d9f8b splitmuxsink: Mark some split decision related properties as MUTABLE_READY
The change of various criteria for split decision while muxing is on progress
wouldn't work well as expected.
2020-03-24 22:09:48 +09:00
Seungha Yang
94bb76b6b9 splitmuxsink: Take account queued time and max-size-timecode for split decision
Not only the requested keyframe time, the queued size should be
a criterion for the split decision of timecode based mode
(same as max-size-time based split case).
2020-03-24 22:04:21 +09:00
Xavier Claessens
6e1758d509 Fix usage of C99
It's 2020, way too early for that, let's stick to C89 for now.
2020-03-23 21:32:04 -04:00