platform/upstream/gstreamer.git
4 years agomsdkvpp: support video-direction property
Haihao Xiang [Fri, 23 Aug 2019 01:51:20 +0000 (09:51 +0800)]
msdkvpp: support video-direction property

video-direction property is common property in gstreamer. In addition,
both mirroring & rotation properties are marked as deprecated,
video-direction will override mirroring & rotation properties when they
are set explicitly

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

4 years agomsdkdec: Fix buffer allocation based on frame.
Yan Wang [Wed, 21 Aug 2019 08:44:39 +0000 (16:44 +0800)]
msdkdec: Fix buffer allocation based on frame.

gst_msdkdec_finish_task() may release all frames in
GstVideoDecoder object. In this case, allocate_output_buffer()
cannot get the oldest frame to allocate buffer.
So gst_msdkdec_handle_frame() should return GST_FLOW_OK for
letting gst_video_decoder_decode_frame() to send a new frame
for decoding.

Fixes #664.
Fixes #665.

4 years agowaylandsink: Fix return type of prototype of show_frame()
Shinya Saito [Thu, 8 Aug 2019 02:54:45 +0000 (11:54 +0900)]
waylandsink: Fix return type of prototype of show_frame()

4 years agomsdk: Don't use VA_RT_FORMAT_YUV420_10 if it's undefined
Yeongjin Jeong [Sat, 24 Aug 2019 03:18:20 +0000 (12:18 +0900)]
msdk: Don't use VA_RT_FORMAT_YUV420_10 if it's undefined

../sys/msdk/gstmsdkallocator_libva.c:99:16: error: ‘VA_RT_FORMAT_YUV420_10’

The minimum required version seems to VA_API_VERSION >= 1.2.0

4 years agodocstrings: port ulinks to markdown links
Mathieu Duponchelle [Fri, 23 Aug 2019 17:56:35 +0000 (19:56 +0200)]
docstrings: port ulinks to markdown links

4 years agodshowsrcwrapper: fix regression on device selection
gla [Tue, 20 Aug 2019 10:44:44 +0000 (12:44 +0200)]
dshowsrcwrapper: fix regression on device selection

Do not take device_name if a device has been specified. Do not take device_index into account if a device or a device name has been specified.

4 years agomeson: Don't generate doc cache when no plugins are enabled
Matthew Waters [Fri, 23 Aug 2019 07:08:20 +0000 (17:08 +1000)]
meson: Don't generate doc cache when no plugins are enabled

Fixes gst-build with -Dauto-features=disabled -Dbad=enabled

4 years agomsdk: vpp: rotate output frame
U. Artie Eoff [Wed, 21 Aug 2019 17:46:43 +0000 (10:46 -0700)]
msdk: vpp: rotate output frame

When vpp rotation is 90 or 270, the output frame
should be rotated, too.

Example:
  gst-launch-1.0 -vf videotestsrc \
   ! video/x-raw,width=720,height=480 \
   ! msdkvpp rotation=90 ! vaapisink

4 years agovulkandisplay: Also free the GSource
Matthew Waters [Thu, 22 Aug 2019 07:23:39 +0000 (17:23 +1000)]
vulkandisplay: Also free the GSource

NULL checking the main_context does not help as we've just destroyed the
GMainContext and set that field to NULL, not to mention it's unnecessary.

Fixes a leak of display's GSource.

4 years agovulkandisplay: free the list of windows on destruction
Matthew Waters [Thu, 22 Aug 2019 07:02:07 +0000 (17:02 +1000)]
vulkandisplay: free the list of windows on destruction

They may not have had an explicit removal from the subclass.

4 years agovulkan/fullscreenrender: free the attachment descriptions
Matthew Waters [Thu, 22 Aug 2019 04:57:02 +0000 (14:57 +1000)]
vulkan/fullscreenrender: free the attachment descriptions

Fixes a memory leak of the attachment descriptions we receive from the
subclass.

4 years agovulkandisplay: fix use-after-free with removal of window
Matthew Waters [Thu, 22 Aug 2019 04:55:40 +0000 (14:55 +1000)]
vulkandisplay: fix use-after-free with removal of window

g_list_delete_link() free()'s the list node so any access after that is
a use-after-free.

4 years agovulkan/xcb: display->windows is a list of allocated GWeakRef
Matthew Waters [Thu, 22 Aug 2019 04:54:30 +0000 (14:54 +1000)]
vulkan/xcb: display->windows is a list of allocated GWeakRef

Don't access them as plain GstVulkanWindow objects.

4 years agovulkanviewconvert: perform a renegotiation on multiview mode/flag property changes
Matthew Waters [Thu, 22 Aug 2019 01:48:11 +0000 (11:48 +1000)]
vulkanviewconvert: perform a renegotiation on multiview mode/flag property changes

Otherwise changing the output* properties have no effect until someone else
performs a renegotiation.

4 years agoshaders/view-convert: remove some debugging colours
Matthew Waters [Thu, 22 Aug 2019 01:47:29 +0000 (11:47 +1000)]
shaders/view-convert: remove some debugging colours

Fixes left and right output modes.

4 years agotsdemux: Limit the maximum PES payload size
Jan Schmidt [Fri, 28 Jun 2019 05:04:29 +0000 (15:04 +1000)]
tsdemux: Limit the maximum PES payload size

PES packets with size 0 are unbounded, and
could therefore overflow the 32-bit size
accumulator.

Add a 32MB limit, which is larger than
any PES packet should ever get. If one does,
then output a 32MB chunk and continue.

4 years agohlsdemux: Post error message if hlsdemux could not start decryption
Seungha Yang [Wed, 21 Aug 2019 14:47:45 +0000 (23:47 +0900)]
hlsdemux: Post error message if hlsdemux could not start decryption

_decrypt_start() failure will lead to decryption failure eventually
but catching it earlier if possible. The decrpytion start failure means
that the hls plugin was built without crypto library or crypto library
does not want to accept given key and IV.

4 years agohls: Make crypto dependency optional when hls-crypto is auto
Seungha Yang [Tue, 9 Apr 2019 11:07:05 +0000 (20:07 +0900)]
hls: Make crypto dependency optional when hls-crypto is auto

crypto libraries are not required for hlssink and hlssink2.
Also, hlsdemux with nonencrypted stream can work without crpyto.

Make an error only when users set "hls-crpyto" with non-auto option explicitly,
but no crpyto library was found.

4 years agonvdec: Always response QUERY_CONTEXT even if openGL is unavailable on the system
Seungha Yang [Sat, 17 Aug 2019 04:58:33 +0000 (13:58 +0900)]
nvdec: Always response QUERY_CONTEXT even if openGL is unavailable on the system

nvdec can response for the CUDA context type query regardless of openGL
availability.

4 years agoext/wayland: Define libdrm_dep in meson.build
Thomas Coldrick [Wed, 14 Aug 2019 10:24:19 +0000 (11:24 +0100)]
ext/wayland: Define libdrm_dep in meson.build

4 years agoamc: Print error when failing to register listener
Xavier Claessens [Fri, 16 Aug 2019 15:07:44 +0000 (11:07 -0400)]
amc: Print error when failing to register listener

4 years agoamc: Do not use g_log() for criticals
Xavier Claessens [Fri, 16 Aug 2019 15:01:05 +0000 (11:01 -0400)]
amc: Do not use g_log() for criticals

4 years agoamc: crop values are not mandatory in format
Xavier Claessens [Wed, 15 May 2019 14:16:33 +0000 (10:16 -0400)]
amc: crop values are not mandatory in format

Android documentation has example code how to compute width and height
when crop values are present.
https://developer.android.com/reference/android/media/MediaCodec#accessing-raw-video-bytebuffers-on-older-devices

4 years agoamc: Remove unused gst_amc_surface_texture_set_default_buffer_size()
Xavier Claessens [Fri, 26 Apr 2019 15:03:26 +0000 (11:03 -0400)]
amc: Remove unused gst_amc_surface_texture_set_default_buffer_size()

4 years agoamc: Fix matrix constness in _get_transform_matrix()
Xavier Claessens [Thu, 25 Apr 2019 18:50:43 +0000 (14:50 -0400)]
amc: Fix matrix constness in _get_transform_matrix()

4 years agoamc: Select between encoder/decoder at GstAmcCodec construct time
Xavier Claessens [Tue, 26 Mar 2019 15:24:58 +0000 (11:24 -0400)]
amc: Select between encoder/decoder at GstAmcCodec construct time

Magical 0/1 values where passed to gst_amc_codec_configure() flags
argument. It's more natural to have a boolean is gst_amc_codec_new().

4 years agoamc: Remove gst_amc_format_contains_key()
Xavier Claessens [Tue, 13 Nov 2018 18:16:34 +0000 (13:16 -0500)]
amc: Remove gst_amc_format_contains_key()

It is not needed, we can just try to get the key and ignore error.
NdkMediaFormat doesn't have that method.

4 years agoamc: Turn GstAmcSurfaceTexture into a base class with JNI implementation
Xavier Claessens [Mon, 12 Nov 2018 19:02:37 +0000 (14:02 -0500)]
amc: Turn GstAmcSurfaceTexture into a base class with JNI implementation

4 years agoamc: Create JNI wrapper for MediaCodecList
Xavier Claessens [Sun, 11 Nov 2018 13:51:04 +0000 (08:51 -0500)]
amc: Create JNI wrapper for MediaCodecList

There is no NdkMediaCodecList API yet, but it is still better to isolate
JNI code. This will facilitate porting to a native API if Google ever
release one.

4 years agoamc: Move MediaCodec JNI wrapper into its own module
Xavier Claessens [Sat, 10 Nov 2018 21:51:02 +0000 (16:51 -0500)]
amc: Move MediaCodec JNI wrapper into its own module

This will facilitate adding another implementation based on
NdkMediaCodec instead of JNI.

4 years agosctp: Fix crash on free() when using the MSVC binaries
Nirbheek Chauhan [Tue, 20 Aug 2019 08:51:17 +0000 (14:21 +0530)]
sctp: Fix crash on free() when using the MSVC binaries

On Windows, if libusrsctp and gstreamer are built with different
C runtimes (CRT), we cannot free memory allocated inside libusrsctp
with the `free()` function from gstreamer's CRT.

`usrsctp_freedumpbuffer()` simply calls `free()`, but because of the
way DLLs work on Windows, it will always call the free function from
the correct CRT.

4 years agoh264parse: don't critical on VUI parameters > 2^31
Matthew Waters [Wed, 14 Aug 2019 12:08:34 +0000 (22:08 +1000)]
h264parse: don't critical on VUI parameters > 2^31

A guint32 greater than 2^31 would be interpreted as negative by
gst_util_uint64_scale_int() and critical. Use the 64-bit integer version
of the function instead.

4 years agonvdec: Fix possible null object unref
Seungha Yang [Tue, 13 Aug 2019 01:07:38 +0000 (10:07 +0900)]
nvdec: Fix possible null object unref

gst_query_get_n_allocation_pools > 0 does not guarantee that
the N th internal array has GstBufferPool object. So users should
check the returned GstBufferPool object from
gst_query_parse_nth_allocation_pool.

4 years agonvcodec: Use default flag for CUDA stream creation
Seungha Yang [Mon, 19 Aug 2019 04:22:20 +0000 (13:22 +0900)]
nvcodec: Use default flag for CUDA stream creation

Since nvdec/nvenc engine is running on default stream,
non-default CUDA stream should be synchronized with default
stream eventually.

4 years agoh26[45]parser: Fix emulation prevention byte detection
Wangfei [Thu, 15 Aug 2019 02:58:01 +0000 (10:58 +0800)]
h26[45]parser: Fix emulation prevention byte detection

Add a separate epb_cache variable to the codecparser NalReader to
detect Emulation Prevention Bytes separately from the main bit cache.

This fixes problems where the existing logic can mistakenly detect
multiple EPB with a sequence like: 0x00 0x00 0x03 0x00 0x03. In that
case, the 5th byte should not be regarded as an EPB.

4 years agonvenc: Use non default CUDA stream and async operation
Seungha Yang [Sun, 18 Aug 2019 13:51:18 +0000 (22:51 +0900)]
nvenc: Use non default CUDA stream and async operation

Use CUDA async operation if possible with non default CUDA stream

4 years agonvdec: Don't use default CUDA stream
Seungha Yang [Sun, 18 Aug 2019 13:07:38 +0000 (22:07 +0900)]
nvdec: Don't use default CUDA stream

Async CUDA operation with default stream (NULL CUstream) is not much
beneficial than blocking operation since all CUDA operations which belong
to the CUDA context will be synchronized with the default stream's operation.
Note that CUDA stream will share all resources of the corresponding CUDA context
but which can help parallel operation similar to the relation between thread and process

4 years agonvdec: Push/Pop CUDA context around library API call
Seungha Yang [Sun, 18 Aug 2019 13:14:37 +0000 (22:14 +0900)]
nvdec: Push/Pop CUDA context around library API call

4 years agonvdec: Fix timestamp mismatch on draining frames
Seungha Yang [Sun, 18 Aug 2019 06:45:37 +0000 (15:45 +0900)]
nvdec: Fix timestamp mismatch on draining frames

The internal decoding state must be GST_NVDEC_STATE_PARSE before
calling CuvidParseVideoData(). Otherwise, nvdec will be confused
on decode callback as if the frame is decoding only frame and
the input timestamp of corresponding frame will be ignored.
Eventually one decoded frame will have non-increased PTS.

4 years agotsdemux: do not error if buffer size is invalid due to DISCONT
Aaron Boxer [Thu, 8 Aug 2019 20:54:32 +0000 (16:54 -0400)]
tsdemux: do not error if buffer size is invalid due to DISCONT

Don't signal a pipeline error when processing incomplete
j2pk PES packets that are too small. That can happen normally
during a DISCONT and shouldn't shut down the whole pipeline

4 years agoiqa: fix leak of map_meta.data
Mathieu Duponchelle [Fri, 16 Aug 2019 13:22:26 +0000 (15:22 +0200)]
iqa: fix leak of map_meta.data

4 years agonvdec: Do not access nvdec object from destroy function of qdata
Seungha Yang [Fri, 16 Aug 2019 10:32:39 +0000 (19:32 +0900)]
nvdec: Do not access nvdec object from destroy function of qdata

The destroy callback can be called just before the fìnalization of
GstMiniObject. So the nvdec object might be destroyed already.
Instead, store the GstCudaContext with increased ref to safely
unregister the CUDA resource.

4 years agod3dvideosink: Fix crash on WinProc handler
Seungha Yang [Thu, 15 Aug 2019 08:49:12 +0000 (17:49 +0900)]
d3dvideosink: Fix crash on WinProc handler

... caused by null pointer dereference. The d3dvideosink object might
not available yet on the handler.

4 years agomeson: d3d11: Remove unnecessary dependency
Seungha Yang [Thu, 15 Aug 2019 07:31:01 +0000 (16:31 +0900)]
meson: d3d11: Remove unnecessary dependency

d3d11 never use any API of gstreamer-allocators-1.0

4 years agod3d11videosink: Take into account pixel aspect ratio
Seungha Yang [Thu, 15 Aug 2019 07:20:26 +0000 (16:20 +0900)]
d3d11videosink: Take into account pixel aspect ratio

Fix unexpected cropping with non 1:1 pixel aspect-ratio.

The actual buffer width/height should be passed to gst_d3d11_window_render(),
instead of the calculated resolution. The width/height
values are parameters for copying d3d11 video memory.
Also, aspect-ratio should be considered on resize callback
to decide render rectangle size.

4 years agocccombiner: Make use of new GstAggregator::negotiate()
Sebastian Dröge [Wed, 14 Aug 2019 07:13:52 +0000 (10:13 +0300)]
cccombiner: Make use of new GstAggregator::negotiate()

Simplifies the caps handling code considerably here and removes some
spurious negotiation.

4 years agoamc: Fix crash when a sync_meta survives its sink
Xavier Claessens [Wed, 14 Aug 2019 15:21:30 +0000 (11:21 -0400)]
amc: Fix crash when a sync_meta survives its sink

_amc_gl_free() could be called after the GstAmcVideoDec has been
finalized, in the case downstream still has a ref to a buffer.

4 years agopitch: Fix race between putSamples() and setting soundtouch parameters
Doug Nazar [Fri, 9 Aug 2019 06:41:51 +0000 (02:41 -0400)]
pitch: Fix race between putSamples() and setting soundtouch parameters

The various soundtouch set*() functions may cause buffer (re)allocations
which interferes with inputting the audio data.

4 years agovulkan/ios: keep track of surface changes
Matthew Waters [Fri, 9 Aug 2019 04:49:24 +0000 (14:49 +1000)]
vulkan/ios: keep track of surface changes

4 years agovulkan/ios: initialize the frame to the parent's
Matthew Waters [Tue, 6 Aug 2019 02:38:41 +0000 (12:38 +1000)]
vulkan/ios: initialize the frame to the parent's

4 years agoatscmux: fix AC-3 stream id
Mathieu Duponchelle [Tue, 13 Aug 2019 21:24:41 +0000 (23:24 +0200)]
atscmux: fix AC-3 stream id

According to ATSC A/52, Annex A, section 4.2:

The value of stream_id in the PES header shall be 0xBD
(indicating private_stream_1)

4 years agopcapparse: fix DISCONT flag setting
OleksandrKvl [Tue, 13 Aug 2019 14:50:33 +0000 (17:50 +0300)]
pcapparse: fix DISCONT flag setting

DISCONT flag should be set only for first packet.
Fixes #1047.

4 years agowebrtc: fix type of max-retransmits, make it work
David Gunzinger [Tue, 13 Aug 2019 10:10:54 +0000 (12:10 +0200)]
webrtc: fix type of max-retransmits, make it work

4 years agomxfdemux: Also allow picture essence element type 0x05 for VC-3
Sebastian Dröge [Mon, 12 Aug 2019 17:26:51 +0000 (20:26 +0300)]
mxfdemux: Also allow picture essence element type 0x05 for VC-3

It's found like this in various files out there even if it does not
conform to SMPTE 2019-4.

4 years agowasapi: fix symbol redefinition build error
Ignacio Casal Quinteiro [Tue, 6 Aug 2019 15:42:15 +0000 (17:42 +0200)]
wasapi: fix symbol redefinition build error

4 years agorist: Fix documentation
Olivier Crête [Wed, 31 Jul 2019 15:49:55 +0000 (11:49 -0400)]
rist: Fix documentation

4 years agorist: Document stats-internal unit
Olivier Crête [Tue, 30 Jul 2019 16:54:04 +0000 (12:54 -0400)]
rist: Document stats-internal unit

4 years agoristsink: Only accept RTCP APP packets with subtype==0
Olivier Crête [Fri, 26 Jul 2019 20:17:59 +0000 (16:17 -0400)]
ristsink: Only accept RTCP APP packets with subtype==0

4 years agorist: Fix typo in the documentation
Olivier Crête [Tue, 9 Jul 2019 20:50:43 +0000 (16:50 -0400)]
rist: Fix typo in the documentation

4 years agorist: Use the right parameters the signal
Olivier Crête [Tue, 9 Jul 2019 20:50:14 +0000 (16:50 -0400)]
rist: Use the right parameters the signal

4 years agox265enc: Enhance profile setting with fixing infinite loop condition
Seungha Yang [Fri, 9 Aug 2019 03:52:31 +0000 (12:52 +0900)]
x265enc: Enhance profile setting with fixing infinite loop condition

Don't fixate profile caps which will choose the first profile from list.
Instead, store all profiles allowed by peer and try them until x265 can
accept one of them.

4 years agox265enc: Fix deadlock on profile setting failure
Seungha Yang [Fri, 9 Aug 2019 03:03:34 +0000 (12:03 +0900)]
x265enc: Fix deadlock on profile setting failure

Don't miss unlock before returning

4 years agonvenc: Add support YV12 format
Seungha Yang [Fri, 9 Aug 2019 02:39:43 +0000 (11:39 +0900)]
nvenc: Add support YV12 format

YV12 format is supported by Nvidia NVENC without manual conversion.
So nvenc is exposing YV12 format at sinkpad template but there is some
missing point around uploading the memory to GPU.

4 years agortp: do not overrule RtpInfo when non dynamic type
Marc Leeman [Thu, 8 Aug 2019 18:47:05 +0000 (18:47 +0000)]
rtp: do not overrule RtpInfo when non dynamic type

When looking up the Rtp information, do not overwrite information
already found with encoding-name by static information.

4 years agonvh265enc: Enable HDR related SEI nal insertion
Seungha Yang [Thu, 8 Aug 2019 11:06:41 +0000 (20:06 +0900)]
nvh265enc: Enable HDR related SEI nal insertion

If upstream provides the HDR related information, create SEI message
nals and pass them to NVENC.

4 years agoh265parse: Fix mastering display info parsing
Seungha Yang [Thu, 8 Aug 2019 11:01:41 +0000 (20:01 +0900)]
h265parse: Fix mastering display info parsing

Fix mismatched Red Y coordinate value.

4 years agomsdkdec: fix decoding issue for interlaced streams
Fuwei Tang [Wed, 7 Aug 2019 20:54:38 +0000 (04:54 +0800)]
msdkdec: fix decoding issue for interlaced streams

Currently h264parser produces a field or a frame for
alignment=au for interlaced streams, but the flag
MFX_BITSTREAM_COMPLETE_FRAME needs a complete frame
or complementary field pair of data, this results in
broken images being output.

Some patches have been sent out to fix h264parser,
but they are pending on some unfinished work. In
order to make gstreamer-msdk decoding work properly
for interlaced streams before h264parser is fixed,
this flag will be removed temporarily and will be
added back once h264parser if fixed.

Related to:
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/merge_requests/399
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/merge_requests/228

4 years agonvh265enc: Add support YUV 444 10bits encoding
Seungha Yang [Tue, 6 Aug 2019 12:54:49 +0000 (21:54 +0900)]
nvh265enc: Add support YUV 444 10bits encoding

Note that h264 encoder does not support the YUV 444 10bits format

4 years agonvenc: Remove unnecessary constraint from YUV420 10bits capability decision
Seungha Yang [Tue, 6 Aug 2019 12:55:36 +0000 (21:55 +0900)]
nvenc: Remove unnecessary constraint from YUV420 10bits capability decision

YUV444 capability shouldn't be applied to YUV420 10 bits format

4 years agodecklinkvideosrc: Retrieve mode of the ancillary data from the frame
Sebastian Dröge [Wed, 7 Aug 2019 09:58:40 +0000 (12:58 +0300)]
decklinkvideosrc: Retrieve mode of the ancillary data from the frame

Instead of using the information we stored ourselves for the video frame
itself. Which was also the wrong one: it was the mode from the property,
not the autodetected one.

This fixes vanc extraction with mode=auto

4 years agodecklinkvideosrc: Also set the INTERLACED buffer flag on non-TFF buffers
Sebastian Dröge [Wed, 7 Aug 2019 09:58:03 +0000 (12:58 +0300)]
decklinkvideosrc: Also set the INTERLACED buffer flag on non-TFF buffers

4 years agomsdkdec: no need to cache output state info
Aaron Boxer [Mon, 22 Jul 2019 16:52:53 +0000 (12:52 -0400)]
msdkdec: no need to cache output state info

4 years agonvenc: Fix broken RGB format support
Seungha Yang [Wed, 7 Aug 2019 02:49:43 +0000 (11:49 +0900)]
nvenc: Fix broken RGB format support

Add missing format check introduced by the commit 7de4dbdeb27561c00be94f8666b39dc661c59f7b

4 years agotsdemux: always take the seek segment stop into account
Mathieu Duponchelle [Tue, 29 Jan 2019 20:57:44 +0000 (21:57 +0100)]
tsdemux: always take the seek segment stop into account

Even if an accurate seek was not requested, we should still
respect the seek stop.

4 years agotsdemux: Use gst_segment_do_seek()
Jan Schmidt [Wed, 19 Sep 2018 15:05:52 +0000 (01:05 +1000)]
tsdemux: Use gst_segment_do_seek()

Remove some custom and incomplete seek calculation
logic in favour of gst_segment_do_seek(), and
short-circuit any actual seeking or recalculation
if the position didn't change and just send an updated
segment directly.

This removes the custom seeking logic in favour of
using standard core seek handling.

4 years agompegtsdemux: Keep the position increasing.
Jan Schmidt [Wed, 19 Sep 2018 15:07:34 +0000 (01:07 +1000)]
mpegtsdemux: Keep the position increasing.

Don't keep the segment position jumping back and forth
based on stream DTS/PTS, only increase the position
if the new value is larger than the old.

4 years agompegts: Re-work segment tracking
Jan Schmidt [Fri, 31 Aug 2018 12:43:46 +0000 (22:43 +1000)]
mpegts: Re-work segment tracking

Add an output segment into the base class for sub-classes
to use for their output segment, in a place where the base
class can see it.

4 years agonvcodec: Wrap CUDA API return check with gst_cuda_result
Seungha Yang [Tue, 6 Aug 2019 04:50:28 +0000 (13:50 +0900)]
nvcodec: Wrap CUDA API return check with gst_cuda_result

The gst_cuda_result macro function is more helpful for debugging
than previous cuda_OK because gst_cuda_result prints the function
and line number. If the CUDA API return was not CUDA_SUCCESS,
gst_cuda_result will print WARNING level debug message with
error name, error text strings.

4 years agonvdec: Port to GstCUDAContext
Seungha Yang [Tue, 6 Aug 2019 04:44:20 +0000 (13:44 +0900)]
nvdec: Port to GstCUDAContext

... and drop CUvideoctxlock usage. The CUvideoctxlock basically
has the identical role of cuda context push/pop but nvdec specific
way. Since we can share the CUDA context among encoders and decoders,
use CUDA context directly for accessing GPU API.

4 years agonvenc: Port to GstCudaContext
Seungha Yang [Thu, 25 Jul 2019 10:33:54 +0000 (19:33 +0900)]
nvenc: Port to GstCudaContext

... and add support CUDA context sharing similar to glcontext sharing.
Multiple CUDA context per GPU is not the best practice. The context
sharing method is very similar to that of glcontext. The difference
is that there can be multiple context object on a pipeline since
the CUDA context is created per GPU id. For example, a pipeline
has nvh264dec (uses GPU #0) and nvh264device0dec (uses GPU #1),
then two CUDA context will propagated to all pipeline.

4 years agonvcodec: Introduce NVIDA CUDA helpers
Seungha Yang [Fri, 23 Nov 2018 13:01:41 +0000 (22:01 +0900)]
nvcodec: Introduce NVIDA CUDA helpers

New object and helper functions can remove duplicated code
from nvenc/nvdec. Also this is prework for CUDA device context sharing
among nvdec(s)/nvenc(s).

4 years agortponviftimestamp: add opt-out "drop-out-of-segment" property
Mathieu Duponchelle [Fri, 26 Jul 2019 01:27:22 +0000 (03:27 +0200)]
rtponviftimestamp: add opt-out "drop-out-of-segment" property

The default behaviour of rtponviftimestamp is to drop buffers
outside the segment. This creates obvious problems for reverse
playback.

The ONVIF specification unfortunately doesn't describe how to handle
that specific use case, but we can expose a property to let the
user disable the dropping behaviour, and forward these buffers with
a G_MAXUINT64 ONVIF timestamp.

Also modify rtponvifparse to handle such timestamps appropriately.

4 years agortponvifparse: parse E flag and send EOS when needed
Mathieu Duponchelle [Fri, 26 Jul 2019 01:26:25 +0000 (03:26 +0200)]
rtponvifparse: parse E flag and send EOS when needed

4 years agox265enc: Add support more 8/10/12 bits 4:2:0, 4:2:2 and 4:4:4 profiles
Seungha Yang [Fri, 21 Jun 2019 11:47:37 +0000 (20:47 +0900)]
x265enc: Add support more 8/10/12 bits 4:2:0, 4:2:2 and 4:4:4 profiles

... with multi-library interface support. Depending on bit depth support of
the linked library, run-time api switch can be made via multi-library interface.

See more detail about libx265 multi-library interface
https://x265.readthedocs.io/en/default/api.html#multi-library-interface

4 years agodecklinkaudiosrc/decklinkvideosrc: Do nothing in BaseSrc::negotiate() and always...
Sebastian Dröge [Tue, 6 Aug 2019 18:44:35 +0000 (21:44 +0300)]
decklinkaudiosrc/decklinkvideosrc: Do nothing in BaseSrc::negotiate() and always set caps in ::create()

We don't support negotiation with downstream but simply set caps based
on the buffers we receive. This prevents renegotiation to other formats,
and negotiation to NTSC in mode=auto in the beginning until the first
buffer is received.

As side-effect of this, also remove various other caps handling code
that was working around the behaviour of the default
BaseSrc::negotiate().

4 years agoerrorignore: Try pushing again after a caps event too
Sebastian Dröge [Tue, 6 Aug 2019 15:55:28 +0000 (18:55 +0300)]
errorignore: Try pushing again after a caps event too

It might have reconfigured everything correctly so that pushing buffers
works again afterwards, e.g. if the previous caps event was just
rejected.

4 years agotimecodestamper: Require a non-0/1 framerate on the pad templates
Sebastian Dröge [Tue, 6 Aug 2019 15:51:54 +0000 (18:51 +0300)]
timecodestamper: Require a non-0/1 framerate on the pad templates

We reject caps with other framerates as it's impossible to generate
timecodes unless we actually know a constant framerate. Reflect this
also in the pad template caps.

4 years agoavwait: Improve debug output a bit
Sebastian Dröge [Tue, 6 Aug 2019 13:38:08 +0000 (16:38 +0300)]
avwait: Improve debug output a bit

4 years agonvenc: Return profile compatible input formats from GstVideoEncoder::getcaps
Seungha Yang [Mon, 29 Jul 2019 04:52:04 +0000 (13:52 +0900)]
nvenc: Return profile compatible input formats from GstVideoEncoder::getcaps

Do not accept any input formats which could not be supported
by downstream requested codec profiles.

4 years agonvenc: Fix caps negotiation failure on unspecified interlace-mode
Seungha Yang [Fri, 26 Jul 2019 15:52:59 +0000 (00:52 +0900)]
nvenc: Fix caps negotiation failure on unspecified interlace-mode

During GstVideoInfo conversion from GstCaps, interlace-mode is
inferred to progressive so unspecified interlace-mode should not cause any
negotiation issue. Simly set GST_PAD_FLAG_ACCEPT_INTERSECT flag
on sinkpad to fix issue.

4 years agonvenc: Remove unused member variables
Seungha Yang [Fri, 26 Jul 2019 15:57:02 +0000 (00:57 +0900)]
nvenc: Remove unused member variables

Supported interlace-mode and codec profiles are checked
during plugin init and those values are never used.

4 years agotests: nvenc: Add test caps negotiation with interlace-mode field
Seungha Yang [Fri, 26 Jul 2019 15:41:17 +0000 (00:41 +0900)]
tests: nvenc: Add test caps negotiation with interlace-mode field

4 years agortptransceiver: Remove direction setter and vfunc and replace it by a property
Sebastian Dröge [Mon, 5 Aug 2019 16:45:05 +0000 (19:45 +0300)]
rtptransceiver: Remove direction setter and vfunc and replace it by a property

It was changed from a function to a property in the latest WebRTC spec.

4 years agomsdkdec: Update frame info from video parameters
Haihao Xiang [Thu, 25 Jul 2019 14:55:09 +0000 (22:55 +0800)]
msdkdec: Update frame info from video parameters

A 10bit stream may have different depth values for Luma and Chroma, and
MSDK requires the frame info must match the corresponding video
parameters

4 years agovulkan: Fix GstMemory leaks
Yeongjin Jeong [Fri, 2 Aug 2019 07:31:59 +0000 (16:31 +0900)]
vulkan: Fix GstMemory leaks

Allocated GstMemory should be freed with g_free()

4 years agoh264parse: fix issue that caps "interlace-mode" can't be updated correctly
Fuwei Tang [Sat, 3 Aug 2019 03:31:21 +0000 (11:31 +0800)]
h264parse: fix issue that caps "interlace-mode" can't be updated correctly

Upstream overrides the info "interlace-mode", otherwise update it with
SPS info.

4 years agonvdec: Respect upstream provided timestamp
Seungha Yang [Tue, 30 Jul 2019 14:49:09 +0000 (23:49 +0900)]
nvdec: Respect upstream provided timestamp

Decoder sometimes reports nonincreasing timestamp.
Use input frame's timestamp like other decoder elements.

4 years agonvenc: Add support RGB 8/10bits formats
Seungha Yang [Tue, 30 Jul 2019 04:15:32 +0000 (13:15 +0900)]
nvenc: Add support RGB 8/10bits formats

BGRA/RGBA/RGB10A2/BGR10A2 formats can be supported by nvenc.
Depending on device, supported format can be different.

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

4 years agonvdec: Use upstream framerate if possible
Seungha Yang [Tue, 30 Jul 2019 15:02:59 +0000 (00:02 +0900)]
nvdec: Use upstream framerate if possible

Encoded bitstream might not have valid framerate. If upstream
provided non-variable-framerate (i.e., fps_n > 0 and fps_d > 0)
use upstream framerate instead of parsed one.

4 years agonvenc: Fix crash with unspecified framerate
Seungha Yang [Tue, 30 Jul 2019 14:54:48 +0000 (23:54 +0900)]
nvenc: Fix crash with unspecified framerate

Nvidia driver seems to calculating floating point framerate
without validation. This causes crash both on linux and Windows.

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