Commit graph

9580 commits

Author SHA1 Message Date
Alicia Boya García 7ceefec714 matroskademux: Emit no-more-pads after parsing Tracks
Currently matroskademux does not emit no-more-pads until the first
Cluster is parsed, even though the Tracks have already been parsed and
from that point on there can be no more tracks.

This is important in MSE because the browser needs to know when the MSE
initialization segment has been completely parsed so that it can expose
the tracks to the user. Some applications depend on this been done
before they feed frames to the demuxer.

As a consequence, historically WebKit has relied on hacks such as
listening to the `pad-added` event, which made impossible to support
multiple tracks in the same file. Let's fix that.

https://bugzilla.gnome.org/show_bug.cgi?id=797187
2018-09-21 17:41:57 -03:00
Alicia Boya García 0e60076a39 matroskademux: Parse successive Tracks elements
This patch allows matroskademux to parse a second Tracks element,
erroring out if the tracks are not compatible (different number, type or
codec) and emitting new caps and tag events should they have changed.

https://bugzilla.gnome.org/show_bug.cgi?id=793333
2018-09-21 17:27:57 -03:00
Alicia Boya García f279bc5336 matroskademux: Refactor track parsing out from adding tracks
This splits gst_matroska_demux_add_stream() into:

* gst_matroska_demux_parse_stream(): will read the Matroska bytestream
  and fill a GstMatroskaTrackContext.

* gst_matroska_demux_parse_tracks(): will check there are no repeated
  tracks.

* gst_matroska_demux_add_stream(): creates and sets up the pad for the
  track.

https://bugzilla.gnome.org/show_bug.cgi?id=793333
2018-09-21 17:27:57 -03:00
Alicia Boya García 9dc7859184 matroskademux: Allow Matroska headers to be read more than once
This is necessary for MSE, where a new MSE initialization segment may be
appended at any point. These MSE initialization segments consist of an
entire WebM file until the first Cluster element (not included). [1]

Note that track definitions are ignored on successive headers, they must
match, but this is not checked by matroskademux (look for
`(!demux->tracks_parsed)` in the code).

Source pads are not altered when the new headers are read.

This patch has been splitted from the original patch from eocanha in [2].

[1] https://www.w3.org/TR/mse-byte-stream-format-webm/
[2] https://bug334082.bugzilla-attachments.gnome.org/attachment.cgi?id=362212

https://bugzilla.gnome.org/show_bug.cgi?id=793333
2018-09-21 17:27:57 -03:00
Mathieu Duponchelle 9605028a71 splitmuxsink: Implement split-after
The behaviour of split-now is to output the current GOP after
starting a new file.

The newly-added split-after signal will output the current GOP
to the old file if possible once a new GOP is opened.

https://bugzilla.gnome.org/show_bug.cgi?id=796982
2018-09-21 16:31:34 +02:00
Seungha Yang 916ad09009 flvmux: Don't leak codec_data buffer
Use gst_buffer_replace() to prevent buffer leak

https://bugzilla.gnome.org/show_bug.cgi?id=797179
2018-09-20 11:35:31 +03:00
Sebastian Dröge c6e07a6eee qtmux: Set Closed Caption track width/height to that of the first video track
Otherwise software like Premiere or Final Cut Pro won't like our files.

https://bugzilla.gnome.org/show_bug.cgi?id=797111
2018-09-20 11:35:31 +03:00
Sebastian Dröge 54a5b3f845 qtmux: Initialize caption track language code to 0 instead of "und"
Without this, Final Cut considers it "non-standard" and 0 (english) is a
good default for closed captions.

https://bugzilla.gnome.org/show_bug.cgi?id=797111
2018-09-18 17:32:46 +03:00
Vivia Nikolaidou 94f8603411 qtmux: Allow up to 1 trak timescale unit of lateness in prefill mode
For 59.94 FPS, it's common to set 60000 as timescale. For that
timescale, if the audio is late by as little as 0:00:00.000016666
(definitely less than one audio sample), lateness gets rounded to 1.
Added a safeguard that allows lateness up to 1 sample with the specific
trak's timescale, to make sure that values less than e.g. one audio
sample won't break the prefill mode. What will happen in this case is
that the audio will get squeezed back to the video's timestamp, which in
practice means that the audio will be 0.000016666 seconds early (with
the patch).

https://bugzilla.gnome.org/show_bug.cgi?id=797133
2018-09-13 13:51:18 +03:00
Tim-Philipp Müller 0d88e3553a wavpackparse: fix handling of correction streams
Accept wavpack correction streams (.wvc) on sink pad, so
that wavpackparse can also be used to packetise correction
streams.

Fix parsing of subblock ID tags - the higher bits are
flags and are not part of the ID. This resulted in
correction blocks not being recognised properly and
the output not having the right (correction) caps.
2018-09-12 01:05:05 +01:00
Seungha Yang 1cd5a5241f flvmux: Don't omit streamheader from caps on downstream reconfigure
The reconfigured downstream elements (e.g., dynamically added sink element)
most likely require the flv streamheader

https://bugzilla.gnome.org/show_bug.cgi?id=797089
2018-09-06 15:52:09 -04:00
Martin Kelly be05515da7 matroskamux: don't store used UIDs
Currently, whenever we generate a 128-bit UID, we store it in a list and
return 0 if we ever encounter a collision. This is so mathematically
improbable that it's not worth checking for, so we can save memory and
time by not tracking the UID. Even if a collision happened, a list of
only 10 UIDs would be unlikely to detect it.

This article has a good description of how improbable a collision is:
https://en.wikipedia.org/wiki/Universally_unique_identifier#Collisions

https://bugzilla.gnome.org/show_bug.cgi?id=797086
2018-09-06 14:14:56 -04:00
Sebastian Dröge d9b52d1f5e qtmux: Use existing helper function to create "und" language code 2018-09-06 20:07:57 +03:00
Alicia Boya García 794dcfbfee qtdemux: Keep sample data from the current fragment only (push mode)
This patch clears the sample table whenever the demuxing of a new
fragment begins. This avoids increasing memory usage for long videos.
This behavior was already present when upstream_format_is_time; this
patch extends it to all push mode operation (e.g. Media Source
Extensions).

https://bugzilla.gnome.org/show_bug.cgi?id=796899
2018-09-03 12:38:17 -03:00
Sebastian Dröge abf2af1a66 deinterlace: Reset frame/tc/caption pointer to NULL after moving it in the history 2018-08-31 14:26:32 +03:00
Edward Hervey 8b4db06733 rtpmp4vpay: Increase ranking
Both rtpmp4vpay and rtpmp4gpay support MPEG4 elementary streams. But
the most supported variant is the video-specific one (rtpmp4vpay),
therefore increase the rank of that one so that auto-plugging of
payloaders for MPEG4 elementary streams ends up picking that one
and not the generic one.
2018-08-29 09:51:42 +02:00
Tim-Philipp Müller 9d6621a30d matroskademux: implement keyframe search also without cluster prev size
If we have cluster prev size (GStreamer muxer will write it by default),
we can go back to the previous cluster efficiently, but if we don't then
just search backwards until we find a cluster ebml identifier, like we
do when searching for clusters in the bisection loop.
2018-08-27 23:01:21 +02:00
Tim-Philipp Müller 2d6efbbae2 matroskademux: make max backtrack distance for keyframe search configurable
Add property instead of hardcoding it in the code.

In some scenarios such as CCTV variable fps and extra long GOPs are
used to minimise storage space, for example. In those cases there might
not be any keyframes for many minutes, so provide a property to override
the max allowed distance.

https://bugzilla.gnome.org/show_bug.cgi?id=790696
2018-08-27 23:01:21 +02:00
Tim-Philipp Müller 2990f0730a matroskademux: set limit how much to backtrack to find a keyframe
If we seek without an index and land on a cluster that starts
with a delta frame.

https://bugzilla.gnome.org/show_bug.cgi?id=790696
2018-08-27 23:01:21 +02:00
Tim-Philipp Müller ffb4533137 matroskademux: no need to search for keyframes for intra-only streams
If the video streams are all I-frame only then we don't need to look
for a cluster with a keyframe, we can just assume there will be one.

https://bugzilla.gnome.org/show_bug.cgi?id=790696
2018-08-27 23:01:21 +02:00
Tim-Philipp Müller 694631520d matroskademux: figure out if we have prev_size when starting up
This is useful to know in case someone initiates a seek or
direction change before we reach the second cluster.
2018-08-27 23:01:21 +02:00
Tim-Philipp Müller 43ce85f794 matroskademux: try to ensure keyframe when seeking without index
When seeking in pull mode without an index (because there is no index
or the file is still being written to) we bisect to find the right
cluster to jump to. However, it's possible the cluster we found doesn't
start with a keyframe, which leads to decoding errors, so if we know
that the found cluster starts with a delta frame try to scan back to
previous clusters until we find one that starts with a keyframe or
we are back at the beginning. Theoretically it's possible that all
clusters but the first one do not start with a keyframe and the
keyframes are in the middle of clusters, but this is extremely
unusual, so we will cover this case with a basic sanity check.

This problem is especially problematic with content recorded with
dynamic GOP and FPS, where long GOP lengths and low FPS may cause a
large set of clusters to lack key frames. Playback would then be
started on a non-keyframe cluster, and the large number of such frames
would make the content impossible to decode fo a long stretch of time.

Based on patch by: Mats Lindestam <matslm@axis.com>

https://bugzilla.gnome.org/show_bug.cgi?id=790696
2018-08-27 23:01:21 +02:00
Tim-Philipp Müller 93ddea2a70 matroskademux: extract cluster prevsize if available
This is useful for reverse playback/trickmodes
without an index, and will also be useful in the
seek handler if we need to scan back to find a cluster
that starts with a keyframe.

https://bugzilla.gnome.org/show_bug.cgi?id=790696
2018-08-27 23:00:53 +02:00
Tim-Philipp Müller fd0afe033b matroska: fix handling of FlagInterlaced
This is an enum not a boolean, and a value of 2 signals
that the video is progressive, but we would mistakenly set
interlace-mode=mixed on the output caps.

https://bugzilla.gnome.org/show_bug.cgi?id=787206
2018-08-23 23:32:06 +02:00
Nicolas Dufresne cf34d51318 udpsrc: Fix build when SO_RCVBUFFORCE is not defined
This shoudl fix the mingw build.
2018-08-17 17:35:43 -04:00
Nicolas Dufresne c61bcb1fd2 udpsrc: Balance Linux value of get/set_rcvbuf
On Linux, the kernel returns twice the size as it will allocate extra
space for accouting. We devides this value by two in order to ensure
that get/set value now match. This fixes the set buffer size validation
and allow having a nice warning when the size if surpassed and the
process does not have CAP_NET_ADMIN capabilities.

https://bugzilla.gnome.org/show_bug.cgi?id=727067
2018-08-17 14:24:25 -04:00
Guillaume Desmottes 9b4a022dee updsrc: set udp buffer size forcibly
The udp buffer size is limited to a maximum of around 100K.
Some apps need to set the force bufsize for their own operation.
Use the SO_RCVBUFFORCE option in order to override the rmem_max limit
of linux kernel. Require user to have the CAP_NET_ADMIN privilege to
work.

Original patch from Kyungnam Bae <kyungnam.bae@lge.com>

https://bugzilla.gnome.org/show_bug.cgi?id=727067
2018-08-17 13:46:42 -04:00
Guillaume Desmottes 58a5f59fe9 udpsrc: factor out gst_udpsrc_get_rcvbuf()
No semantic change.

https://bugzilla.gnome.org/show_bug.cgi?id=727067
2018-08-17 13:46:42 -04:00
Mathieu Duponchelle bfcddb7125 mp4 robust muxing: improve documentation and logging 2018-08-16 19:43:50 +02:00
Jan Alexander Steffens (heftig) 20758215b5 rtph26*pay: Update param set timestamp even if parameters unchanged
rtph264pay and rtph265pay skip updating the parameter set timestamp if
the units they see contain no new configuration. This can result in
them injecting duplicate parameters.

https://bugzilla.gnome.org/show_bug.cgi?id=796748
2018-08-16 16:49:16 +03:00
Ulf Olsson 0f6a4e7c98 rtspsrc: Add support for SET_PARAMETER and GET_PARAMETER using signals
https://bugzilla.gnome.org/show_bug.cgi?id=792131
2018-08-16 09:03:42 +03:00
Jan Schmidt 5da08a21c6 splitmuxsink: Don't leak old muxer/sink in async mode
Make sure to clear the reference taken earlier in the function
when switching muxer/sink asynchronously so they don't leak
2018-08-15 02:28:20 +10:00
Jan Schmidt f8076e208b splitmuxsink: Fix reference counting loop
The stream context was holding a reference to the
internal queue and pads, with pad probes that were
in turn holding references to the stream context.

This lead to a leak if the request pads weren't explicitly
released.

https://bugzilla.gnome.org/show_bug.cgi?id=796893
2018-08-15 02:12:53 +10:00
Roland Jon 7fe18db041 aacparse: fix codec_data buffer leak
https://bugzilla.gnome.org/show_bug.cgi?id=740101
2018-08-13 00:05:59 +01:00
Sebastian Dröge 5e4f215bfb qtdemux: Handle closed captions as subtitle streams 2018-08-02 16:13:26 +03:00
Sebastian Dröge 7a354d0507 qtmux: The sample size we have to reserve is 256+8 bytes for the header for CDP packets 2018-08-02 13:40:09 +03:00
Sebastian Dröge 8a3075fbae qtmux: Properly allocate 256 bytes per CDP packet in prefill mode
Instead of allowing 256 but only pre-allocating 100.
2018-08-02 12:27:45 +03:00
Sebastian Dröge bbfd76e94e Revert "qtmux: Allow for CDP packets up to 320 bytes"
This reverts commit 5eed1d49bd.

255 is actually the maximum, there's a bug if more is arriving.
2018-08-02 12:27:17 +03:00
Sebastian Dröge 5eed1d49bd qtmux: Allow for CDP packets up to 320 bytes
Apparently they can be bigger than 256 bytes sometimes.
2018-08-01 16:51:11 +03:00
Nicolas Dufresne 2b11c62571 rtppayload: Fix VP8/VP9/OPUS dual encoding name handling
All these were copy pasted and would lead to assertion when chained with
rtpmux. This commit rewrite the negotiation with downstream. This also
drop the fallback to ancient names if the pad is unlinked. This was
completly arbitrary decision that made no sense.

https://bugzilla.gnome.org/show_bug.cgi?id=796809
2018-08-01 09:42:36 -04:00
Sebastian Dröge 7679412b69 qtdemux: Don't assert in prefill mode if a track has no samples at all
Just write it with a duration of 0, no samples, etc.
2018-07-31 12:47:47 +03:00
Sebastian Dröge 6ce2a5f7bf qtdemux: Don't assert if a file does not have any active streams
** (gst-play-1.0:9113): CRITICAL **: 12:31:54.360: qtdemux_is_streams_update: assertion 'qtdemux->active_streams != NULL' failed
2018-07-31 12:33:54 +03:00
Sebastian Dröge e58dceec3a qtmux: Reserve 256 bytes for CDP packets in pre-fill mode
92 is sometimes too small and compared to the wasted space for other
codecs 256 bytes is small (and should be the maximum CDP packet size)
2018-07-30 13:35:02 +03:00
Nirbheek Chauhan 8f807477eb meson: Add feature options for all plugins
Checks for GL, Qt5, and C++ are still automagic. FIXMEs have been
added for these so they can be fixed later.

https://bugzilla.gnome.org/show_bug.cgi?id=795107
2018-07-27 18:42:54 +05:30
Vivia Nikolaidou f2c2560db2 deinterlace: Closed caption pass-through
Pass through closed caption data when deinterlacing. When two
deinterlaced frames are created for the same interlaced frame (e.g.
fields=all), the second of the two frames will have no closed caption
data.

Also fixed memory leaks related to timecode meta pass-through.

https://bugzilla.gnome.org/show_bug.cgi?id=796876
2018-07-27 14:26:49 +03:00
Olivier Crête 6c478453a8 qtmux: Implement muxing of AV1 into MP4 files
According to
https://aomediacodec.github.io/av1-isobmff/
2018-07-26 14:14:53 -04:00
Olivier Crête d641b37fcb matroskamux: Put codec_data as CodecPrivate for AV1 2018-07-26 14:14:53 -04:00
Olivier Crête e3b14e345d matroskamux: Accept muxing AV1 2018-07-26 14:14:53 -04:00
Olivier Crête e07ce9afb4 qtdemux: Recognize more AV1 atoms 2018-07-26 14:14:53 -04:00
Olivier Crête 415caf4b87 matroskademux: Extract codec_data for AV1
According to
https://github.com/Matroska-Org/matroska-specification/blob/av1-mappin/codec/av1.md
2018-07-26 14:14:53 -04:00