platform/upstream/gstreamer.git
4 years agod3d11videosink: Clarify the meaning of various width and height variables
Seungha Yang [Mon, 2 Mar 2020 11:55:29 +0000 (20:55 +0900)]
d3d11videosink: Clarify the meaning of various width and height variables

* Remove redundant variables for width/height and par from GstD3D11Window.
  GstVideoInfo holds all the values.
* Don't need to pass par to gst_d3d11_window_prepare().
  It will be parsed from caps again
* Remove duplicated math

Fixing regression of the commit 9dada901083fec3276cb2df58785db14b87e8f22

4 years agod3d11vp9dec: Port to GstVP9SuperframeInfo
Yeongjin Jeong [Thu, 27 Feb 2020 18:08:23 +0000 (03:08 +0900)]
d3d11vp9dec: Port to GstVP9SuperframeInfo

The vp9parser is now exposed new API for parsing superframe info.

4 years agotests: vp9parser: Add test parsing superframe
Yeongjin Jeong [Sun, 1 Mar 2020 15:43:45 +0000 (00:43 +0900)]
tests: vp9parser: Add test parsing superframe

4 years agovp9parser: Add new API for parsing superframe info
Yeongjin Jeong [Thu, 27 Feb 2020 18:06:47 +0000 (03:06 +0900)]
vp9parser: Add new API for parsing superframe info

Some elements are using their own implementations for superframe parsing.
To reduce redundant code, we need to add API to the parser.

4 years agotranscodebin: mark properties as GST_PARAM_MUTABLE_READY
Guillaume Desmottes [Thu, 27 Feb 2020 13:01:19 +0000 (18:31 +0530)]
transcodebin: mark properties as GST_PARAM_MUTABLE_READY

They are all used in the READY to PAUSED transition so should not be
changed after.

4 years agotranscodebin: force decoding if a filter is defined
Guillaume Desmottes [Thu, 27 Feb 2020 11:46:45 +0000 (17:16 +0530)]
transcodebin: force decoding if a filter is defined

Filter operates on raw data so don't allow decodebin to produce
encoded data if one is defined.

My use case here is keeping the video stream untouched but apply a filter
on the audio one, while keeping the same audio format.

4 years agotranscodebin: logs when inserting, or not, a filter
Guillaume Desmottes [Thu, 27 Feb 2020 11:33:42 +0000 (17:03 +0530)]
transcodebin: logs when inserting, or not, a filter

It's not easy atm to figure out from the logs if a filter has actually be
inserted or not.

4 years agod3d11decoder: Do not print warning message if retry count is in expected range
Seungha Yang [Wed, 26 Feb 2020 07:13:21 +0000 (16:13 +0900)]
d3d11decoder: Do not print warning message if retry count is in expected range

gst_d3d11_result() will print warning message when HRESULT != S_OK.
However, since the retry is trivial stuff, check hr == E_PENDING first
and do not warn it.

4 years agod3d11decoder: Check decoder status report
Seungha Yang [Wed, 26 Feb 2020 06:55:23 +0000 (15:55 +0900)]
d3d11decoder: Check decoder status report

... and if h/w decoder reports error, increase error count.

4 years agofakevideosink: Align max-lateness/processing-deadline to GstVideoSink
Olivier Crête [Thu, 27 Feb 2020 23:16:27 +0000 (18:16 -0500)]
fakevideosink: Align max-lateness/processing-deadline to GstVideoSink

To emulate correctly the timing video of a real sink, let's set those
properties just like a real video sink.

4 years agowebrtc: Use the dtlssrtenc rtp-sync property
Jan Schmidt [Thu, 13 Feb 2020 14:42:34 +0000 (01:42 +1100)]
webrtc: Use the dtlssrtenc rtp-sync property

Instead of synchronising at the ICE transport, do clock sync for the
RTP stream at the DTLS transport via the dtlssrtpenc rtp-sync
property. This avoids delaying RTCP while waiting until it is time
to output an RTP packet when rtcp-mux is enabled.

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

4 years agogstdtlsrtpenc: Add rtp-sync property
Jan Schmidt [Thu, 13 Feb 2020 14:38:14 +0000 (01:38 +1100)]
gstdtlsrtpenc: Add rtp-sync property

Add an rtp-sync property which synchronises RTP streams
to the pipeline clock before passing them to funnel for
merging with RTCP.

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

4 years agodash: Don't use sscanf + glib format modifiers
Nirbheek Chauhan [Thu, 27 Feb 2020 06:09:08 +0000 (11:39 +0530)]
dash: Don't use sscanf + glib format modifiers

We do not have a way to know the format modifiers to use with string
functions provided by the system. `G_GUINT64_FORMAT` and other string
modifiers only work for glib string formatting functions. We cannot
use them for string functions provided by the stdlib. See:
https://developer.gnome.org/glib/stable/glib-Basic-Types.html#glib-Basic-Types.description

F.ex.
```
 ../ext/dash/gstxmlhelper.c: In function 'gst_xml_helper_get_prop_unsigned_integer_64':
../ext/dash/gstxmlhelper.c:473:40: error: unknown conversion type character 'l' in format [-Werror=format=]
     if (sscanf ((gchar *) prop_string, "%" G_GUINT64_FORMAT,
                                        ^~~
In file included from /builds/nirbheek/cerbero/cerbero-build/dist/windows_x86/include/glib-2.0/glib/gtypes.h:32,
                 from /builds/nirbheek/cerbero/cerbero-build/dist/windows_x86/include/glib-2.0/glib/galloca.h:32,
                 from /builds/nirbheek/cerbero/cerbero-build/dist/windows_x86/include/glib-2.0/glib.h:30,
                 from /builds/nirbheek/cerbero/cerbero-build/dist/windows_x86/include/gstreamer-1.0/gst/gst.h:27,
                 from ../ext/dash/gstxmlhelper.h:26,
                 from ../ext/dash/gstxmlhelper.c:22:
/builds/nirbheek/cerbero/cerbero-build/dist/windows_x86/lib/glib-2.0/include/glibconfig.h:69:28: note: format string is defined here
 #define G_GUINT64_FORMAT "llu"
                            ^
../ext/dash/gstxmlhelper.c:473:40: error: too many arguments for format [-Werror=format-extra-args]
     if (sscanf ((gchar *) prop_string, "%" G_GUINT64_FORMAT,
                                        ^~~
```

In the process, we're also following the DASH MPD spec more closely
now, which specifies that ranges must follow RFC 2616 section 14.35.1:
https://tools.ietf.org/html/rfc2616#page-138

4 years agodtls: Set a random serial number and issuer/subject in the self-signed certificates
Sebastian Dröge [Wed, 26 Feb 2020 19:11:40 +0000 (21:11 +0200)]
dtls: Set a random serial number and issuer/subject in the self-signed certificates

This is also what Chrome and Firefox are doing, citing privacy concerns.
Also putting OpenWebRTC from Sweden as issuer/subject is rather
confusing.

4 years agotranscodebin: consider 'any' as no restriction
Guillaume Desmottes [Wed, 26 Feb 2020 03:38:03 +0000 (09:08 +0530)]
transcodebin: consider 'any' as no restriction

gstreamer-rs set 'any' as default restriction which actually means 'no
restriction' so handle it as the absence of restriction.

4 years agod3d11window: Set DXGI_PRESENT_ALLOW_TEARING only in fullscreen mode
Seungha Yang [Wed, 26 Feb 2020 04:11:30 +0000 (13:11 +0900)]
d3d11window: Set DXGI_PRESENT_ALLOW_TEARING only in fullscreen mode

The DXGI_PRESENT_ALLOW_TEARING flag might cause unexpected tearing
side effect. Setting it in fullscreen mode only seems to be
the correct usage as in the Microsoft's direct3d examples.

4 years agotranscodebin: fix caps leak
Guillaume Desmottes [Tue, 25 Feb 2020 15:33:06 +0000 (21:03 +0530)]
transcodebin: fix caps leak

encodecaps was leaked if the profile has restrictions.

4 years agortmp2: Allow setting flash-version
Jan Alexander Steffens (heftig) [Tue, 25 Feb 2020 13:58:23 +0000 (14:58 +0100)]
rtmp2: Allow setting flash-version

In case the application has to deal with fussy servers. User agent
sniffing is so last decade.

Adds a property to set the Flash version on both the sink and the src.
The default stays the same (IIRC, Flash plugin for Linux from 2009).

4 years agoh265parser: Skip unused bits in an SEI.
Jan Schmidt [Fri, 14 Feb 2020 17:18:07 +0000 (04:18 +1100)]
h265parser: Skip unused bits in an SEI.

Alternative approach to 18b54f8d347030c73d8afbeaf55df57aa5acbb96
that skips all bits in a broken SEI correctly.

4 years agoRevert "h265parser: Skip unused SEI bits differently"
Stéphane Cerveau [Wed, 12 Feb 2020 16:37:46 +0000 (17:37 +0100)]
Revert "h265parser: Skip unused SEI bits differently"

This reverts commit 18b54f8d347030c73d8afbeaf55df57aa5acbb96.

4 years agotests: add picture timing SEI parsing
Stéphane Cerveau [Tue, 11 Feb 2020 11:21:29 +0000 (12:21 +0100)]
tests: add picture timing SEI parsing

4 years agoh265parse: Fix offset by one error in pic timing SEI
Dylan Yip [Fri, 7 Feb 2020 08:13:49 +0000 (00:13 -0800)]
h265parse: Fix offset by one error in pic timing SEI

Offset by one error causes a free/malloc error when parsing pic timing
SEI messages.

4 years agod3d11decoder: Ensure the written bitstream buffer size is 128 bytes aligned
Seungha Yang [Fri, 21 Feb 2020 12:02:47 +0000 (21:02 +0900)]
d3d11decoder: Ensure the written bitstream buffer size is 128 bytes aligned

DXVA spec is saying that the size of bitstream buffer provided by hardware decoder
should be 128 bytes aligned. And also the host software decoder should
align the size of written buffer to 128 bytes. That means if the slice
(or frame in case of VP9) size is not aligned with 128 bytes,
the rest of non 128 bytes aligned memory should be zero-padded.

In addition to aligning implementation, some variables are renamed
to be more intuitive by this commit.

4 years agomsdk: libva: Don't set the hint if MFX_VERSION is lower than 1025
Haihao Xiang [Wed, 12 Feb 2020 02:24:55 +0000 (10:24 +0800)]
msdk: libva: Don't set the hint if MFX_VERSION is lower than 1025

MFX_MEMTYPE_VIDEO_MEMORY_ENCODER_TARGET is defined since MFX_VERSION
1025.

4 years agortmp2: Expose connection stats as property
Jan Alexander Steffens (heftig) [Mon, 27 Jan 2020 14:13:58 +0000 (15:13 +0100)]
rtmp2: Expose connection stats as property

Save the stats before we destroy the connection, so we can still
retrieve them afterwards.

4 years agortmp2: Add gst_rtmp_connection_get_stats and _get_null_stats
Jan Alexander Steffens (heftig) [Fri, 14 Feb 2020 13:53:46 +0000 (14:53 +0100)]
rtmp2: Add gst_rtmp_connection_get_stats and _get_null_stats

The former uses a thread-safe way of getting statistics from the
connection without having to protect the fields with a lock.

The latter produces a zeroed statistics structure for use when no
connection exists.

4 years agortmp2: Count outgoing bytes and acked bytes
Jan Alexander Steffens (heftig) [Fri, 14 Feb 2020 11:34:44 +0000 (12:34 +0100)]
rtmp2: Count outgoing bytes and acked bytes

For statistics.

4 years agortmp2sink: Add a property for the outgoing chunk size
Jan Alexander Steffens (heftig) [Mon, 27 Jan 2020 15:30:20 +0000 (16:30 +0100)]
rtmp2sink: Add a property for the outgoing chunk size

4 years agortmp2: Add gst_rtmp_connection_set_chunk_size
Jan Alexander Steffens (heftig) [Fri, 14 Feb 2020 11:34:19 +0000 (12:34 +0100)]
rtmp2: Add gst_rtmp_connection_set_chunk_size

4 years agortmp2: Handle outgoing set chunk/window size properly
Jan Alexander Steffens (heftig) [Mon, 27 Jan 2020 15:22:20 +0000 (16:22 +0100)]
rtmp2: Handle outgoing set chunk/window size properly

Apply outgoing sizes only after writing the chunk to the peer. This is
important particularly for the set chunk size and allows exposing it
without threading issues.

4 years agortmp2: Chunk messages as buffers in loop thread
Jan Alexander Steffens (heftig) [Mon, 27 Jan 2020 13:05:31 +0000 (14:05 +0100)]
rtmp2: Chunk messages as buffers in loop thread

Move output chunking from gst_rtmp_connection_queue_message into
gst_rtmp_connection_start_write, which effectively moves it from the
streaming thread into the loop thread.

This allows us to handle the outgoing chunk-size message (which is
generated by changing the future chunk-size property) properly, which
could come from any other thread.

4 years agortmp2: Consistently use GstBuffer for RTMP chunks
Jan Alexander Steffens (heftig) [Wed, 12 Feb 2020 15:55:15 +0000 (16:55 +0100)]
rtmp2: Consistently use GstBuffer for RTMP chunks

4 years agortmp2: Add gst_rtmp_chunk_stream_serialize_all
Jan Alexander Steffens (heftig) [Wed, 12 Feb 2020 15:47:30 +0000 (16:47 +0100)]
rtmp2: Add gst_rtmp_chunk_stream_serialize_all

Serializes an RTMP message into a series of chunks, all in one buffer.

Similar to what gst_rtmp_connection_queue_message does to serialize
into a GByteArray.

4 years agortmp2: Add gst_rtmp_output_stream_write_all_buffer_async
Jan Alexander Steffens (heftig) [Wed, 12 Feb 2020 15:43:30 +0000 (16:43 +0100)]
rtmp2: Add gst_rtmp_output_stream_write_all_buffer_async

Similar to gst_rtmp_output_stream_write_all_bytes_async, but takes a
GstBuffer instead of a GBytes. It can also return the number of bytes
written, which might be lower in case of an error.

4 years agortmp2: Improve handling incoming set chunk/window size
Jan Alexander Steffens (heftig) [Fri, 14 Feb 2020 11:28:43 +0000 (12:28 +0100)]
rtmp2: Improve handling incoming set chunk/window size

Reject out-of-spec sizes and warn about suspiciously small sizes.

4 years agortmp2: Lock self->lock before OBJECT_LOCK
Jan Alexander Steffens (heftig) [Fri, 14 Feb 2020 13:26:27 +0000 (14:26 +0100)]
rtmp2: Lock self->lock before OBJECT_LOCK

OBJECT_LOCK is used to protect property access only. self->lock is
used to access the RtmpConnection, mostly between the streaming thread
and the loop thread.

To avoid deadlocks involving these two locks, we obey a lock order:
If both self->lock and OBJECT_LOCK are needed, self->lock must be locked
first. Clarify this.

4 years agortmp2: Reject oversized messages
Jan Alexander Steffens (heftig) [Fri, 14 Feb 2020 11:20:32 +0000 (12:20 +0100)]
rtmp2: Reject oversized messages

We only have 24 bits for the size, so reject anything larger.

4 years agortmp2: Count in_bytes_acked instead of in_bytes_unacked
Jan Alexander Steffens (heftig) [Fri, 14 Feb 2020 10:49:23 +0000 (11:49 +0100)]
rtmp2: Count in_bytes_acked instead of in_bytes_unacked

This is nicer for statistics.

4 years agortmp2: rtmpconnection: Use more appropriate size types
Jan Alexander Steffens (heftig) [Wed, 12 Feb 2020 17:27:56 +0000 (18:27 +0100)]
rtmp2: rtmpconnection: Use more appropriate size types

- guint32 for chunk size and window size
- guint64 for running counters

4 years agortmp2: Add a g_return_val_if_fail
Jan Alexander Steffens (heftig) [Wed, 12 Feb 2020 15:55:45 +0000 (16:55 +0100)]
rtmp2: Add a g_return_val_if_fail

4 years agortmp2: Replace explicit unref with g_main_context_invoke_full
Jan Alexander Steffens (heftig) [Wed, 12 Feb 2020 15:49:45 +0000 (16:49 +0100)]
rtmp2: Replace explicit unref with g_main_context_invoke_full

4 years agortmp2: rtmpconnection: Use GST_*_OBJECT logging
Jan Alexander Steffens (heftig) [Mon, 27 Jan 2020 14:27:28 +0000 (15:27 +0100)]
rtmp2: rtmpconnection: Use GST_*_OBJECT logging

GstRtmpConnection isn't a GstObject with a name or path, but we still
get the GObject's type and address.

4 years agorist: fix two minor memory leaks
Marc Leeman [Fri, 21 Feb 2020 10:33:35 +0000 (11:33 +0100)]
rist: fix two minor memory leaks

4 years agortpmanagerbad: fix two minor memory leaks
Marc Leeman [Wed, 19 Feb 2020 16:07:35 +0000 (17:07 +0100)]
rtpmanagerbad: fix two minor memory leaks

4 years agortpmanagerbad: reduce lock in rtpsink
Marc Leeman [Wed, 19 Feb 2020 16:07:23 +0000 (17:07 +0100)]
rtpmanagerbad: reduce lock in rtpsink

4 years agortpmanagerbad: documentation comment fix
Marc Leeman [Wed, 19 Feb 2020 16:06:18 +0000 (17:06 +0100)]
rtpmanagerbad: documentation comment fix

4 years agowebrtc: Configure transportsendbin latency internally
Jan Schmidt [Thu, 20 Feb 2020 16:39:14 +0000 (03:39 +1100)]
webrtc: Configure transportsendbin latency internally

Add latency configuration logic to transportsendbin to
isolate it from the overall pipeline latency. That means that
it configures minimum latency internally based on the
latency query, and sends a latency event upstream that
matches.

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

4 years agod3d11decoder: Add padding space on decoder output view when it's not aligned
Seungha Yang [Thu, 20 Feb 2020 07:19:09 +0000 (16:19 +0900)]
d3d11decoder: Add padding space on decoder output view when it's not aligned

Most H/W decoders have required alignment and dxva is also the case.

4 years agod3d11decoder: Register elements per GPU device with capability check
Seungha Yang [Fri, 14 Feb 2020 16:23:32 +0000 (01:23 +0900)]
d3d11decoder: Register elements per GPU device with capability check

This implementation is similar to what we've done for nvcodec plugin.
Since supported resolution, profiles, and formats are device dependent ones,
single template caps cannot represent them, so this modification
will help autoplugging and fallback.

Note that the legacy gpu list and list of resolution to query were
taken from chromium's code.

4 years agod3d11device: Fix typo
Seungha Yang [Mon, 17 Feb 2020 06:04:28 +0000 (15:04 +0900)]
d3d11device: Fix typo

s/vender/vendor

4 years agod3d11device: Adjust debug level for when _new() fails
Seungha Yang [Fri, 14 Feb 2020 11:27:28 +0000 (20:27 +0900)]
d3d11device: Adjust debug level for when _new() fails

gst_d3d11_device_new might be used to enumerate device.

4 years agovkswapper: keep a reference on the input buffer until present is finished
Matthew Waters [Thu, 6 Feb 2020 05:39:06 +0000 (16:39 +1100)]
vkswapper: keep a reference on the input buffer until present is finished

Otherwise, there may be a very small period of time where the buffer can
be freed while being presented.

4 years agowebrtc: Merge ICE candidates to local descriptions
Jan Schmidt [Fri, 14 Feb 2020 01:52:30 +0000 (12:52 +1100)]
webrtc: Merge ICE candidates to local descriptions

When emitting ICE candidates, also merge them to the local and
pending description so they show up in the SDP if those are
retrieved from the current-local-description and
pending-local-description properties.

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

4 years agod3d11videosink: Ensure upload staging texture to fallback render texture
Seungha Yang [Sun, 16 Feb 2020 08:11:29 +0000 (17:11 +0900)]
d3d11videosink: Ensure upload staging texture to fallback render texture

gst_video_frame_copy will copy input frame to stating texture
of fallback frame. Then, we need to map fallback texture with GST_MAP_D3D11
flag to upload the staging texture to render texture. Otherwise
the render texture wouldn't be updated.

4 years agod3d11decoder: Fix copying decoder view to staging
Seungha Yang [Thu, 13 Feb 2020 12:19:37 +0000 (21:19 +0900)]
d3d11decoder: Fix copying decoder view to staging

Source texture (decoder view) might be larger than destination (staging) texture.
In that case, D3D11_BOX structure should be passed to CopySubresourceRegion method
in order to specify the exact target area.

4 years agowebrtcbin: Block the source pads before dtlssrtpdec inside transportreceivebin
Sebastian Dröge [Wed, 12 Feb 2020 15:50:53 +0000 (17:50 +0200)]
webrtcbin: Block the source pads before dtlssrtpdec inside transportreceivebin

Otherwise dropped sticky events are not actually re-sent on the next
opportunity and we can end up with data-flow before stream-start/segment
events.

4 years agosctp: Take some socket configurations from Firefox's datachannel code
Sebastian Dröge [Thu, 6 Feb 2020 17:40:20 +0000 (19:40 +0200)]
sctp: Take some socket configurations from Firefox's datachannel code

- Do not send ABORTs for unexpected packets are as response to INIT
- Enable interleaving of messages of different streams
- Configure 1MB send and receive buffer for the socket
- Enable SCTP_SEND_FAILED_EVENT and SCTP_PARTIAL_DELIVERY_EVENT events
- Set SCTP_REUSE_PORT configuration
- Set SCTP_EXPLICIT_EOR and the corresponding send flag. We probably
  want to split packets to a maximum size later and only set the flag
  on the last packet. Firefox uses 0x4000 as maximum size here.
- Enable SCTP_ENABLE_CHANGE_ASSOC_REQ
- Disable PMTUD and set an maximum initial MTU of 1200

4 years agosctp: Start connection synchronously when starting the association
Sebastian Dröge [Thu, 6 Feb 2020 16:43:35 +0000 (18:43 +0200)]
sctp: Start connection synchronously when starting the association

Calling bind() only sets up some data structures and calling connect()
only produces one packet before it returns. That packet is stored in a
queue that is asynchronously forwarded by the encoder's source pad loop,
so not much is happening there either. Especially no waiting is
happening here and no forwarding of data to other elements.

This fixes a race condition during connection setup: the connection
would immediately fail if we pass a packet from the peer to the socket
before bind() and connect() have returned.

This can't happen anymore as bind() and connect() have returned already
before both elements reach the PAUSED state, and in webrtcbin there is
an additional blocking pad probe before the decoder that does not let
any data pass through before that anyway.

4 years agosctp: Switch back to a non-recursive mutex and don't hold it while calling any usrsct...
Sebastian Dröge [Thu, 6 Feb 2020 14:42:01 +0000 (16:42 +0200)]
sctp: Switch back to a non-recursive mutex and don't hold it while calling any usrsctp functions

The library is thread-safe by itself and potentially calls back into our
code, not only from the same thread but also from other threads. This
can easily lead to deadlocks if we try to hold our mutex on both sides.

4 years agod3d11window: Fix for broken dirty rect drawing on Windows 7
Seungha Yang [Wed, 12 Feb 2020 13:29:31 +0000 (22:29 +0900)]
d3d11window: Fix for broken dirty rect drawing on Windows 7

DXGI_SWAP_EFFECT_DISCARD cannot be used with dirty rect drawing feature
of IDXGISwapChain1::Present().
Note that IDXGISwapChain1 interface is available on Platform Update for Windows 7
and DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL is also the case.

4 years agod3d11window: Fix for dxva decoder output view rendering
Seungha Yang [Tue, 11 Feb 2020 04:12:33 +0000 (13:12 +0900)]
d3d11window: Fix for dxva decoder output view rendering

Use resolution specified in caps for input_rect instead of
passed width and height value. The width and height might be modified
ones by d3d11videosink, then frame resolution might be different.

4 years agod3d11decoder: Refactor decoding process
Seungha Yang [Wed, 5 Feb 2020 12:27:23 +0000 (21:27 +0900)]
d3d11decoder: Refactor decoding process

* Move decoding process to handle_frame
* Remove GstVideoDecoder::parse implementation
* Clarify flush/drain/finish usage

In forward playback case, have_frame() call will be followed by
handle_frame() but reverse playback is not the case.
To ensure GstVideoCodecFrame, the decoding process should be placed inside
of handle_frame(), instead of parse().

Since we don't support alignment=nal, the parse() implementation is not worth.
In order to fix broken reverse playback, let's remove the parse()
implementation and revisit it when adding alignment=nal support.

4 years agod3d11decoder: Move handle_frame implementation to baseclass
Seungha Yang [Thu, 30 Jan 2020 11:04:58 +0000 (20:04 +0900)]
d3d11decoder: Move handle_frame implementation to baseclass

... and remove unused start, stop method from subclass.

Current implementation does not require subclass specific behavior
for the handle_frame() method.

4 years agod3d11videosink: Remove max size condition from pool
Seungha Yang [Wed, 5 Feb 2020 09:20:57 +0000 (18:20 +0900)]
d3d11videosink: Remove max size condition from pool

Actually our buffer pool size and the number of backbuffer are
independent. In case of reverse playback, upstream might request
a lot of buffers (up to GOP size).

4 years agonvcodec: Mark class data as may-be-leaked to quiet the leaks tracer
Nirbheek Chauhan [Tue, 11 Feb 2020 18:30:51 +0000 (00:00 +0530)]
nvcodec: Mark class data as may-be-leaked to quiet the leaks tracer

The class data with the caps in it will be leaked if the element is
registered but never instantiated. There is no way around this. Mark
the caps as such so that the leaks tracer does not warn about it.

This is the same as pad template caps getting leaked, which are also
marked as may-be-leaked. These objects are initialized exactly once,
and are 'global' data.

4 years agowpe: Add software rendering support support
Philippe Normand [Sat, 8 Feb 2020 12:05:03 +0000 (12:05 +0000)]
wpe: Add software rendering support support

Starting from WPEBackend-FDO 1.6.x, software rendering support is available.
This features allows wpesrc to be used on machines without GPU, and/or for
testing purpose. To enable it, set the `LIBGL_ALWAYS_SOFTWARE=true` environment
variable and make sure `video/x-raw, format=BGRA` caps are negotiated by the
wpesrc element.

4 years agofluiddec: Move logging init into plugin_init
Jan Alexander Steffens (heftig) [Tue, 11 Feb 2020 11:15:09 +0000 (12:15 +0100)]
fluiddec: Move logging init into plugin_init

This is a nicer place to keep it. We also initialize it before touching
the drivers.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/merge_requests/1026

4 years agofluiddec: Keep fluidsynth from probing audio drivers
Jan Alexander Steffens (heftig) [Wed, 5 Feb 2020 10:17:33 +0000 (11:17 +0100)]
fluiddec: Keep fluidsynth from probing audio drivers

It might cause problems and we don't need the drivers anyway. This also
avoids a bunch of stderr spam from the drivers.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/merge_requests/1026

4 years agofluiddec: Avoid deprecated fluid_synth_set_sample_rate
Jan Alexander Steffens (heftig) [Wed, 5 Feb 2020 10:17:32 +0000 (11:17 +0100)]
fluiddec: Avoid deprecated fluid_synth_set_sample_rate

This function is used to change the rate at runtime, which has issues:
https://github.com/FluidSynth/fluidsynth/issues/585

Use the settings key instead (which already defaults to 44100, but I did
test other rates).

https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/merge_requests/1026

4 years agotsparse: Add split-on-rai property
Vivia Nikolaidou [Wed, 22 Jan 2020 14:20:28 +0000 (16:20 +0200)]
tsparse: Add split-on-rai property

If set, buffers sized smaller than the alignment will be sent so that
RAI packets are at the start of a new buffer.

Fixes: #1190

4 years agowebrtc: In all blocking pad probes except for sink pads also handle serialized events
Sebastian Dröge [Thu, 6 Feb 2020 12:29:13 +0000 (14:29 +0200)]
webrtc: In all blocking pad probes except for sink pads also handle serialized events

Otherwise it can happen that e.g. the stream-start event is tried to be
sent as part of pushing the first buffer. Downstream might not be in
PAUSED/PLAYING yet, so the event is rejected with GST_FLOW_FLUSHING and
because it's an event would not cause the blocking pad probe to trigger
first. This would then return GST_FLOW_FLUSHING for the buffer and shut
down all of upstream.

To solve this we return GST_PAD_PROBE_DROP for all events. In case of
sticky events they would be resent again later once we unblocked after
blocking on the buffer and everything works fine.

Don't handle events specifically in sink pad blocking pad probes as here
downstream is not linked yet and we are actually waiting for the
following CAPS event before unblocking can happen.

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

4 years agowebrtcbin: Add a blocking pad probe for the receivebin -> sctpdec connection
Sebastian Dröge [Thu, 6 Feb 2020 12:27:42 +0000 (14:27 +0200)]
webrtcbin: Add a blocking pad probe for the receivebin -> sctpdec connection

Without this it might happen that received data from the DTLS transport
is already passed to sctpdec before its state was set to PLAYING. This
would cause the data to be dropped, GST_FLOW_FLUSHING to be returned and
the whole DTLS transport to shut down.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1172
among other things.

4 years agowebrtcbin/transportreceivebin: Use actual pad blocks instead of an additional GCond...
Sebastian Dröge [Thu, 6 Feb 2020 12:24:41 +0000 (14:24 +0200)]
webrtcbin/transportreceivebin: Use actual pad blocks instead of an additional GCond for blocking pads

Using a GCond can easily lead to deadlocks and only duplicates the
waiting code from gstpad.c in the best case.

In this case it actually could lead to a deadlock if both RTP and RTCP
were waiting. Only one of them would be woken up because g_cond_signal()
was used instead of g_cond_broadcast().

4 years agowebrtc/transportsendbin: Clean up pad probe removal
Sebastian Dröge [Thu, 6 Feb 2020 12:22:17 +0000 (14:22 +0200)]
webrtc/transportsendbin: Clean up pad probe removal

We already have a helper function for this so just use it instead of
duplicating it.

4 years agomsdkvp9enc: output raw vp9 stream instead of IVF stream
Haihao Xiang [Wed, 15 Jan 2020 08:02:11 +0000 (16:02 +0800)]
msdkvp9enc: output raw vp9 stream instead of IVF stream

video/x-vp9 is required in the src pad, however the output includes a
IVF header, which makes the pipeline below doesn't work

  gst-launch-1.0 videotestsrc ! msdkvp9enc ! msdkvp9dec ! fakesink

Since mfx 1.26, the VP9 encoder supports bitstream without IVF header,
so in this patch, the mfx version is checked and msdkvp9enc is enabled
only if mfx 1.26+ is available

4 years agoandroidmedia: Support float i-frame-interval
Jan Schmidt [Thu, 30 Jan 2020 15:01:12 +0000 (02:01 +1100)]
androidmedia: Support float i-frame-interval

Android 25 added support for i-frame-interval to be a floating
point value. Store the property as a float and use the newer
version when it's available.

4 years agoandroidmedia: Allow dynamic bitrate changes on Android >= 19
Jan Schmidt [Thu, 30 Jan 2020 14:33:51 +0000 (01:33 +1100)]
androidmedia: Allow dynamic bitrate changes on Android >= 19

Android 19 added an API for dynamically changing the bitrate in a running
codec.

Also make it so that even when not update-able at runtime, parameters will at least
be stored so that they take effect the next the codec is restarted.

4 years agoandroidmedia: Handle force-keyunit requests
Jan Schmidt [Thu, 30 Jan 2020 14:21:34 +0000 (01:21 +1100)]
androidmedia: Handle force-keyunit requests

Use API from Android 19 to request a keyframe from the MediaCodec
when indicated by the base class.

4 years agoandroidmedia: Permit Codec surface to be NULL
Jan Schmidt [Wed, 5 Feb 2020 10:13:49 +0000 (21:13 +1100)]
androidmedia: Permit Codec surface to be NULL

The AMC encoder wrapper doesn't support input surfaces yet,
and passes NULL when configuring the underlying codec.

This was broken in commit 7fcf3e
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1102

4 years agoavtp: Build with clang
Ederson de Souza [Fri, 24 Jan 2020 18:58:32 +0000 (10:58 -0800)]
avtp: Build with clang

Minor non-conformity on AVTP code made it not compile with clang.

4 years agoavtp: Plug several leaks
Ederson de Souza [Fri, 24 Jan 2020 23:47:56 +0000 (15:47 -0800)]
avtp: Plug several leaks

After finally running tests with valgrind enabled, some leaks were found
- both on code and on tests themselves. This patch plugs them all!

4 years agogstcurlhttpsink: Update HTTP header for curl 7.66
Ludvig Rappe [Fri, 7 Feb 2020 13:24:53 +0000 (13:24 +0000)]
gstcurlhttpsink: Update HTTP header for curl 7.66

Change how content-length is set for HTTP POST headers, letting curl set
the header (given the content-length) instead of manually writing it.
This enables curl to know the content-length of the data.
In curl 7.66, if curl does not know the content-length (e.g. when
manually writing the header) curl will use Transfer-Encoding: chunked,
which might not be desired.

4 years agonvcodec: Fix crash in decoder on 32-bit Windows
Nirbheek Chauhan [Mon, 20 Jan 2020 09:52:26 +0000 (15:22 +0530)]
nvcodec: Fix crash in decoder on 32-bit Windows

Same fix as 1a7ea45ffde40a4bea63562a2cc9892396d9f7eb, but I didn't
test the decoder so I missed that the function pointers here weren't
using the correct calling convention too.

4 years agoladspa: only multiply bounded rate properties by sample rate
Tim-Philipp Müller [Wed, 5 Feb 2020 16:12:28 +0000 (16:12 +0000)]
ladspa: only multiply bounded rate properties by sample rate

We don't want to accidentally multiply G_MAXFLOAT or -GMAXFLOAT
with the sample rate.

4 years agoladspa: fix unbounded integer properties
Tim-Philipp Müller [Wed, 5 Feb 2020 16:03:06 +0000 (16:03 +0000)]
ladspa: fix unbounded integer properties

Use a double instead of a plain float for intermediary
property values, so we have enough bits to store INT_MAX
and it doesn't get rounded and wrapped to -1 when cast
back to a 32-bit integer.

Fixes criticals like

  g_param_spec_int: assertion 'default_value >= minimum && default_value <= maximum' failed

when loading LADSPA plugins from the Linux Studio Plugins
Project (http://lsp-plug.in) in GStreamer.

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

4 years agoavtpsink: Implement synchronization mechanism
Andre Guedes [Fri, 4 Oct 2019 18:39:10 +0000 (11:39 -0700)]
avtpsink: Implement synchronization mechanism

The avtpsink element is expected to transmit AVTPDUs at specific times,
according to GstBuffer timestamps. Currently, the transmission time is
controlled in software via the rendering synchronization mechanism
provided by GstBaseSink class. However, that mechanism may not cope with
some AVB use-cases such as Class A streams, where AVTPDUs are expected
to be transmitted at every 125 us. Thus, this patch introduces avtpsink
own mechanism which leverages the socket transmission scheduling
infrastructure introduced in Linux kernel 4.19.  When supported by the
NIC, the transmission scheduling is offloaded to the hardware, improving
transmission time accuracy considerably.

To illustrate that, a before-after experiment was carried out. The
experimental setup consisted in 2 PCs with Intel i210 card connected
back-to-back running an up-to-date Archlinux with kernel 5.3.1. In one
host gst-launch-1.0 was used to generate a 2-minute Class A stream while
the other host captured the packets. The metric under evaluation is the
transmission interval and it is measured by checking the 'time_delta'
information from ethernet frames captured at the receiving side.

The table below shows the outcome for a 48 kHz, 16-bit sample, stereo
audio stream. The unit is nanoseconds.

       |   Mean |   Stdev |     Min |     Max |   Range |
-------+--------+---------+---------+---------+---------+
Before | 125000 │    2401 │  110056 │  288432 │  178376 |
After  | 125000 │      18 │  124943 │  125055 │     112 |

Before this patch, the transmission interval mean is equal to the
optimal value (Class A stream -> 125 us interval), and it is kept the
same after the patch.  The dispersion measurements, however, had
improved considerably, meaning the system is now consistently
transmitting AVTPDUs at the correct time.

Finally, the socket transmission scheduling infrastructure requires the
system clock to be synchronized with PTP clock so this patches modifies
the AVTP plugin documentation to cover how to achieve that.

4 years agoavtpsink: Prepare code to new synchronization mechanism
Andre Guedes [Fri, 4 Oct 2019 18:17:22 +0000 (11:17 -0700)]
avtpsink: Prepare code to new synchronization mechanism

This patch refactors gst_avtp_sink_start() by moving all socket
initialization code to its own function. This change prepares the code
to the next patch which will introduce avtpsink's own rendering
synchronization mechanism.

4 years agoavtpsink: Remove SOCK_NONBLOCK from avtpsink
Andre Guedes [Fri, 4 Oct 2019 18:11:23 +0000 (11:11 -0700)]
avtpsink: Remove SOCK_NONBLOCK from avtpsink

Current avtpsink code opens the AF_PACKET socket with SOCK_NONBLOCK
option. However, we actually want sendto() to block in case there isn't
available space in socket buffer.

4 years agoavtp: Refactor if_index code
Andre Guedes [Fri, 4 Oct 2019 17:56:30 +0000 (10:56 -0700)]
avtp: Refactor if_index code

This patch refactors both avtpsink and avtpsrc code so we use the
if_nametoindex() helper instead of building a request and issuing an
ioctl to get the if_index.

4 years agod3d11window: Clear cached buffer per new caps
Seungha Yang [Wed, 5 Feb 2020 13:12:15 +0000 (22:12 +0900)]
d3d11window: Clear cached buffer per new caps

d3d11window holds one buffer to redraw client area per resize event.

When the input format is being changed, this buffer should be cleared
to avoid mismatch beween newly configured shader/videoprocessor and
the format of previously cached buffer.

4 years agonvdec: Don't leak template caps when registering elements with old NVIDIA driver
Sebastian Dröge [Tue, 4 Feb 2020 09:31:43 +0000 (11:31 +0200)]
nvdec: Don't leak template caps when registering elements with old NVIDIA driver

4 years agod3d11decoder: Use consistent resolution between output caps and video meta
Seungha Yang [Mon, 3 Feb 2020 13:23:21 +0000 (22:23 +0900)]
d3d11decoder: Use consistent resolution between output caps and video meta

h264/h265 decoded buffer might have crop area then we need to
adjust video meta based on the padding space

4 years agod3d11memory: Add a method to specify padding space
Seungha Yang [Mon, 3 Feb 2020 12:55:55 +0000 (21:55 +0900)]
d3d11memory: Add a method to specify padding space

4 years agod3d11decoder: Add support for zero-copy playback
Seungha Yang [Sat, 1 Feb 2020 08:38:29 +0000 (17:38 +0900)]
d3d11decoder: Add support for zero-copy playback

When downstream support d3d11 memory with forward playback case,
expose decoder output view memory objects without copying.

4 years agod3d11decoder: Create decoder output view whenever it's required
Seungha Yang [Mon, 3 Feb 2020 16:00:00 +0000 (01:00 +0900)]
d3d11decoder: Create decoder output view whenever it's required

Whatever the reason, buffer in pool might be freed then we need to
configure decoder output views again.

4 years agod3d11decoder: Need to zero initilized for g_once
Seungha Yang [Mon, 3 Feb 2020 15:55:24 +0000 (00:55 +0900)]
d3d11decoder: Need to zero initilized for g_once

A vairable to be used for g_once, it should be zero initialized

4 years agod3d11allocator: Work as if buffer pool when running on texture array mode
Seungha Yang [Thu, 30 Jan 2020 09:11:52 +0000 (18:11 +0900)]
d3d11allocator: Work as if buffer pool when running on texture array mode

Because the size of texture array cannot be updated dynamically,
allocator should block the allocation request. This cannot be
done at buffer pool side if this d3d11 memory is shared among
multiple buffer objects. Note that setting NO_SHARE flag to
d3d11 memory is very inefficient. It would cause most likey
copy of the d3d11 texture.

4 years agod3d11videosink: Fix fallback buffer copy
Seungha Yang [Thu, 30 Jan 2020 15:17:13 +0000 (00:17 +0900)]
d3d11videosink: Fix fallback buffer copy

Since we don't use dynamic texture now, cpu access to the fallback
texture should not happen.

4 years agod3d11window: Don't create swapchain again per caps change
Seungha Yang [Thu, 30 Jan 2020 12:12:31 +0000 (21:12 +0900)]
d3d11window: Don't create swapchain again per caps change

Creating swapchain is relatively heavy operation. If output dxgi format
is not being chagned, we don't need to destroy and create swachain again.

4 years agod3d11window: Invoke initial resize method from baseclass
Seungha Yang [Fri, 10 Jan 2020 12:45:43 +0000 (21:45 +0900)]
d3d11window: Invoke initial resize method from baseclass

... instead of calling from subclass in order for baseclass to handle
more things between swapchain creation and resource creation.