Commit graph

26692 commits

Author SHA1 Message Date
Seungha Yang
59a1897c39 d3d11: Privatize d3d11memory implementation
Hide most of symbols of GstD3D11Memory object.
GstD3D11Memory is one of primary resource for imcoming d3d11 library
and it's expected to be a extensible feature.
Hiding implementation detail would be helpful for later use case.

Summary of this commit:
* Now all native Direct3D11 resources are private of GstD3D11Memory.
  To access native resources, getter methods need to be used
  or generic map (e.g., gst_memory_map) API should be called
  apart from some exceptional case such as d3d11decoder case.
* Various helper methods are added for GstBuffer related operations
  and in order to remove duplicated code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1892>
2020-12-21 01:02:37 +09:00
Seungha Yang
f1e3e5276a d3d11: Add a helper method for d3d11buffferpool setup
Remove duplicated code for d3d11buffferpool setup.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1892>
2020-12-21 01:02:37 +09:00
Seungha Yang
ac04681b6f d3d11device: Remove optional helper methods
Most of Direct3D11 APIs can be called without GstD3D11Device
abstraction. This is a part of prework for public GstD3D11 library
to introduce minimal APIs

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1892>
2020-12-21 01:02:37 +09:00
Seungha Yang
28174b14d3 d3d11videosink: Prepare window once streaming started
... instead of READY state. READY state is too early for setting
overlay window handle especially playbin/playsink scenario
since playsink will set given overlay handle on videosink once
READY state change of videosink is ensured.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1893>
2020-12-20 22:28:21 +09:00
Seungha Yang
6195fcf857 mfvideoenc: Improve latency performance for hardware encoder
Unlike software MFT (Media Foundation Transform) which is synchronous
in terms of processing input and output data, hardware MFT works
in asynchronous mode. output data might not be available right after
we pushed one input data into MFT.
Note that async MFT will fire two events, one is "METransformNeedInput"
which happens when MFT can accept more input data,
and the other is "METransformHaveOutput", that's for signaling
there's pending data which can be outputted immediately.

To listen the events, we can wait synchronously via
IMFMediaEventGenerator::GetEvent() or make use of IMFAsyncCallback
object which is asynchronous way and the event will be notified
from Media Foundation's internal worker queue thread.

To handle such asynchronous operation, previous working flow was
as follows (IMFMediaEventGenerator::GetEvent() was used for now)
- Check if there is pending output data and push the data toward downstream.
- Pulling events (from streaming thread) until there's at least
  one pending "METransformNeedInput" event
- Then, push one data into MFT from streaming thread
- Check if there is pending "METransformHaveOutput" again.
  If there is, push new output data to downstream
  (unlikely there is pending output data at this moment)

Above flow was processed from upstream streaming thread. That means
even if there's available output data, it could be outputted later
when the next buffer is pushed from upstream streaming thread.
It would introduce at least one frame latency in case of live stream.

To reduce such latency, this commit modifies the flow to be fully
asynchronous like hardware MFT was designed and to be able to
output encoded data whenever it's available. More specifically,
IMFAsyncCallback object will be used for handling
"METransformNeedInput" and "METransformHaveOutput" events from
Media Foundation's internal thread, and new output data will be
also outputted from the Media Foundation's thread.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1520>
2020-12-19 18:56:33 +00:00
Sebastian Dröge
70facfa8d3 decklinkaudiosrc: Fix duration of the first audio frame after each discont
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1886>
2020-12-17 09:00:24 +00:00
Biswapriyo Nath
8af91be222 mediafoundation: Fix redefinition of variables.
Remove duplicate GstMFDevice and GstMFDeviceProvider declaration.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1884>
2020-12-16 18:48:12 +00:00
Jan Schmidt
1b3ba87d13 audiobuffersplit: Calculate the correct size for fixed size buffers
Fix the output-buffer-size property to do what it says by calculating
the correct audio buffer size for that target size, rounded down to
the nearest whole number of samples.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1887>
2020-12-17 04:41:18 +11:00
Sebastian Dröge
c123b79900 decklink: Implement GstBaseSrc::get_caps() to return more constrained caps
Instead of the template caps we can return a subset of them based on the
selected properties.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1868>
2020-12-16 14:13:40 +02:00
Seungha Yang
be0df31b15 wasapi2: Ensure unmute when opening audio client
ISimpleAudioVolume::SetMute() status seems to be preserved even
after process is terminated. In order to start audio client with
unmuted state, always disable mute when opening audio client.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1731>
2020-12-14 19:08:21 +00:00
Edward Hervey
83e4310da1 tsparse: Don't use non-object for debugging statement
Use the pad instead

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1880>
2020-12-14 17:57:40 +01:00
Edward Hervey
d75ee7b16d examples/ts-parser: Use the section type for descriptor identification
Some descriptors can only be present in some section

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1880>
2020-12-14 17:57:40 +01:00
Edward Hervey
160106885a examples/ts-parser: Try more descriptor/stream types
These were added recently

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1880>
2020-12-14 17:57:40 +01:00
Edward Hervey
fe6ae27046 mpegts: Don't add non-padded streams to collection on updates
When carrying over existing GstStream to a new GstStreamCollection we need to
check whether they *actually* were being used in the previous collection.

This avoids adding unknown streams (metadata, PSI, etc...) to the collection on
updates.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1880>
2020-12-14 17:57:40 +01:00
Edward Hervey
3cb32df838 mpegts: Add support for SIT sections
Selection Information Tables (EN 300 468)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1852>
2020-12-14 16:37:29 +01:00
Edward Hervey
5d3a0ca6a9 mpegts: Update documentation
* Split up into appropriate individual header files
* Document more sections and structures
* Add well-known list of registration id

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1879>
2020-12-14 14:48:03 +00:00
Thibault Saunier
76bc578bae player/transcoder: Use bus signal watch
Instead of implementing exactly the same thing ourself but making
`GstBus` not know that it is the case.

Since we are *sure* that the bus can't have been access at the point
where we add the watch we are guaranteed that the current thread
maincontext is going to be used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1870>
2020-12-14 12:30:14 +00:00
Lim Siew Hoon
3ce1086b14 intervideosrc: fix negotiation of interlaced caps
In 1.0 the field in caps is called "interlace-mode", not "interlaced".

Fixes #1480

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1869>
2020-12-13 13:25:13 +00:00
Arun Raghavan
2a5d564de3 openaptx: Drop lib prefix from option name for consistency
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1876>
2020-12-11 22:08:01 -05:00
Igor Kovalenko
b916522382 openaptx: add aptX and aptX-HD codecs using libopenaptx
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1871>
2020-12-11 11:55:54 +03:00
Philippe Normand
3bcb876c29 wpe: Emit load-progress messages
The estimated-load-progress value can be used on application side to display a
progress bar for instance.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1710>
2020-12-09 17:31:51 +00:00
Vivia Nikolaidou
82dcb27401 basetsmux: Don't send the capsheader if src pad has no caps
That means we're shutting down, so there's no point in the streamheader
being sent

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1864>
2020-12-09 13:14:40 +00:00
Matthew Waters
1f7515100c rtmp2/connection: pass the parent cancellable down to the connection
Otherwise, when rtpm2src cancels an inflight operation that has a queued
message stored, then the rtmp connection operation is not stopped.

If the cancellation occurs during rtmp connection start up, then
rtpm2src does not have any way of accessing the connection object as it
has not been returned yet.  As a result, rtpm2src will cancel, the
connection will still be processing things and the
GMainContext/GMainLoop associated with the outstanding operation will be
destroyed.  All outstanding operations and the rtmpconnection object will
therefore be leaked in this case.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1425
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1862>
2020-12-08 23:43:02 +00:00
Jan Alexander Steffens (heftig)
470e6989d2 srt: Don't take object lock calling gst_srt_object_get_stats
This function takes the sock lock. This can result in a deadlock when
another thread holding the sock lock is trying to take the object lock.

Thread A (Holds object lock, wants sock lock):

    #2  gst_srt_object_get_stats at gst-plugins-bad/ext/srt/gstsrtobject.c:1753
    #3  gst_srt_object_get_property_helper at gst-plugins-bad/ext/srt/gstsrtobject.c:409
    #4  gst_srt_sink_get_property at gst-plugins-bad/ext/srt/gstsrtsink.c:95
    #5  g_object_get_property from libgobject-2.0.so.0

Thread B (Holds sock lock, wants object lock):

    #2  gst_element_post_message_default at gstreamer/gst/gstelement.c:2069
    #3  gst_element_post_message at gstreamer/gst/gstelement.c:2123
    #4  gst_element_message_full_with_details at gstreamer/gst/gstelement.c:2259
    #5  gst_element_message_full at gstreamer/gst/gstelement.c:2298
    #6  gst_srt_object_send_headers at gst-plugins-bad/ext/srt/gstsrtobject.c:1407
    #7  gst_srt_object_send_headers at gst-plugins-bad/ext/srt/gstsrtobject.c:1444
    #8  gst_srt_object_write_to_callers at gst-plugins-bad/ext/srt/gstsrtobject.c:1444
    #9  gst_srt_object_write at gst-plugins-bad/ext/srt/gstsrtobject.c:1598
    #10 gst_srt_sink_render at gst-plugins-bad/ext/srt/gstsrtsink.c:179

Fixes d2d00e07ac.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1861>
2020-12-07 17:59:09 +00:00
Sebastian Dröge
0243afcb9d ccconverter: Add property to specify which sections to include in CDP packets
Various software, including ffmpeg's Decklink support, fails parsing CDP
packets that contain anything but CC data in the CDP packets.

Based on this property, timecodes are not written into the CDP packets
even if they're present.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1833>
2020-12-07 19:23:42 +02:00
Sebastian Dröge
b6debae2c0 ccconverter: Refactor code to only retrieve the timecode meta once
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1833>
2020-12-07 09:40:52 +00:00
Víctor Manuel Jáquez Leal
34683c36de va: decode: fix display type
Instead of a pointer to GstVaDisplay it was used a VADisplay type, which in
certain platforms is the same, and the compiler didn't complain.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1860>
2020-12-06 18:03:47 +01:00
Marc Leeman
102c60f82c rtpmanagerbad: allow setting caps on rtpsrc
rtpsrc tries to do a lookup of the caps based on the encoding-name. For
not so standard encodings, the caps can be set, avoiding the lookup.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1406>
2020-12-04 14:51:38 +00:00
Seungha Yang
96831233a3 d3d11videosink: Add a property to support rendering statistics data on window
Add a new property "render-stats" to allow rendering statistics
data on window for debugging and/or development purpose.
Text rendering will be accelerated by GPU since this implementation
uses Direct2D/DirectWrite API and Direct3D inter-op for minimal overhead.
Specifically, text data will be rendered on swapchain backbuffer
directly without any copy/allocation of extra texture.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1830>
2020-12-04 05:22:14 +09:00
Seungha Yang
22990bb9ea d3d11: Protect ID3D11VideoContext with lock
Likewise d3d11 immediate context (i.e., ID3D11DeviceContext),
ID3D11VideoContext API is not thread safe. It must be protected therefore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1856>
2020-12-04 03:40:17 +09:00
Mathieu Duponchelle
cc44634422 docs: don't exit the subdir when optional deps aren't found
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1854>
2020-12-03 16:29:59 +00:00
Edward Hervey
d137171f03 opencv: Expose retinex parameters
Makes the plugin a tad more useful :)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1845>
2020-12-03 17:04:07 +01:00
Marius Vlad
aa68d03013 gst-libs/gst/wayland: Install "unstable" wayland header
Context creation and retrieval is required, the symbols are exported
with the header missing. Users most likely define GST_USE_UNSTABLE_API
so they're aware of the implications of using a header that might change
between releases.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1688>
2020-12-03 14:54:47 +00:00
Edward Hervey
339ad46b93 hlsdemux: Use actual object for logging
i.e. the pad of the stream

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1853>
2020-12-03 14:31:17 +00:00
Arun Raghavan
81abc4c825 curl: Remove incorrect GST_DEBUG_OBJECT() calls
klass is not a GstObject, and these debugs print should likely not be
around anyway.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1851>
2020-12-03 13:31:38 +00:00
Edward Hervey
dddd0af9cd cuda: Fix lowest targetted architecture for CUDA >= 11.0
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1469

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1835>
2020-12-03 12:23:44 +01:00
Edward Hervey
30ee21eae3 tsparse: Forward incoming timestamps
Ensure we properly forward the upstream PTS/DTS on the regular and program
source pads. All packets being processed will carry over the latest PTS/DTS (as
a reconstructed GstBuffer).

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

And properly forward PTS/DTS for program pads (which wasn't the case before)

Original patch by Vivia Nikolaidou <vivia@ahiru.eu>

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1769>
2020-12-02 14:22:06 +00:00
Sebastian Dröge
2f3e245426 adaptivedemux: Don't log with non-GObject objects
Instead of using the streams, log with the pad of the streams.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1844>
2020-12-02 12:03:36 +00:00
Thibault Saunier
8eb0e637c7 transcodebin: Minor error message enhancement 2020-11-30 17:31:48 -03:00
Thibault Saunier
eb0d72f382 transcodebin: Unlock while setting decodebin caps
Otherwise it will deadlock recursing up to notify parent object property changes
2020-11-30 17:31:48 -03:00
Thibault Saunier
5ccaa595a9 transcodebin: Avoid plugin converter if filter handles ANY caps
For example identity or clocksync or this kind of elements can be
used with any data flow and we should not enforce decoding to row in
that case.
2020-11-30 17:31:48 -03:00
Thibault Saunier
878a196080 transcodebin: Add filter as soon as it is set
Instead of waiting so that we can simply use a clocksync element as
filter, otherwise we won't know the pipeline is live as it won't
return NO_PREROLL as one would expect in that case.

Adding it right away shouldn't create any issue, both ways are fine.
2020-11-30 17:31:48 -03:00
Thibault Saunier
530f694366 uritranscodebin: Add setup-source and element-setup signals
The same way as playbinX does it as it is often quite useful
2020-11-30 17:31:48 -03:00
Thibault Saunier
142e571c28 transcode: Port to encodebin2
This allows supporting muxing sinks like hlssink2 or splitmux
2020-11-30 17:31:48 -03:00
Thibault Saunier
b3544e24ba transcoder: Handle the case where several errors are posted
There were cases where the loop was already destroyed when we were
receiving the following message.
2020-11-30 15:16:01 -03:00
Thibault Saunier
9d890c152e transcoder: Minor refactoring to output better debug logs 2020-11-30 15:16:01 -03:00
Thibault Saunier
f1cf5d0683 hlssink2: Mark as Muxer
The way it is usable by encodebin2. This is what splitmux does already.
2020-11-30 15:16:01 -03:00
Víctor Manuel Jáquez Leal
ef62e6cfa2 va: decoder: Picture dups only holds GstBuffer
Also removes the warning log message at destroying buffers when picture free()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1841>
2020-11-30 17:12:14 +01:00
Víctor Manuel Jáquez Leal
14c28415b9 va: Remove gst_va_decoder_destroy_buffers()
Since GstVaDecodePicture is destroyed completely with its free() function and
it's used as destroy notify by codecs picture, there's no need to call
gst_va_decoder_destroy_buffers() externally, since the codecs base classes
destroy the codec picture when it's required.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1841>
2020-11-30 16:53:25 +01:00
He Junyan
f5c7ada98e va: Destroy picture unreleased buffers when finalize.
The current way of GstVaDecodePicture's finalize will leak some
resource such as parameter buffers and slice data.
The current way deliberately leaves these resource releasing logic
to va decoder related function and trigger a warning if we free the
GstVaDecodePicture without releasing these resources.
But in practice, sometimes, you do not have the chance to release
these resource before picture is freed. For example, H264/Mpeg2
support multi slice NALs/Packets for one frame. It is possible that
we already succeed to parse and generate the first several slices
data by _decode_slice(), but then we get a wrong slice NAL/packet
and fail to parse it. We decide to discard the whole frame in the
decoder's base class, it just free the current picture and does not
trigger sub class's function again. In this kind of cases, we do
not have the chance to cleanup the resource, and the resource will
be leaked.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1841>
2020-11-30 13:03:11 +00:00