Commit graph

27059 commits

Author SHA1 Message Date
Stéphane Cerveau
176a00985a mpegpsdemux: fix accurate seek
In an accurate seek, the segment start should be
the same as the one requested in the seek.
The start should be kept as the one from the
segment if its inferior.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2048>
2021-03-22 12:54:14 +01:00
Stéphane Cerveau
497e88ae88 mpegpsdemux: Keep seqnum events
Keep the same seqnum of the new segment events for each
of the streams.
Keep the segment to send the EOS event.
Keep the seek seqnum for segment and flush event.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2048>
2021-03-22 12:54:14 +01:00
Stéphane Cerveau
96467f581e mpegpsdemux: avoid early EOS
In a case of a scr different from 0, after a seek,
the src_segment.stop has been updated with the duration
not including the base_time (scr). The segment position
needs to be tested upon segment.stop + base_time (scr)
to check for an EOS.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2048>
2021-03-22 12:54:14 +01:00
Víctor Manuel Jáquez Leal
32fa99d3e0 va: postproc: disable passthrough as soon as possible
After the VA filter creation, when changing the element's state from NULL
to READY, immediatly checks for any filter operation requested by the user.
If any, the passthrough mode is disabled early, so there's no need for a
future renegotiation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2094>
2021-03-22 09:34:15 +01:00
Víctor Manuel Jáquez Leal
594c1450da va: postproc: rename function to gst_va_vpp_update_passthrough
Since it's widely used, a proper name will reflect its importance.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2094>
2021-03-22 09:33:58 +01:00
Matthew Waters
640a65bf96 gst: don't use volatile to mean atomic
volatile is not sufficient to provide atomic guarantees and real atomics
should be used instead.  GCC 11 has started warning about using volatile
with atomic operations.

https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

Discovered in https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/868

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2098>
2021-03-22 14:34:36 +11:00
Seungha Yang
e22befad2e mfvideoenc: Enable Direct3D multi-thread protection
As documented by MS. See also
https://docs.microsoft.com/en-us/windows/win32/medfound/supporting-direct3d-11-video-decoding-in-media-foundation#open-a-device-handle

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2095>
2021-03-20 17:54:04 +09:00
Seungha Yang
824b0ce0f4 Revert "d3d11: Enable native multi-thread protection layer and make use of it"
This reverts commit 872b7f503c.

Native multi-thread protection layer seems to be consuming more CPU
resource than application side protection approach in some cases

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2095>
2021-03-20 17:53:58 +09:00
Matthew Waters
e463bcfadf tests/webrtc: check for more sdp things across the board
e.g.

- test for a=setup:$val and direction attributes in all tests
- test number of media sections
- test number of formats in each m= section (for audio/video)
- test no duplicate formats

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2093>
2021-03-19 18:02:21 +11:00
Julien
e9f5d94c93 gs: add source and sink for Google Cloud Storage
Useful when having a service that runs a GStreamer pipeline
or application in Google Cloud to avoid storing the inputs
and outputs in the running container or service. For example
when analyzing a video from a Google Cloud Storage bucket
and extracting images or converting the video and then uploading
the results into another Google Cloud Storage bucket.

- gssrc allows to read from a file located in Google Cloud
Storage and it supports seeking.
- gssink allows to write to a file located in Google Cloud
Storage. There are 2 modes, one similar to multifilesink and
the other similar to filesink.

Example:
  gst-launch-1.0 gssrc location=gs://mybucket/videos/sample.mp4 ! decodebin ! glimagesink
  gst-launch-1.0 playbin uri=gs://mybucket/videos/sample.mp4
  gst-launch-1.0 videotestsrc num-buffers=5 ! pngenc ! gssink object-name="img/img%05d.png" bucket-name="mybucket" next-file=buffer
  gst-launch-1.0 filesrc location=sample.mp4 ! gssink object-name="videos/video.mp4" bucket-name="mybucket" next-file=none

When running locally simply set GOOGLE_APPLICATION_CREDENTIALS. But
when running in Google Cloud Run or Google Cloud Engine, just set the
"service-account-email" property on each element.

Closes #1264

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1369>
2021-03-18 22:32:48 +00:00
Seungha Yang
872b7f503c d3d11: Enable native multi-thread protection layer and make use of it
... instead of our own GRecMutex locking. In this way, any other
Direct3D11 client (MediaFoundation for example) can safely call
any Direct3D11 API even when we are sharing our Direct3D11 device
with others.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2092>
2021-03-18 16:37:37 +00:00
Jan Schmidt
0d36dcab4e examples: Add an mpegtsmux example of prog-map usage.
Add an example of how to construct the prog-map structure for
the MPEG-TS muxers and assign streams to programs, and set PCR
and PMT PIDs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2039>
2021-03-18 15:07:53 +00:00
Jan Schmidt
18a095ca63 mpegtsmux: Add PMT_%d support to prog-map.
Support a PMT_%d field in the prog-map, that's optionally used
to set the PMT for each program in the mux.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2039>
2021-03-18 15:07:53 +00:00
Jan Schmidt
5e4a11bf36 mpegtsmux: Don't write PCR until PAT/PMT are output.
Make sure streams start cleanly with a PAT/PMT and defer the first PCR
output until after that.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2073>
2021-03-18 13:57:27 +00:00
Mathieu Duponchelle
b7e9e606a9 tsmux: finalize PCR timing for complete accuracy
In order to always insert a PCR packet right on time, we need to
check whether one is needed when outputting any packet, not only
a packet for the PCR stream. Most of the PCR packets will remain
data-carrying packets, but as a last resort we may insert stuffing
packets on the PCR stream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2073>
2021-03-18 13:57:27 +00:00
Jan Schmidt
3201575d2a mpegtsmux: Improve PCR/SI scheduling.
Change PCR / SI scheduling so that instead of checking if
the current PCR is larger than the next target time, instead
check if the PCR of the next packet would be too late, so PCR
and SI are always scheduled earlier than the target, not later.

There are still cases where PCR can be written too late though,
because we don't check before each output packet.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2073>
2021-03-18 13:57:27 +00:00
Jan Schmidt
49c61338d6 tsmuxstream: Fix comment typo
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2073>
2021-03-18 13:57:27 +00:00
Mathieu Duponchelle
08442cc792 cccombiner: implement scheduling
Prior to that, cccombiner's behaviour was essentially that of
a funnel: it strictly looked at input timestamps to associate
together video and caption buffers.

This patch instead exposes a "schedule" property, with a default
of TRUE, to control whether caption buffers should be smoothly
scheduled, in order to have exactly one per output video buffer.

This can involve rewriting input captions, for example when the
input is CDP sequence counters are rewritten, time codes are dropped
and potentially re-injected if the input video frame had a time code
meta.

Caption buffers may also get split up in order to assign captions to
the correct field when the input is interlaced.

This can also imply that the input will drift from synchronization,
when there isn't enough padding in the input stream to catch up. In
that case the element will start dropping old caption buffers once
the number of buffers in its internal queue reaches a certain limit
(configurable).

The property is exposed so that existing users of cccombiner can
revert back to the original behaviour, but should eventually be
removed, as that behaviour was simply inadequate.

This commit also disallows changing the input caption type, as
this would needlessly complicate implementation, and removes
the corresponding test.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2076>
2021-03-17 22:00:25 +00:00
Seungha Yang
80792e12d4 d3d11: Use render-target and shader-resource bind flags by default
Even if bind flags is not needed by an element, other element
might need such bind flags.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2091>
2021-03-17 22:17:22 +09:00
He Junyan
805ff6346a va: vpp: Fix features lost in transform_caps().
When we transform the caps from the sink to src, or vice versa, the
"caps" passed to us may only contain parts of the features. Which
makes our vpp lose some feature in caps and get a negotiation error.
The correct way should be:
Cleaning the format and resolution of that caps, but adding all VA,
DMA features to it, making it a full feature caps. Then, clipping it
with the pad template.

fixes: #1551

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2081>
2021-03-17 10:25:11 +01:00
Thibault Saunier
8a0224a198 wpe: Ignore 'error-cancelled' 'failures'
This happens when the user use the 'load-bytes' signal and nothing is wrong there

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2085>
2021-03-16 13:06:22 +00:00
Seungha Yang
3f08fcb4ff d3d11decoder: WARNING if ID3D11VideoDevice is unavailable, not ERROR
gst_d3d11_decoder_new() method is also used for device capability
checking during plugin init. Although we are checking hardware
flag prior to that, it doesn't guarantee ID3D11VideoDevice interface.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2088>
2021-03-16 12:39:23 +00:00
Seungha Yang
1d6cdbdc90 mediafoundation: Fix resource leak
IMFActivate would hold its internal objects unless user call ShutdownObject(),
even if we release the IMFActivate. Here internal objects may
include Direct3D objects, such as texture, device handle for example.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2087>
2021-03-16 09:47:41 +00:00
Seungha Yang
58e451325b d3d11colorconvert: Fix caps leak
GstBaseTransform::fixate_caps() takes ownership of passed
othercaps argument.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2086>
2021-03-16 08:39:46 +00:00
Víctor Manuel Jáquez Leal
2b37910631 va: example: multiple-vpp: test sharpen with dynamic controller
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2082>
2021-03-16 06:30:06 +00:00
Víctor Manuel Jáquez Leal
191b6cf5d4 va: postproc: synchronize segment with stream time
This is required to use dynamic controllable parameters.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2082>
2021-03-16 06:30:06 +00:00
Seungha Yang
309a940614 d3d11decoder: Do negotiation again per forward/reverse playback mode change
For reverse playback, we are always copying decoded
frame to downstream buffer. So the pool size can be
and need to be large enough.

In case that forward playback, however, we need to restrict
the max pool size for performance reason. Otherwise decoder
will keep copying decoded texture to downstream buffer pool
if decoding is faster than downstream throughput
performance and also there are queue element between them.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2083>
2021-03-16 05:54:41 +00:00
Seungha Yang
3a99517f7c d3d11videosink: Avoid switching conversion tool during playback
Decoder might be able to copy decoded texture to the other buffer pool
during playback depending on context. In that case, copied one
has no D3D11_BIND_DECODER bind flag.

If we used ID3D11VideoProcessor previously for decoder texture,
and incoming texture supports ID3D11VideoProcessor as well even if it has no
D3D11_BIND_DECODER flag (having D3D11_BIND_RENDER_TARGET for example),
allow zero-copying instead of using our fallback texture.

Frequent conversion tool change (between ID3D11VideoProcessor and generic shader)
might result in inconsistent image quality.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2084>
2021-03-15 21:00:22 +09:00
Víctor Manuel Jáquez Leal
c74b230579 va: postproc: only drop filters if they change
Currently, at every frame the filters array is recreated. This is not
optimal, since it should be only rebuilt if the VA filter's related
properties change. This patches does that by using a flag.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2078>
2021-03-15 06:10:27 +00:00
Seungha Yang
72345875b1 d3d11decoder: Refactor device open step and negotiation
* Remove redundant method arguments
* Don't allocate staging texture if downstream supports d3d11 memory

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2079>
2021-03-14 17:34:20 +09:00
Seungha Yang
347d9ceb4e d3d11decoder: Move profile GUID handling into decoder object
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2079>
2021-03-14 16:31:31 +09:00
Seungha Yang
1c1cfc4ba7 d3d11decoder: Get rid of private struct
Completely hide member variables

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2079>
2021-03-14 16:30:19 +09:00
Seungha Yang
78e4251750 Revert "d3d11vp9dec: Add support for internal frame resizing"
This reverts commit 58a4c33a0e

We should use ID3D11VideoProcessor instead of shader
to avoid copy. We need to revisit this topic later

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2079>
2021-03-14 16:30:15 +09:00
Seungha Yang
615f52f2f7 d3d11device: Hold ID3D11VideoDevice and ID3D11VideoContext object
... instead of QueryInterface-ing per elements. Note that
ID3D11VideoDevice and ID3D11VideoContext objects might not be available
if device doesn't support video interface.
So GstD3D11Device object will create those objects only when requested.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2079>
2021-03-14 14:44:55 +09:00
Seungha Yang
b08310f748 d3d11: Run gst-indent for all C++ code
Since all d3d11 plugin implementation code are C++, we need to
run gst-indent manually. This is preparation for later
"gst-indent sys/d3d11/*.cpp" run.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2077>
2021-03-14 13:40:12 +09:00
Seungha Yang
5b3e316039 d3d11: Port to C++
Direct3D11 objects are COM, and most COM C APIs are verbose
(C++ is a little better). So, by using C++ APIs, we can make code
shorter and more readable.
Moreover, "ComPtr" helper class (which is C++ only) can be
utilized, that is very helpful for avoiding error-prone COM refcounting
issue/leak.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2077>
2021-03-14 13:05:22 +09:00
Víctor Manuel Jáquez Leal
3c40ffc00f va: example: multiple-vpp: test direction change
If the driver supports it (iHD, so far) and the parameter -d is set,
the direction of the video will be changed randomly.

In the code you can select, at compilation time, if the direction
change is done by element's property or by pipeline events.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2074>
2021-03-12 12:46:41 +01:00
Víctor Manuel Jáquez Leal
0b2848fc32 va: postproc: update passthrough and reconfigure pads
Added helper function _update_passthrough() which will define and set
the pass-through mode of the filter, and it'll either reconfigure both
pads or it will just mark the src pad for renegotiation or nothing at
all.

There are cases where both pads have to be reconfigured (direction
changed, for example), other when just src pad has to (filters
updated) or none (changing to ready state).

The requirement of renegotiation depends on the need to enable/disable
its VA buffer pools.

This patch sets pass-through mode by default, so the buffer pools
aren't allocated if no filtering/direction operations are defined,
which is the correct behavior.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2074>
2021-03-12 12:34:46 +01:00
Stéphane Cerveau
451c875d40 zxing: update to support version 1.1.1
Support new API in 1.1.1
Update the supported input video format.
Update tests to use parse_launch

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2037>
2021-03-12 01:03:49 +00:00
Stéphane Cerveau
b0a9ba4ccf mpegvideoparse: do not clip the frame
If the current buffer is delta unit such as P or B
frame, the buffer should not be clipped and need to
let the decoder handle the segment boundary situation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2070>
2021-03-11 15:01:38 +01:00
Seungha Yang
cdce27d975 d3d11device: Fix wrong printf formatting
Add missing '%' there

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2069>
2021-03-11 13:31:18 +09:00
Philippe Normand
a6b5e3c7d5 transcoder: Add state-changed signal
Similar to GstPlayer, a new signal for state tracking is now emitted at runtime,
as a commodity for applications which then don't need to monitor the pipeline
GstBus for state changes anymore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2028>
2021-03-10 17:13:57 +00:00
Philippe Normand
12a7bf9f7c player: Rewrite as GstPlay wrapper
For the time being the GstPlayer library remains as a wrapper for GstPlay, in
order to keep existing applications working and give them time to port to
GstPlay. GstPlayer will remain in -bad for a couple cycles and the plan for
GstPlay is to move it to -base before 1.20.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2061>
2021-03-09 18:03:48 +00:00
Philippe Normand
f009802771 play: Flush API bus before exiting main loop
Otherwise the bus might attempt to dispatch queued messages after the thread
ended, causing runtime warnings.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2061>
2021-03-09 18:03:48 +00:00
Philippe Normand
fae7c8dd7e play: tests: Switch user-agent test to a real HTTP server
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2061>
2021-03-09 18:03:48 +00:00
Philippe Normand
3eec2f4be8 play: tests: Refactor to use new Message bus API
Instead of relying on an extra GMainLoop, the messages are poped from the player
bus and handled synchronously. This should avoid flaky behaviors.

Fixes #608

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2061>
2021-03-09 18:03:48 +00:00
Philippe Normand
19d57dcfa5 play: Plug media_info leak
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2061>
2021-03-09 18:03:48 +00:00
Stephan Hesse
e007c47c3f play: Rename internal buffering field to buffering_percent
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2061>
2021-03-09 18:03:48 +00:00
Stephan Hesse
a74651ddc1 play: Introducing the new playback library
This aims to be a replacement for the GstPlayer library. In GstPlay, notifications are
sent as application messages through a dedicated GstBus. The GMainContext-based
signal dispatcher was replaced by a GObject signal adapter, now relying on the
bus to emit its signals. The signal dispatcher is now optional and fully
decoupled from the GstPlay object.

Co-authored with: Philippe Normand <philn@igalia.com>

Fixes #394

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2061>
2021-03-09 18:03:48 +00:00
Sebastian Dröge
80c1722cba avwait: Don't post messages with the mutex locked
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2063>
2021-03-09 13:01:45 +02:00