platform/upstream/gstreamer.git
5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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).

5 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.

5 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

5 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

5 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().

5 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.

5 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.

5 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

5 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.

5 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.

5 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.

5 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

5 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.

5 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

5 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()

5 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.

5 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.

5 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

5 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.

5 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

5 years agompegdemux: Parse mpeg audio layer version and add to caps.
Doug Nazar [Sat, 3 Aug 2019 09:28:33 +0000 (05:28 -0400)]
mpegdemux: Parse mpeg audio layer version and add to caps.

5 years agompegdemux: Finish setting up stream before adding pad.
Doug Nazar [Sat, 3 Aug 2019 09:21:29 +0000 (05:21 -0400)]
mpegdemux: Finish setting up stream before adding pad.

5 years agomsdkdec: no need to cache allocation_caps
Aaron Boxer [Fri, 26 Jul 2019 13:45:46 +0000 (07:45 -0600)]
msdkdec: no need to cache allocation_caps

5 years agovulkan: add a couple of headers to the install list
Matthew Waters [Mon, 5 Aug 2019 01:31:48 +0000 (11:31 +1000)]
vulkan: add a couple of headers to the install list

5 years agompeg4videoparse: allow sending config at IDR
Marc Leeman [Wed, 31 Jul 2019 18:03:19 +0000 (18:03 +0000)]
mpeg4videoparse: allow sending config at IDR

Based on h264parse, also allow to send the config at every IDR.

5 years agoconfigure: Update for nvcodec dependency change
Seungha Yang [Wed, 31 Jul 2019 03:12:18 +0000 (12:12 +0900)]
configure: Update for nvcodec dependency change

nvcodec is compilable without external dependency

5 years agonvdec: Fix build warning error
Seungha Yang [Wed, 31 Jul 2019 03:11:05 +0000 (12:11 +0900)]
nvdec: Fix build warning error

gstnvdec.c:1222:3: error: implicit declaration of function ‘memset’ [-Werror=implicit-function-declaration]
   memset (&type_info, 0, sizeof (type_info));
   ^~~~~~

5 years agobasetsmux: expose pcr-interval property
Mathieu Duponchelle [Tue, 30 Jul 2019 19:18:59 +0000 (21:18 +0200)]
basetsmux: expose pcr-interval property

Instead of using a static hardcoded PCR interval, allow the user
to configure it.

Also revert back the default to a 40 ms interval, that was changed
in recent patches for no good reason.

5 years agotests: x265enc: Add tiny resolution encoding check
Yeongjin Jeong [Wed, 31 Jul 2019 09:02:02 +0000 (18:02 +0900)]
tests: x265enc: Add tiny resolution encoding check

Add the tiny picture encoding test case allowed in x265

5 years agox265enc: Specify max CU size depending on input resolution
Yeongjin Jeong [Mon, 1 Jul 2019 09:14:55 +0000 (18:14 +0900)]
x265enc: Specify max CU size depending on input resolution

x265 does not allow user to configure a picture size smaller than
at least one CU size, and maxCUSize must be 16, 32, or 64.
Therefore, the CU size must be set according to the input resolution,
and the input resolution can not be less than 16.

5 years agoavtp: CVF - fix error message
Ederson de Souza [Tue, 23 Jul 2019 20:06:55 +0000 (13:06 -0700)]
avtp: CVF - fix error message

The error is about *not* being able to map a buffer.

5 years agoavtp: CVF - Do not infinite loop trying to fragment zero sized NAL unit
Ederson de Souza [Mon, 8 Jul 2019 21:19:07 +0000 (14:19 -0700)]
avtp: CVF - Do not infinite loop trying to fragment zero sized NAL unit

Zero sized NAL-units should not happen, but if they do, do not infinite
loop. Added also a unit test for this case.

5 years agoh265parser: Skip unused SEI bits differently
Jan Schmidt [Tue, 30 Jul 2019 14:38:44 +0000 (00:38 +1000)]
h265parser: Skip unused SEI bits differently

3-byte emulation bytes can confuse the current code that skips
bits at the end of an SEI. Use a simpler method that's also
quicker because it skips all remaining bits in one go instead
of 1 bit at a time.

5 years agoh265parse: Add support for compatible profiles of extensions
Seungha Yang [Sat, 20 Jul 2019 13:38:46 +0000 (22:38 +0900)]
h265parse: Add support for compatible profiles of extensions

From decoder's capability point of view as defined by the h265 specification,
accept peer profile caps.

5 years agonvenc: Fix build error with x86 msvc
Seungha Yang [Tue, 30 Jul 2019 10:07:42 +0000 (19:07 +0900)]
nvenc: Fix build error with x86 msvc

__stdcall is accepted or ignored by the compiler on x64 but x86
is not the case. So the function definition should be consistent
with declaration.

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

5 years agonvenc: Fix deadlock when pad_push return was not GST_FLOW_OK
Seungha Yang [Tue, 30 Jul 2019 08:49:25 +0000 (17:49 +0900)]
nvenc: Fix deadlock when pad_push return was not GST_FLOW_OK

Encoding thread is terminated without any notification so
upstream streaming thread is locked because there is nothing
to pop from GAsyncQueue. If downstream returns error,
we need put SHUTDOWN_COOKIE to GAsyncQueue for chain function
can wakeup.

5 years agonvcodec: Fix broken ABI in cuda stub header to fix nvenc with opengl
Seungha Yang [Tue, 30 Jul 2019 02:06:43 +0000 (11:06 +0900)]
nvcodec: Fix broken ABI in cuda stub header to fix nvenc with opengl

Fix the broken ABI introduced by the commit 367e742e5dd53400d212ce07d0ac0745f3535ac3
From CUDA Toolkit 3.2, size_t has been used in CUDA_MEMCPY2D structure
instead of unsigned int.

5 years agowebrtcbin: Support data channel SDP offers from Chrome
Jakub Adam [Wed, 12 Jun 2019 13:00:38 +0000 (15:00 +0200)]
webrtcbin: Support data channel SDP offers from Chrome

When negotiating a data channel, Chrome as recent as 75 still uses SDP
based on version 05 of the SCTP SDP draft, for example:

 m=application 9 DTLS/SCTP 5000
 a=sctpmap:5000 webrtc-datachannel 1024

Implement support for parsing SCTP port out of SDP message with sctpmap
attribute. Fixes data channel negotiation with Chrome browser.

5 years agoopenjpegdec: enable multi-threaded decode
Aaron Boxer [Sun, 28 Jul 2019 23:08:24 +0000 (19:08 -0400)]
openjpegdec: enable multi-threaded decode

5 years agoopenjpegdec: check return value when setting up decoder
Aaron Boxer [Sun, 28 Jul 2019 23:07:04 +0000 (19:07 -0400)]
openjpegdec: check return value when setting up decoder

5 years agoadaptivedemux: remove some deadlocks using webkitwebsrc.
Charlie Turner [Tue, 2 Jul 2019 11:27:40 +0000 (12:27 +0100)]
adaptivedemux: remove some deadlocks using webkitwebsrc.

WebKit's websrc depends on the main-thread for download completion
rendezvous. This exposed a number of deadlocks in adaptivedemux due to
it holding the MANIFEST_LOCK during network requests, and also needing
to hold it to change_state and resolve queries, which frequently occur
during these download windows.

Make demux->running MT-safe so that it can be accessed without using the
MANIFEST_LOCK. In case a source is downloading and requires a MT-thread
notification for completion of the fragment download, a state change
during this download window will deadlock unless we cancel the downloads
and ensure they are not restarted before we finish the state-change.

Also make demux->priv->have_manifest MT-safe. A duration query happening
in the window described above can deadlock for the same reason. Other
src queries (like SEEKING) that happen in this window also could
deadlock, but I haven't hit this scenario.

Increase granularity of API_LOCK'ing in change_state as well. We need to
cancel downloads before trying to take this lock, since sink events
(EOS) will hold it before starting a fragment download.

5 years agowebrtcbin: fix GInetAddress leak
Ilya Smelykh [Mon, 29 Jul 2019 07:56:16 +0000 (14:56 +0700)]
webrtcbin: fix GInetAddress leak

5 years agoopenjpeg: remove support for OpenJPEG 1.5
Aaron Boxer [Sun, 28 Jul 2019 18:19:36 +0000 (14:19 -0400)]
openjpeg: remove support for OpenJPEG 1.5

Also require OpenJPEG version >= 2.2

5 years agoav1enc: enable row-mt property conditionally
Wonchul Lee [Tue, 23 Jul 2019 13:26:19 +0000 (22:26 +0900)]
av1enc: enable row-mt property conditionally

The row based multi threading control was introduced after 1.0.0 version
of libaom released. It adds a guard to check the relevant control
definition declared. It fixes #1025

5 years agomsdk: enable 32 bit build on windows
Aaron Boxer [Wed, 24 Jul 2019 18:44:21 +0000 (12:44 -0600)]
msdk: enable 32 bit build on windows

5 years agoRevert "dtls: fix generated cert dtls agent leak"
Sebastian Dröge [Fri, 26 Jul 2019 06:35:53 +0000 (06:35 +0000)]
Revert "dtls: fix generated cert dtls agent leak"

This reverts commit e5585b1bde162bc038fd1265438edbcd94ccb5ed

5 years agonvdec: Make OpenGL dependency optional
Seungha Yang [Fri, 19 Jul 2019 13:46:01 +0000 (22:46 +0900)]
nvdec: Make OpenGL dependency optional

By adding system memory support for nvdec, both en/decoder
in the nvcodec plugin are able to be usable regardless of
OpenGL dependency. Besides, the direct use of system memory
might have less overhead than OpenGL memory depending on use cases.
(e.g., transcoding using S/W encoder)

5 years agotimecodestamper: Validate LTC timestamps before trying to use them
Sebastian Dröge [Thu, 25 Jul 2019 15:27:30 +0000 (18:27 +0300)]
timecodestamper: Validate LTC timestamps before trying to use them

There's no point in working with invalid LTC timestamps as all future
calculations will be wrong based on this, and invalid LTC timestamps can
sometimes be read via the audio input.

5 years agodtls: fix generated cert dtls agent leak
Ilya Smelykh [Thu, 25 Jul 2019 13:03:02 +0000 (20:03 +0700)]
dtls: fix generated cert dtls agent leak

The generated certificate dtls agent was refed two times on the first call.

5 years agodtls: fix dtls connection object leak
Ilya Smelykh [Thu, 25 Jul 2019 10:00:14 +0000 (10:00 +0000)]
dtls: fix dtls connection object leak

5 years agodecklink: Make sure to return a value from all code paths
Sebastian Dröge [Mon, 22 Jul 2019 16:10:15 +0000 (19:10 +0300)]
decklink: Make sure to return a value from all code paths

False warning from MSVC, or it does not understand that
g_assert_not_reached() does not return.

...\gst-plugins-bad-1.0-1.17.0.1\sys\decklink\gstdecklink.cpp(1647) : warning C4715: 'gst_decklink_configure_duplex_mode': not all control paths return a value

5 years agodecklinksrc: Reset timestamp observations on format change
Sebastian Dröge [Mon, 22 Jul 2019 14:57:01 +0000 (17:57 +0300)]
decklinksrc: Reset timestamp observations on format change

We will usually get timestamps starting from 0 again and due to the
format change the clock of the input might also be different.

5 years agonvcodec: Clean up pointless return values around plugin init
Seungha Yang [Thu, 25 Jul 2019 07:45:21 +0000 (16:45 +0900)]
nvcodec: Clean up pointless return values around plugin init

Any plugin which returned FALSE from plugin_init will be blacklisted
so the plugin will be unusable even if an user install required runtime
dependency next time. So that's the reason why nvcodec returns TRUE always.

This commit is to remove possible misreading code.

5 years agonvcodec: Change log level for g_module_open failure
Seungha Yang [Wed, 24 Jul 2019 04:06:16 +0000 (13:06 +0900)]
nvcodec: Change log level for g_module_open failure

Since we build nvcodec plugin without external CUDA dependency,
CUDA and en/decoder library loading failure can be natural behavior.

Emit error only when the module was opend but required symbols are missing.

5 years agonvdec: Add support for 10bits 4:2:0 decoding
Seungha Yang [Wed, 24 Jul 2019 01:00:56 +0000 (10:00 +0900)]
nvdec: Add support for 10bits 4:2:0 decoding

This commit includes h265 main-10 profile support if the device can
decode it.

Note that since h264 10bits decoding is not supported by nvidia GPU for now,
the additional code path for h264 high-10 profile is a preparation for
the future Nvidia's enhancement.

5 years agonvdec: Specify supported profiles of h264/h265 codec
Seungha Yang [Wed, 24 Jul 2019 09:06:41 +0000 (18:06 +0900)]
nvdec: Specify supported profiles of h264/h265 codec

See more details about supported formats at
nvidia codec sdk document "NVDEC_VideoDecoder_API_ProgGuide.pdf"
Table 1. Hardware Video Decoder Capabilities.

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

5 years agonvdec: Skip draining before creating internal parser
Seungha Yang [Wed, 24 Jul 2019 11:38:58 +0000 (20:38 +0900)]
nvdec: Skip draining before creating internal parser

GstVideoDecoder::drain/flush can be called at very initial state
with stream-start and flush-stop event, respectively.
Draning with NULL CUvideoparser seems to unsafe and that eventually
failed to handle it.

5 years agodash: Fallback to libxml2 subproject
Xavier Claessens [Wed, 24 Jul 2019 18:37:40 +0000 (14:37 -0400)]
dash: Fallback to libxml2 subproject

5 years agomsdkdec: improve spelling and grammar of comments
Aaron Boxer [Tue, 23 Jul 2019 17:47:44 +0000 (13:47 -0400)]
msdkdec: improve spelling and grammar of comments

5 years agomsdkdec: make sure mfx frame width/height meets MSDK's requirement
Haihao Xiang [Tue, 23 Jul 2019 05:16:36 +0000 (13:16 +0800)]
msdkdec: make sure mfx frame width/height meets MSDK's requirement

It is possible that the output region size (e.g. 192x144) is different
from the coded picture size (e.g. 192x256). We may adjust the alignment
parameters so that the padding is respected in GstVideoInfo and use
GstVideoInfo to calculate mfx frame width and height

This fixes the error below when decoding a stream which has different
output region size and coded picture size

0:00:00.057726900 28634 0x55df6c3220a0 ERROR                msdkdec
gstmsdkdec.c:1065:gst_msdkdec_handle_frame:<msdkh265dec0>
DecodeFrameAsync failed (failed to allocate memory)

Sample pipeline:

gst-launch-1.0 filesrc location=output.h265 ! h265parse ! msdkh265dec !
glimagesink

5 years agomsdkdec: remove unneeded code
Haihao Xiang [Tue, 23 Jul 2019 05:28:17 +0000 (13:28 +0800)]
msdkdec: remove unneeded code

Before calling gst_msdkdec_create_buffer_pool, the alignment parameters
have been adjusted.

5 years agonvcodec: Drop system installed cuda.h dependency
Seungha Yang [Tue, 23 Jul 2019 00:40:24 +0000 (09:40 +0900)]
nvcodec: Drop system installed cuda.h dependency

... and add our stub cuda header.

Newly introduced stub cuda.h file is defining minimal types in order to
build nvcodec plugin without system installed CUDA toolkit dependency.
This will make cross-compile possible.

5 years agonvcodec: Keep requested rank for default device
Seungha Yang [Tue, 23 Jul 2019 01:24:10 +0000 (10:24 +0900)]
nvcodec: Keep requested rank for default device

Fix for default encoder and decoder element factory to make them have
higher rank than the others.

5 years agonvenc: Register elements per GPU device with capability check
Seungha Yang [Tue, 9 Jul 2019 04:31:27 +0000 (13:31 +0900)]
nvenc: Register elements per GPU device with capability check

* By this commit, if there are more than one device,
nvenc element factory will be created per
device like nvh264device{device-id}enc and nvh265device{device-id}enc
in addition to nvh264enc and nvh265enc, so that the element factory
can expose the exact capability of the device for the codec.

* Each element factory will have fixed cuda-device-id
which is determined during plugin initialization
depending on the capability of corresponding device.
(e.g., when only the second device can encode h265 among two GPU,
then nvh265enc will choose "1" (zero-based numbering)
as it's target cuda-device-id. As we have element factory
per GPU device, "cuda-device-id" property is changed to read-only.

* nvh265enc gains ability to encoding
4:4:4 8bits, 4:2:0 10 bits formats and up to 8K resolution
depending on device capability.
Additionally, I420 GLMemory input is supported by nvenc.

5 years agonvdec: Create CUDA context with registered device id
Seungha Yang [Sun, 21 Jul 2019 12:23:30 +0000 (21:23 +0900)]
nvdec: Create CUDA context with registered device id

Only the default device has been used by NVDEC so far.
This commit make it possible to use registered device id.
To simplify device id selection, GstNvDecCudaContext usage is removed.

5 years agonvdec: Register elements per device/codec with capability check
Seungha Yang [Thu, 11 Jul 2019 12:53:46 +0000 (21:53 +0900)]
nvdec: Register elements per device/codec with capability check

By this commit, each codec has its own element factory so the
nvdec element factory is removed. Also, if there are more than one device,
additional nvdec element factory will be created per
device like nvh264device{device-id}dec, so that the element factory
can expose the exact capability of the device for the codec.

5 years agomsdk: Do not expose DMA buffer caps feature on Windows
Seungha Yang [Thu, 18 Jul 2019 09:27:55 +0000 (18:27 +0900)]
msdk: Do not expose DMA buffer caps feature on Windows

On Windows, DMA buffer is not supported. PadTemplate with actually
supported feature seems to more make sense.

5 years agonvcodec: Drop cudaGL.h dependency
Seungha Yang [Mon, 22 Jul 2019 14:01:43 +0000 (23:01 +0900)]
nvcodec: Drop cudaGL.h dependency

nvcodec does not use any type/define/enum in cudaGL.h.

5 years agoav1enc: Also set AV1E_SET_ROW_MT from the property value when initializing the encoder
Sebastian Dröge [Mon, 22 Jul 2019 09:23:51 +0000 (12:23 +0300)]
av1enc: Also set AV1E_SET_ROW_MT from the property value when initializing the encoder

Previously it was only set if the property was changed after the encoder
was initialized.

5 years agoav1enc: Add threads and row-mt properties
Wonchul Lee [Sun, 2 Dec 2018 13:49:19 +0000 (22:49 +0900)]
av1enc: Add threads and row-mt properties

Add threads related property that setting a number of threads to encode
av1 codec and row-mt configuration.

5 years agoav1enc: Release lock when failing to initialize
Wonchul Lee [Sun, 2 Dec 2018 12:45:50 +0000 (21:45 +0900)]
av1enc: Release lock when failing to initialize

Add to missing unlock when failing to initialize encoder.

5 years agoRevert "av1enc: Release lock when failing to initialize"
Sebastian Dröge [Mon, 22 Jul 2019 08:23:22 +0000 (11:23 +0300)]
Revert "av1enc: Release lock when failing to initialize"

This reverts commit 7de6b5d48161cb4982efe7fd04c8be408ca85424.

It was accidentally squashed together from the MR instead of keeping the
individual commits.

5 years agosiren: fix a global buffer overflow spotted by asan
Fabrice Bellet [Mon, 22 Jul 2019 08:00:00 +0000 (08:00 +0000)]
siren: fix a global buffer overflow spotted by asan

This patch just enforces boudaries for the access to the
standard_deviation array (64 floats). Such case can be
seen with a corrupted stream, where there's no hope to
obtain a valid decoded frame anyway.

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

5 years agoav1enc: Release lock when failing to initialize
Wonchul Lee [Mon, 22 Jul 2019 06:59:48 +0000 (06:59 +0000)]
av1enc: Release lock when failing to initialize

Add to missing unlock when failing to initialize encoder.

5 years agonvdec: Fix video stuttering issue with VP9
Seungha Yang [Thu, 18 Jul 2019 16:07:38 +0000 (01:07 +0900)]
nvdec: Fix video stuttering issue with VP9

Address nvidia driver specific behavior to avoid unexpected frame mismatch
between GStreamer and NVDEC.

5 years agonvdec: Drop async queue and handle data on callback of CUvideoparser
Seungha Yang [Thu, 18 Jul 2019 15:52:59 +0000 (00:52 +0900)]
nvdec: Drop async queue and handle data on callback of CUvideoparser

Callbacks of CUvideoparser is called on the streaming thread.
So the use of async queue has no benefit.

Make control flow straightforward instead of long while/switch loop.

5 years agortponviftimestamp: fix setting of the discontinuity flag
Mathieu Duponchelle [Fri, 12 Jul 2019 18:24:10 +0000 (20:24 +0200)]
rtponviftimestamp: fix setting of the discontinuity flag

The D bit is meant to be set whenever there is a discontinuity
in transmission, and directly maps to the DISCONT flag.

The E bit is not meant to be set on every buffer preceding a
discontinuity, but only on the last buffer of a contiguous section
of recording. This has to be signaled through the unfortunately-named
"discont" field of the custom NtpOffset event.

5 years agortponvifparse: set ONVIF timestamps as buffer PTS
Mathieu Duponchelle [Fri, 12 Jul 2019 18:23:24 +0000 (20:23 +0200)]
rtponvifparse: set ONVIF timestamps as buffer PTS

5 years agoh26{4,5}parse: add support for forward predicted trick mode
Mathieu Duponchelle [Wed, 10 Jul 2019 21:40:36 +0000 (23:40 +0200)]
h26{4,5}parse: add support for forward predicted trick mode

Also stop assigning TRUE to fields with |=

5 years agox265enc: Specify colorimetry related VUI parameters
Seungha Yang [Wed, 17 Jul 2019 13:42:10 +0000 (22:42 +0900)]
x265enc: Specify colorimetry related VUI parameters

Set the colorimetry config for the information to be embedded in encodec bitstream.

5 years agonvdec: Port to color_{primaries,transfer,matrix}_to_iso
Seungha Yang [Mon, 15 Jul 2019 14:40:21 +0000 (23:40 +0900)]
nvdec: Port to color_{primaries,transfer,matrix}_to_iso

... and update the color information only when upstream was not provided
the information.

5 years agonvenc: Specify colorimetry related VUI parameters
Seungha Yang [Wed, 17 Jul 2019 00:35:35 +0000 (09:35 +0900)]
nvenc: Specify colorimetry related VUI parameters

Set the colorimetry config for the information to be embedded in encodec bitstream.

5 years agowebrtcdatachannel: inherit directly from GObject
Mathieu Duponchelle [Tue, 16 Jul 2019 21:30:07 +0000 (23:30 +0200)]
webrtcdatachannel: inherit directly from GObject

There's no reason for it to inherit from GstObject apart from
locking, which is easily replaced, and inheriting from
GInitiallyUnowned made introspection awkward and needlessly
complicated.

5 years agoh264parse: Update caps per pixel aspect ratio change
Seungha Yang [Tue, 16 Jul 2019 15:13:24 +0000 (00:13 +0900)]
h264parse: Update caps per pixel aspect ratio change

Output caps should be updated per pixel aspect ratio change.

5 years agoh265parse: Expose parsed colorimetry when VUI provided it
Seungha Yang [Tue, 16 Jul 2019 13:58:26 +0000 (22:58 +0900)]
h265parse: Expose parsed colorimetry when VUI provided it

... and also if upstream did not specify the colorimetry.

5 years agoh264parse: Expose parsed colorimetry when VUI provided it
Seungha Yang [Tue, 16 Jul 2019 00:40:01 +0000 (09:40 +0900)]
h264parse: Expose parsed colorimetry when VUI provided it

... and also if upstream did not specify the colorimetry.

5 years agokmssink: Fix implicit declaration build error
Seungha Yang [Tue, 16 Jul 2019 16:05:32 +0000 (01:05 +0900)]
kmssink: Fix implicit declaration build error

ffs() and strcmp() require string.h

gstkmssink.c:255:28: error: implicit declaration of function ‘ffs’ [-Werror=implicit-function-declaration]
       crtc_id = res->crtcs[ffs (crtcs_for_connector) - 1];
                            ^~~

gstkmssink.c:590:10: error: implicit declaration of function ‘strcmp’ [-Werror=implicit-function-declaration]
     if (!strcmp (property->name, prop_name)) {
          ^~~~~~

5 years agoFix -Werror=return-type error in configure.
Martin Liska [Mon, 15 Jul 2019 14:05:05 +0000 (16:05 +0200)]
Fix -Werror=return-type error in configure.

5 years agoaiff: Fix infinite loop in header parsing.
Martin Theriault [Mon, 15 Jul 2019 19:48:08 +0000 (15:48 -0400)]
aiff: Fix infinite loop in header parsing.

5 years agodecklinkvideosrc: Don't report that we have signal until we know for sure
Sebastian Dröge [Mon, 15 Jul 2019 09:06:25 +0000 (12:06 +0300)]
decklinkvideosrc: Don't report that we have signal until we know for sure

Previously we would've reported that there is signal unless we know for
sure that we don't have signal. For example signal would've been
reported before the device is even opened.

Now keep track whether the signal state is unknown or not and report no
signal if we don't know yet. As before, only send an INFO message about
signal recovery if we actually had a signal loss before.

5 years agoavwait: In running-time mode, select start/end running time based on the actual video...
Sebastian Dröge [Fri, 12 Jul 2019 09:53:09 +0000 (12:53 +0300)]
avwait: In running-time mode, select start/end running time based on the actual video timestamps

Otherwise we would start/end at exactly the given times, which might be
up to 1 frame earlier/later than the video.

5 years agoavwait: Add some more debug output
Sebastian Dröge [Fri, 12 Jul 2019 09:29:09 +0000 (12:29 +0300)]
avwait: Add some more debug output

5 years agoavwait: Fix clipping of audio buffers at the start of recording
Sebastian Dröge [Fri, 12 Jul 2019 09:28:59 +0000 (12:28 +0300)]
avwait: Fix clipping of audio buffers at the start of recording