Commit graph

9601 commits

Author SHA1 Message Date
Vivia Nikolaidou af0e30d545 splitmuxsink: Do not hardcode frames_of_daily_jam
Apart from the obvious drawbacks of hardcoding, the drawback here was
that, if we subtracted 2 frames (instead of 2.6) from the target running
time, we'd request the next keyframe a bit too far into the future,
which would make our files split at the wrong position.

https://bugzilla.gnome.org/show_bug.cgi?id=797293
2018-10-16 16:06:47 +03:00
Vivia Nikolaidou 09904e59df qtmux: Allow up to 1% of frame rate for lateness
https://bugzilla.gnome.org/show_bug.cgi?id=797290
2018-10-16 16:05:46 +03:00
Mathieu Duponchelle ee461fb326 rtpfunnel: fix shutdown
By disposing of the ssrc_to_pad map in finalize instead of
dispose.
2018-10-15 14:20:58 +02:00
Havard Graff 53a45b1222 Initial commit of GstRtpFunnel
For funneling together rtp-streams into a single session.
Use-cases include multiplexing and bundle.
2018-10-15 14:20:58 +02:00
Yeongjin Jeong bd6a4aa10d flvdemux: Use aac codec-data to adjust channels if needed
Flv does not support various channels in AAC stream format, for example
flvdemux detect an audio channels of 2(stereo) when the AAC really is 1(mono).

https://bugzilla.gnome.org/show_bug.cgi?id=797275
2018-10-12 14:35:37 -04:00
Yeongjin Jeong 8cae95a22d flvmux: Don't refuse caps changes after starting to write headers in streamable mode.
Flv does support changing the stream type and stream properties
after the headers were started to be written, and for example H264
codec_data changes can be supported.

https://bugzilla.gnome.org/show_bug.cgi?id=797256
2018-10-11 15:35:24 -04:00
Vivia Nikolaidou faee020994 splitmuxsink: Fix if condition in drop-frame timecode wrap-around
Was previously: if ( x | y && a == b). Changed it into if ((x & y) && (a
== b)).
2018-10-11 13:58:34 +03:00
Vivia Nikolaidou 1219712da0 splitmuxsink: Subtract daily jam offset when day wraps around
For drop-frame framerates, when the expected next max timecode wraps
around at the end of the day, we have to subtract the offset of the
daily jam, otherwise we end up with a duration that's a few frames too
long.

https://bugzilla.gnome.org/show_bug.cgi?id=797270
2018-10-11 13:51:08 +03:00
Havard Graff 6c05180dc5 rtpmux: respect downstream "timestamp-offset" in caps.
https://bugzilla.gnome.org/show_bug.cgi?id=795162
2018-10-10 15:39:02 -04:00
Havard Graff 6f37bd8f19 rtpmux: cleanup ssrc-handling code a bit
And add some better logging.

https://bugzilla.gnome.org/show_bug.cgi?id=795162
2018-10-10 15:38:57 -04:00
Havard Graff 18a1dc4ab6 rtpmux: protect against NULL caps
Due to state-changes deactivating the pad from another thread,
this can happen.

https://bugzilla.gnome.org/show_bug.cgi?id=795162
2018-10-10 15:35:31 -04:00
Havard Graff 7cd36d2914 rtpmux: property should overrule both upstream and downstream
https://bugzilla.gnome.org/show_bug.cgi?id=762213

https://bugzilla.gnome.org/show_bug.cgi?id=795162
2018-10-10 15:35:31 -04:00
Peter Körner 4b570026aa splitmuxsink: accept pads named 'sink' on the muxer, handle static pads as well
https://bugzilla.gnome.org/show_bug.cgi?id=797241
2018-10-03 23:24:26 +03:00
Thibault Saunier defae35035 matroskdemux: do not use MapInfo.data after unmapping
And minor gst-indenting
2018-10-03 17:39:33 +02:00
Yacine Bandou 0432826950 matroska: Add the WebM encrypted content support in matroskademux
This commit:

1. Reads the WebM and Matroska ContentEncryption subelements.

2. Creates a GST_PROTECTION event for each ContentEncryption, which
   will be sent before pushing the first source buffer.
   The DRM system id field in this event is set to GST_PROTECTION_UNSPECIFIED_SYSTEM_ID,
   because it isn't specified neither by Matroska nor by the WebM spec.

3. Reads the protection information of encrypted Block/SimpleBlock and
   extracts the IV and the partitioning format (subsamples).

4. Creates the metadata protection for each encrypted Block/SimpleBlock,
   with those informations: KeyID (extracted from ContentEncryption element),
   IV and partitioning format.

5. Adds a new caps for WebM encrypted content named "application/x-webm-enc",
   with the following new fields:

   "encryption-algorithm": The encryption algorithm used.
                           values: "None", "DES", "3DES", "Twofish", "Blowfish", "AES".

   "encoding-scope": The field that describes which Elements have been modified.
                     Values: "frame", "codec-data", "next-content".

   "cipher-mode": The cipher mode used in the encryption.
                  Values: "None", "CTR".

https://bugzilla.gnome.org/show_bug.cgi?id=765275
2018-10-03 16:59:14 +02:00
John Nikolaides 6fe214e7a9 splitmuxsink: Added a split-at-running-time action signal
The video file can now be split at an arbitrary time, given by the user
as an argument to the action signal.

https://bugzilla.gnome.org/show_bug.cgi?id=787922
2018-09-28 16:53:29 +03:00
Tim-Philipp Müller 506e080a15 rtpmp4gdepay: detect broken senders who send AAC with ADTS frames
Strip ADTS headers if we detect any, apparently some Sony cameras
send AAC with ADTS headers. We could also change the stream-format
in the output caps, but that would be unexpected to pipeline builders
and would not exactly be backwards compatible.
2018-09-26 12:25:24 +01:00
Tim-Philipp Müller f255ea99f4 rtpmp4gdepay: factor out pushing of output buffer 2018-09-26 12:20:13 +01:00
Sebastian Dröge d51139ad16 imagefreeze: Allow ANY capsfeatures 2018-09-26 13:30:04 +03:00
Philippe Normand babf4210f0 qtdemux: PIFF track encryption box support
The PIFF track encryption box is a UUID box containing the default encryption
values that should be used for PIFF sample encryption.

https://bugzilla.gnome.org/show_bug.cgi?id=796647
2018-09-25 09:53:31 +01:00
Alicia Boya García bc0ea0dbbb qtdemux: turn impossible condition into an assert
qtdemux_update_streams() is only ever called after checking
`qtdemux->streams_aware` is TRUE. There is no need to check for that
condition again.

`qtdemux->streams_aware` is only modified when the demuxer is
hard-resetted, which is mutually exclusive with demuxing, so it cannot
be modified during the call.

https://bugzilla.gnome.org/show_bug.cgi?id=797191
2018-09-24 08:33:02 +01:00
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