Commit graph

7967 commits

Author SHA1 Message Date
Nicolas Dufresne
03041842de debugutils: Only proxy the properties once
The needed once call was removed accidently during porting. This was catch by
the CI as memory leaks.

Related to !2426

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2438>
2021-07-27 13:22:35 -04:00
Edward Hervey
b3504a0192 mxf: Handle D10 "picture only" variant
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/80

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2436>
2021-07-27 12:18:31 +02:00
Edward Hervey
837d880e2f mxfvc3: Also accept clip-wrapped vc-3
We can now handle this fine

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2434>
2021-07-27 09:37:49 +02:00
Edward Hervey
14d1235288 mxfdemux: Handle EOS with non-frame wrapping
When reaching the end of non-frame wrapping track in pull mode, we want to force
the switch to the next non-eos pad. This is similar to when we exceed the
maximum drift.

Fixes issues on EOS where not everything would be drained out and stray errors
would pop out.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2434>
2021-07-27 08:55:22 +02:00
Edward Hervey
b62e942718 mxfdemux: More granular interleaved content handling
An interleave of 500ms can be way too big for some downstream queueing
elements. Instead use a smaller 100ms interleave and silence the various
warnings about resyncing (it's normal)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2434>
2021-07-27 08:55:22 +02:00
Philippe Normand
a4aa2af291 debugutils: De-duplicate proxy_properties function to a new utils module
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2426>
2021-07-26 15:36:48 +00:00
Seungha Yang
4d1101d335 audiolatency: Expose samplesperbuffer property
... for user to be able to set the number of required samples.
For instance, our default value is 240 samples
(about 5ms latency in case that sample rate is 48000), which might
be larger than actual buffer size of audio capture device.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2307>
2021-07-26 20:13:03 +09:00
He Junyan
e9d0d19f61 videoparsers: vp9: Need to process the first frame even not key.
Some cut VP9 streams begin with a non key frame. The current code
just bail out the parse_process_frame() if not a key frame. Because
of this, we do not set the valid caps before we push the data of the
first frame(even this first frame will be discarded by the downstream
decoder because it is not a key frame).

The pipeline such as:
gst-launch-1.0 filesrc location=some.ivf ! ivfparse ! vp9parse !
  vavp9dec ! fakesink
will get a negotiation error and the pipeline can not continue. The
correct behaviour should be: the decoder discard the first frame and
continue to decode later frames successfully.

So, when the parse does not have valid stream info(should be the first
frame case), we should continue and report caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2427>
2021-07-23 13:33:24 +00:00
Nirbheek Chauhan
0bde6bf750 audiolatency: Handle audio buffers with invalid duration
pipewiresrc outputs audio buffers without a valid duration, so we need
to calculate it manually in that case.

Upstream issue: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1438

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2419>
2021-07-23 12:19:33 +00:00
Edward Hervey
a79a756b79 tsdemux: Handle PCR-less streams
Some programs specify a PCR PID but don't actually store any PCR values, or are
way too far apart.

In order to gracefully handle those situations, we will queue up to a certain
amount of pending buffers before deciding to give up on that PCR PID and not use
any (i.e. using DTS/PTS values as-is)

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1629

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2422>
2021-07-22 15:22:13 +02:00
Edward Hervey
7a6bc987a5 mxfdemux: Make gst-indent on the CI happy
grmbl

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>
2021-07-21 14:33:19 +00:00
Edward Hervey
726ea62d25 mxfdemux: Handle non-frame wrapping
* If we have an index table for non-framed essence, we can handle it

* The demuxer has a state which indicates whether it will next fetch a KLV or
data contained *within* a KLV.

* The position on Essence Tracks always correspond to the next entry to fetch,
demuxer offset will be skipped accordingly whenever we switch between
partitions (in case of resyncs). A copy of the main clip/custom KLV for that
partition is kept to track the position within the essence of that partition.

* For clip/custom-wrapped raw audio, if the edit rate is too small (and would
cause plenty of tiny buffers to be outputted), specify a minimum number of edit
units per buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>
2021-07-21 14:33:19 +00:00
Edward Hervey
38ec61c586 mxfdemux: Use KLV for position/content tracking
* For pull-based, this avoids pulling content if it's not needed (ex: skipping filler
packet, not downloading the content if we only need to know if/where an essence
packet is, etc...). Allows reducing i/o usage to the minimum.

* This also allows doing sub-klv position tracking, and opens the way for
non-frame-wrapping handling

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>
2021-07-21 14:33:19 +00:00
Edward Hervey
40d3690054 mxfdemux: Output the topology of the file in debug logs
This provides a summary of the number/type of tracks in the Material and File
Packages

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>
2021-07-21 14:33:19 +00:00
Edward Hervey
3303e0ebd2 mxfdemux: Refactor pull seek
In order to figure out the exact start position (backed by a keyframe) accross
all tracks, we first figure out the backing keyframe position, and *then* seek
to that position.

Avoids ending up in situations where we would properly seek to the backing
keyframe on video ... but not on the audio streams (they would have been set to
the original non-keyframe position). Fixes key-unit seeking.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>
2021-07-21 14:33:19 +00:00
Edward Hervey
8817b08d5e mxfaes-bwf: Handle new custom-constant-sized variant
Defined by Amendment 2:2013 to SMPTE ST 382:2007

Also define a new "UNKNOWN" wrapping type to make the difference with known
wrapping types

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>
2021-07-21 14:33:19 +00:00
Edward Hervey
f502ef9053 mxfmpeg: Fix essence coding detection
The picture essence coding matching was wrong. Use the proper "base" MXFUL for
video mpeg compression for matching.

Also handle the case where some old files would put the essence container label
in the essence coding field

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>
2021-07-21 14:33:19 +00:00
Edward Hervey
ac483b2384 mxfdemux: Refactor index table and offset handling
* Streamline offset <=> entry handling. Historically the demuxer didn't support
information from index tables and stored the discovered information in an array
per track. When index table support was added, a parallel system was setup for
that relationship. This commit unifies this into one system with the
`find_edit_entry()` and `find_entry_for_offset()` functions.

* By extension, per-track offset entry tables are only created/used if no index
table is present for those tracks.

* Use index table information as-is. The index table system from MXF is quite
complex and there are various ways to use the information contained
within. Instead of converting that information we store the data from the tables
as-is and extract the needed information when needed.

* Handle index tables without entries (i.e. all content package units are of the
same size).

* Allow collecting index table segments as we go instead of only once if a
random-index-pack is present. This also improves support of some files in
push-mode.

* When searching for keyframe entries, use the keyframe_offset if
present (speeds up searching).

* For interleaved content (i.e. several tracks in the sample essence container),
we use a system to be able to identify the position of each track in the delta
entries of index tables.

* Handle temporal offset only on tracks which *do* need it (as specified in the
delta entries of the index tables). If present, those offsets are stored in a
pre-processed table which allows computing PTS from DTS with a simple offset.

* Add a quirk for files which are known to be have wrongly stored temporal
offsets.

* Overall opens the way to handle more types of MXF files, especially those with
non-frame-wrapping.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>
2021-07-21 14:33:19 +00:00
Edward Hervey
c24d48765d mxfdemux: Drop duplicate seek events
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>
2021-07-21 14:33:19 +00:00
Edward Hervey
a68198c405 mxf: Improve index entry debug log
By printing out the various known flag values

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>
2021-07-21 14:33:19 +00:00
Edward Hervey
11d9abd2d5 mxf: Demote error message when resolving valid empty reference
A Source Clip can have zero'd SourcePackageID and SourceTrackID, this indicates
it terminates the source reference chain

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>
2021-07-21 14:33:19 +00:00
Edward Hervey
dfee771afd mxfdemux: Handle temporal reordering shift
This is similar to how the same issue was handled in qtdemux.

In order for the "DTS <= PTS" constraint to be respected, we calculate the
maximum temporal reordering that can happen (via index tables).

If there is a non-0 temporal reordering, we:
* Shift all outgoing PTS by that amount
* Shift segment for that stream by that amount
* Don't modify DTS (i.e. they might end up having negative running-time, before
the start of the segment)

Also ensure all entries have a valid PTS set, previously this wouldn't be set
for entries with a temporal offset of 0.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/584

(and maybe a lot of other issues)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>
2021-07-21 14:33:19 +00:00
Jan Schmidt
30e105561d mpegtsmux: Quieten "missed PCR" warnings in VBR mode.
When the muxer is operating in VBR mode, it's kind of expected
for now that we might not put the PCR in exactly the right place,
because the muxer doesn't schedule packets that way. In that case
don't warn constantly about the PCR ending up a few ms off target.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2295>
2021-07-15 04:46:03 +00:00
Matthew Waters
fdca97eca8 rtmp2src: workaround a GLib race when destroying a GMainContext/GSource
https://gitlab.gnome.org/GNOME/glib/-/issues/803

Basically, if destruction of a GSource and its associated GMainContext are
not synchronised, Then the GSource destruction can access freed
GMainContext resources and cause a crash.  This is not super common but
can happen.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2405>
2021-07-15 14:10:04 +10:00
Seungha Yang
cd50b02bc9 vp9parse: Skip parsing decode-only frame
Decode-only frame (i.e., show_existing_frame == 1) doesn't hold
any valid information apart from the index of frame to be duplicated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2408>
2021-07-14 14:32:57 +00:00
Jan Alexander Steffens (heftig)
f50089ec63 interlace: Push the reconfigure event in the right direction
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2361>
2021-07-06 07:41:03 +00:00
Edward Hervey
49b061241e mxfdemux: Check validity of interleaved File Package
As specified by the S377 MXF core specification, if a file package has
interleaved content, then all tracks must be using the same Edit Rate

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2378>
2021-07-05 07:07:15 +00:00
He Junyan
8ba730a564 h265parse: Add special profile case for profile_idc 0.
This is a work-around to identify some main profile streams having
wrong profile_idc. There are some wrongly encoded main profile streams
which doesn't have any of the profile_idc values mentioned in Annex-A,
instead, general_profile_idc has been set as zero and the
general_profile_compatibility_flag[general_profile_idc] is TRUE.
Assuming them as MAIN profile for now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2322>
2021-07-02 10:27:41 +00:00
He Junyan
42a861fe59 h265parse: Map -intra profiles to non-intra compatible profiles.
All the -intra profiles can map to non-intra profiles as compatible
profiles, except the monochrome case for main and main-10.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2322>
2021-07-02 10:27:41 +00:00
Edward Hervey
162e7bd28b mxfvanc: Handle empty ANC essence
Not having any *actual* ANC is totally fine and common usage with several MXF
variants.

In order to properly advance the streams, the essence handler returns an empty
GAP buffer which gets converted to a GST_EVENT_GAP.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2345>
2021-07-01 11:04:03 +02:00
Sebastian Dröge
1d4ecd0bde avwait: Don't consider it a segment change if the segment is the same except for the position
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2319>
2021-06-23 16:03:38 +00:00
Sebastian Dröge
52a0c36598 tsmux: When selecting random PIDs, name the pads according to those PIDs
Some elements will make use of the automatically generated names to
create new pads in future muxer instances, for example splitmuxsink.

Previously we would've created a pad with a random pid that would become
"sink_0", and then on a new muxer instance a pad "sink_0" and tsmux
would've then failed because 0 is not a valid PID.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2318>
2021-06-23 14:59:43 +00:00
Sebastian Dröge
127ade39cf tsmux: Recheck existing pad PIDs when requesting a new pad with a random pid
Previously pads might have been requested already (e.g. in NULL state),
then reset was called (e.g. because changing state) and then a new pad
was requested. Resetting is re-creating the internal muxer object and as
such resetting the pid counter, so the next requested pad would get the
same pid as the first requested pad which then leads to collisions.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2317>
2021-06-23 05:44:48 +00:00
Seungha Yang
058957fc22 h264parse,h265parse: Push parameter set NAL units again per segment-done
Some decoder implementations might drain out internal buffers and
reset its status on segment-done event. So, in case that
upstream stream-format is packetized but downstream supports only
byte-format, required codec-data might not be forwarded toward
downstream if such parameter set NAL units don't exist in inband
bitstream. Therefore, parse elements should re-send parameter set NAL
units like the case of flush event.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2334>
2021-06-16 18:00:39 +00:00
He Junyan
7feed2f1ac h265parse: Fix a typo in get_compatible_profile_caps().
The GST_H265_PROFILE_MAIN_444_10 profile should be compatible with
GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444_10, not the current
GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_10.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2328>
2021-06-16 13:23:50 +00:00
Nicolas Dufresne
4ac9f91921 alphadecodebin: Fix stall due to QoS
alphacombine element is a simple element that assumes buffers are always
paired, or at least that missing buffers are signalled with a GAP. The QoS
implementation in the GstVideoDecoder base class allow decoders dropping
frames independently and that could lead to stall in alphacombine.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2326>
2021-06-14 16:33:15 -04:00
Stéphane Cerveau
a71ec17cf0 jpeg2000parse, openjpeg: add support for YCrCb 4:1:1 sampling
Add YCrCb 4:1:1 support in openjpeg elements
and fix in jpeg2000parse the YCrCb 4:1:0 support

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2321>
2021-06-14 11:05:45 +02:00
Nicolas Dufresne
a6ebda3907 debugutils: Introduce videocodectestsink
This is a video specific sink used to test video CODEC conformance. This is similar
to a combination of filesink and testsink, but will skip over any type of
padding that GStreamer Video library introduces. This is needed in order to obtain the
correct checksum or raw yuv data.

This element currently support writing back non-padded raw I420 through the
location property and will calculate an MD5 and post it as an element message
of type conformance/checksum. More output format or checksum type could be
added in the future as needed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2287>
2021-06-07 17:11:32 -04:00
Edward Hervey
80b3ba7b36 tsdemux: Clear all streams when rewinding
This avoids sending out partial invalid data downstream which could cause
decoders (ex: `dvdlpmdec`) to error out.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2301>
2021-06-03 22:54:12 +00:00
Daniel Almeida
ad70e0d5e8 codecalpha: alphacombine: add support for NV12/AV12
Alpha combine works by appending the GstMemory for the alpha channel
to the GstBuffer containing I420, thereby pushing A420 on its src pad.

Add support for the same workflow for NV12, thereby producing the
recently introduced AV12 format (NV12 + Alpha).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2277>
2021-05-27 11:03:41 -04:00
Seungha Yang
ad65081ef9 interlace: Don't set field-order field for progressive caps
That would cause negotiation issue

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2282>
2021-05-27 08:15:15 +00:00
Seungha Yang
1ac30ad53f interlace: Drop framerate from query caps of sinkpad
Query caps should return caps which represent the element can accept,
not resulting format.

Fixing negotiation error with
gst-launch-1.0 videotestsrc ! video/x-raw,framerate=25/1 ! interlace field-pattern=0 ! fakesink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2282>
2021-05-27 08:15:15 +00:00
Tim-Philipp Müller
8e04651b8b Use gst_buffer_new_memdup()
Update for function rename in core.

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/827

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2281>
2021-05-24 19:05:27 +01:00
Tim-Philipp Müller
0151276d7f Use new gst_buffer_new_copy()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2279>
2021-05-23 17:20:16 +01:00
Jan Alexander Steffens (heftig)
0312887452 mpegtsmux: Fixup program array indices after stream removal
Each stream stores the `program_array_index` of its position in its
program's `streams` array. When we remove a stream from this array, we
need to correct the `program_array_index` of all streams that were
backshifted by the removal.

Also extract the removal into a new function and add some more safety
checks.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2266>
2021-05-20 13:35:06 +00:00
Seungha Yang
1f743c8d84 audiolatency: Drop incoming downstream stick events
stream-start, caps, and segment events will be pushed by internal
audiotestsrc element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2265>
2021-05-20 15:50:55 +09:00
Seungha Yang
3bd600741c audiolatency: Use live mode audiotestsrc
Expected use case of audiolatency element is that mimic audio capture
device which is most likely live source. So audiolatency element
should use live mode as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2265>
2021-05-20 15:41:50 +09:00
Seungha Yang
5c4a13b5a0 interlace: Fix too small buffer size error
Even though input/output resolutions are identical there, default
buffer size of progressive and interleaved formats could be different
because we are rounding up height of all plane of interlaced frame
to be multiple of two.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2244>
2021-05-17 08:49:30 +00:00
Nicolas Dufresne
e7b962d9b5 alphacombine: Ignore all events coming from the alpha_pad
As per usage of this element, everything from this pad is a
duplicate. Instead of implemented needless aggregation, simply
drop all events from this pad and let the one from the main stream
passthrough. Also stop proxying some queries from the alpha pad_too.

This fixes racy test failure:
- validate.file.playback.scrub_forward_seeking.opus_vp9-alpha_webm

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2247>
2021-05-14 14:11:39 -04:00
Nicolas Dufresne
0484d658a8 codecalphademux: Do not set a GstFlowReturn from a boolean
This was a small overlook, gst_pad_send_event() returns a boolean,
so setting it into ret could confuse the flow combiner. Though,
it didn't bug, since both 0 and 1 are success (though 1 being
undefined).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2247>
2021-05-14 14:11:39 -04:00