Commit graph

87151 commits

Author SHA1 Message Date
Víctor Manuel Jáquez Leal
f42e806480 vapostproc: Don't add video alignment option in buffer pool.
vapostproc will not call gst_buffer_pool_config_set_video_alignment(),
thus this option is not required.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2431>
2021-07-27 09:13:39 +00: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
Matthew Waters
17cb683615 gldownload: use the GstGLSyncMeta in all cases
fixes qmlglsrc ! gldownload ! videoconvert in some cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1232>
2021-07-27 13:30:56 +10: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
dc787434bc Introduce Steinberg ASIO (Audio Streaming Input/Output) plugin
Adds a new plugin for ASIO devices.

Although there is a standard low-level audio API, WASAPI, on Windows,
ASIO is still being broadly used for audio devices which are aiming to
professional use case. In case of such devices, ASIO API might be able
to show better quality and latency performance depending on manufacturer's
driver implementation.

In order to build this plugin, user should provide path to
ASIO SDK as a build option, "asio-sdk-path".

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2309>
2021-07-26 14:58:16 +00:00
Stéphane Cerveau
408a3bfcf2 gitlab: update bug template
Finetune the bug description.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/854>
2021-07-26 13:05:40 +00:00
Zhao, Gang
2936448f1a gsturi: Set GError if uri is invalid
GError should be set if function call failed and the failed reason is
not a programmer error.

Fixed: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1380
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/816>
2021-07-26 11:37:33 +00:00
Zhao, Gang
ed92fb2430 gsturi: Don't treat invalid format of uri as critical error
Normally uri is get from user input and invalid user input should not
be treated as critical error. Moved gst_uri_is_valid outside of
g_return_val_if_fail.

NULL uri is checked inside of gst_uri_is_valid and is correctly
treated as critical error, removed unneeded checks of NULL uri outside
of gst_uri_is_valid function.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/816>
2021-07-26 11:37:33 +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
Seungha Yang
add1f17c57 systemclock: Restore default clock mode to monotonic for non-linux system
Before the MR https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/829
Windows and macOS system clock used monotonic clock regardless of
selected clock mode. And because of clock resolution, we should prefer
monotonic over realtime unless realtime clock is selected explicitly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/855>
2021-07-26 09:20:42 +00:00
Jan Schmidt
9499976fbb splitmuxsink: Fix some reference leaks in error cases.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1023>
2021-07-26 17:56:42 +10:00
Jan Schmidt
b50d3b9c9f splitmuxsink: Prevent hang going back to NULL after failures
Prevent a condition where splitmuxsink won't go back to NULL state
after a child element fails to change state by making sure that
a READY->READY state change doesn't fail, and by returning
GST_FLOW_ERROR or GST_FLOW_FLUSHING upstream to shut down streaming
as quickly as possible.

This can happen after (for example) setting an invalid filename
on the sink element. In that case, the READY->PAUSED transition
fails, but with internal elements still in the NULL state. Trying
to set splitmuxsink back to NULL then ends up trying to bring
those NULL elements up to READY with a READY->READY transition,
(which fails, prevent splitmuxsink from getting to NULL)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1023>
2021-07-26 16:22:23 +10:00
He Junyan
f9d7b708e1 codecs: h264decoder: let print_ref_pic_list_b print the correct list name.
The print_ref_pic_list_b now not only needs to trace the ref_pic_list_b0/1,
but also need to trace the ref_frame_list_0_short_term. We need to pass the
name directly to it rather than an index to refer to ref_pic_list_b0/1.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2425>
2021-07-23 19:52:48 +00:00
He Junyan
eef9067619 codecs: h264dec: Fix a typo in construct_ref_field_pic_lists_b.
The array sort of ref_frame_list_0_short_term has some typo. The
typo makes this list not in the POC ascend order and generate wrong
decoding result for interlaced streams.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2425>
2021-07-23 19:52:48 +00:00
Nicolas Dufresne
f136337970 glcontext: egl: Stop comparing native surface pointer
This was noticed with wayland, sometimes the newly create native
handle can have the same pointer (even though its new). This lead
to unwanted errors or crash.

Fixes #927

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1231>
2021-07-23 13:44:17 -04:00
Nicolas Dufresne
efa6d1c2f8 glwindow: Add "window-handle-changed" signal
This allow other objects to clear any wrapper object that depends
on the previous handle, and properly re-create the new wrappers without
having to resort into doing pointer comparison.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1231>
2021-07-23 13:44:11 -04:00
Nicolas Dufresne
f72b3cf199 Revert "glwindow: wayland: Skip redoing surfaces if window haven't changed"
This reverts commit aba6bd7822.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1231>
2021-07-23 13:40:14 -04:00
Devarsh Thakkar
d2a7b763be kmssink: Fix fallback path for driver not able to scale scenario
When driver return error on update plane request, kmssink
disables the scaling and retries plane update.
While doing so kmssink was matching the source rectangle dimensions
to the target rectangle dimensions which were calculated
as per scaling but this is incorrect, instead what we want here is
that target rectangle dimensions should match the source rectangle
dimensions as scaling is disabled now and so we match result
rectangle dimensions with source rectangle dimensions.

While at it, also match the result rectangle coordinates for
horizontal and vertical offsets with source rectange coordinates,
as since there is no scaling being done so no recentering is
required.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2415>
2021-07-23 14:06:33 +00: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
He Junyan
99636cd101 va: h265dec: Do not assign the frame->output_buffer until output_picture.
We may need to drop the slices such as RASL pictures with the NoRaslOutputFlag, so
the current picture of h265decoder may be freed. We should not assign the frame->
output_buffer too early until we really output it. Or, the later coming slices will
allocate another picture and trigger the assert of:
  gst_video_decoder_allocate_output_frame_with_params:
  assertion 'frame->output_buffer == NULL' failed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2421>
2021-07-23 07:17:06 +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
Guillaume Desmottes
c148ecf2cb appsrc: serialize custom events with buffers flow
Application may want to inject events to the pipeline and keep them
synchronized with the buffers flow.

Fix #247

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1046>
2021-07-22 13:56:22 +02:00
Guillaume Desmottes
0a657d6db5 appsink: add API to catch events
There is currently no way for users to receive incoming events from
appsink while keeping them properly serialized with the buffers flow.
This can be especially useful when application is injecting custom
downstream events into the pipeline and needs to know when they reached
appsink.

Solving this by adding a new signal notifying about new incoming events
and a set of action signals and method to pull those events.
The API is actually pulling the samples and events all together as they
are actually fetched from the same queue.
Having a specific API to pull only events would have the side effect of
discarding samples (and pulling samples would discard events) making
this API not convenient for users.

Partially fix #247

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1046>
2021-07-22 13:56:22 +02:00
Guillaume Desmottes
457e33fee5 appsink: factor out dequeue_object()
No semantic change, will be used to implement new event API.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1046>
2021-07-22 13:53:53 +02:00
He Junyan
0c8d41b8b0 va: H265: Add odd bit depth and chroma depth in get_rtformat.
In H265, the stream may have odd bit depth such as 9 or 11. And
the bit depth of luma and chroma may differ. For example, the
stream with luma depth of 8 and chroma depth of 9 should use the
10 bit rtformat as the decoded picture format.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2420>
2021-07-22 14:18:11 +08:00
Nicolas Dufresne
aba6bd7822 glwindow: wayland: Skip redoing surfaces if window haven't changed
The problem is that EGLNativeWindowSurface and wl_egl_surface are the
same object underneath, so we must recreate both together. As an
optimization, the EGLNativeWindowSurface wrapper is only re-created
if the window_handle changed.

On Mesa, this would cause crash, which will be fixed by:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11979

And will lead to proper errors in the future or on other GL stack. This
issue was encounter using a permanent GstGLDisplay after cycling one of
multiple independent pipelines through NULL state.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1230>
2021-07-21 20:56:23 +00:00
Nicolas Dufresne
e97fda46dc glwindow: wayland: Remove redundant create_surfaces call
The surfaces will be created in _roundtrip_async, so no need to call
this early. This should cause no functional difference.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1230>
2021-07-21 20:56:23 +00:00
He Junyan
130205629f codecs: h264dec: Improve the algorithm for low latency mode.
In low_latency mode, try to bump the picture as soon as possible
without the frames disorder:
1. We can directly output the continuous non-reference frame.
2. Consider max_num_reorder_frames, which is special useful for
   I-P mode.
3. Consider the leading pictures with negative POC.
4  Output small POC pictures when non-reference frame comes.
4. Output the POC increment<=2 pictures. This is not 100% safe,
   but in practice this condition can be used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2373>
2021-07-21 15:23:17 +00:00
He Junyan
573d3f5ba5 codecs: h264dec: Add help function of dpb_set_max_num_reorder_frames.
The max_num_reorder_frames can be useful for bump check. We store it
in the DPB and no need for the decoder now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2373>
2021-07-21 15:23:17 +00:00
He Junyan
be223ad316 codecs: h264dec: Add a flag to record whether picture is reference.
The picture->ref field will change from time to time according to decoder's
state and reference sliding window. We need another flag to record whether
the picture is a reference picture when it is created, and this can help
the bumping check.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2373>
2021-07-21 15:23:17 +00:00
He Junyan
b4e3887449 codecs: h264dec: Change the order of dpb_add and dpb_bump.
The current behavior is different from the SPEC. We should check
and bump the DPB or drain the DPB before we insert the current
picture into it. This may cause the output picture disorder.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2373>
2021-07-21 15:23:17 +00:00
He Junyan
f1df120797 codecs: h264dec: Modify the DPB need bump check.
Accord to spec, we should not add the current picture into the DPB
when we check whether it needs to bump, so the checks of the IDR and
the "memory_management_control_operation equal to 5" are no needed.

And the spec also says that the DPB only needs to bump when there is
no empty frame buffer left(We handle the IDR cases in other places).
We need to follow that and the max_num_reorder_frames is useless.

We also minus 1 in has_empty_frame_buffer because the current frame
has not been added yet.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2373>
2021-07-21 15:23:17 +00:00
He Junyan
4411a4e00f codecs: h264dec: Make dpb_has_empty_frame_buffer a codecs API.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2373>
2021-07-21 15:23:17 +00:00
He Junyan
23b15aa5d0 codecs: h264dec: Set picture to a small poc when mem_mgmt_5.
When current frame memory_management_control_operation equal to 5, that
means we need to drain the dpb and the current picture act as an IDR frame.
So it should have smaller poc than the later pictures to ensure the output
order.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2373>
2021-07-21 15:23:17 +00: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
Seungha Yang
b1b5b2d4cd basesink: Don't swap rstart/rstop when stepping
Step handling is implemented based on unmodified start/stop
segment running time, and basesink takes rate into account for
stepping. This commit is partially undoing new behavior introduced by
the commit of 39b9cc554c when stepping.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/848>
2021-07-20 21:14:32 +09:00