Commit graph

23983 commits

Author SHA1 Message Date
Hyunjun Ko
72c6cd5545 msdkdec: use video memory if there's another MSDK context in a pipeline
1\ If downstream's pool is MSDK bufferpool,
2\ If there's shared GstMsdkContext in the pipeline,

a decoder decides to use video memory.

This policy should be improved to handle more cases.

https://bugzilla.gnome.org/show_bug.cgi?id=790752
2018-02-13 13:53:02 -09:00
Hyunjun Ko
375a50a876 msdk: add async depth from each msdk element to GstMsdkContext to be shared
In case that pipeline is like ".. ! decoder ! encoder ! ..." with using
video memory,
decoder needs to know the async depth of the following msdk element so
that it could
allocate the correct number of video memory.

Otherwise, decoder's memory is exhausted while processing.

https://bugzilla.gnome.org/show_bug.cgi?id=790752
2018-02-13 13:52:14 -09:00
Hyunjun Ko
f2b35abcab msdkdec/enc: query GstContext to share GstMsdkContext
How to share/create GstMsdkcontext is the following:

- Search GstMsdkContext if there's in the pipeline.
  - If found, check if it's decoder, encoder or vpp by job type.
    - If it's same job type, it creates another instance of
GstMsdkContext
     with joined-session.
    - Otherwise just use the shared GstMsdkContext.
  - If not found, just creates new instance of GstMsdkContext.

https://bugzilla.gnome.org/show_bug.cgi?id=790752
2018-02-13 13:51:18 -09:00
Hyunjun Ko
dc82ccb9a2 msdk: context: add job type to figure out if joining session is necessary
According to the driver's instruction, if there are two or more encoders
or decoders in a process, the session should be joined by
MFXJoinSession.

To achieve this successfully by GstContext, this patch adds job type
specified if it's encoder, decoder or vpp.

If a msdk element gets to know if joining session is needed by the
shared context,
it should create another instance of GstContext with joined session,
which
is not shared.

https://bugzilla.gnome.org/show_bug.cgi?id=790752
2018-02-13 13:50:48 -09:00
Hyunjun Ko
dddb84897f msdk: adds util functions to handle GstContext
To share GstMsdkContext with each msdk element,
it will be using GstContext.

Most common code is from gstreamer-vaapi.

https://bugzilla.gnome.org/show_bug.cgi?id=790752
2018-02-13 13:50:08 -09:00
Hyunjun Ko
a66d5620f3 msdkdec: use bufferpool
1\ In decide_allocation, it makes its own msdk bufferpool.
  - If downstream supports video meta, it just replace it with the msdk
bufferpool.
  - If not, it uses the msdk bufferpool as a side pool, which will be
decoded into.
    and will copy it to downstream's bufferpool.

2\ Decide if using video memory or system memory.
  - This is not completed in this patch.
  - It might be decided in update_src_caps.
  - But tested for both system memory and video memory cases.

https://bugzilla.gnome.org/show_bug.cgi?id=790752
2018-02-13 13:49:28 -09:00
Hyunjun Ko
580a52ec49 msdkenc: use bufferpool
1\ Proposes msdk bufferpool to upstream.
  - If upstream has accepted the proposed msdk bufferpool,
    encoder can get msdk surface from the buffer directly.
  - If not, encoder get msdk surface its own msdk bufferpool
    and copy from upstream's frame to the surface.

2\ Replace arrays of surfaces with msdk bufferpool.

3\ In case of using VPP, there should be another msdk bufferpool
   with NV12 info so that it could convert first and encode.

Calls gst_msdk_set_frame_allocator and uses video memory only on linux.
and uses system memory on Windows until d3d allocator is implemented.

https://bugzilla.gnome.org/show_bug.cgi?id=790752
2018-02-13 13:48:32 -09:00
Hyunjun Ko
2542b2d34d msdk: supports bufferpool
Implements 2 memory allocators:
1\ GstMsdkSystemAllocator: This will allocate system memory.
2\ GstMsdkVideoAllocator: This will allocate device memory depending
on the platform. (eg. VASurface)

Currently GstMsdkBufferPool uses video allocator currently by default
only on linux. On Windows, we should use system memory until d3d
allocator
is implemented.

https://bugzilla.gnome.org/show_bug.cgi?id=790752
2018-02-13 13:44:08 -09:00
Hyunjun Ko
4d860ec82b msdk: adds frame allocator using libva
Implements msdk frame allocator which is required from the driver.
Also makes these functions global so that GstMsdkAllocator could use
the allocated video memory later and couple with GstMsdkMemory.

GstMsdkContext keeps allocation information such as mfxFrameAllocRequest
and mfxFrameAllocResponse after allocation.

https://bugzilla.gnome.org/show_bug.cgi?id=790752
2018-02-13 12:43:42 -09:00
Hyunjun Ko
3ed9f7c5f1 msdkdec: fix typo
https://bugzilla.gnome.org/show_bug.cgi?id=790752
2018-02-13 12:43:00 -09:00
Hyunjun Ko
6ce9a66b80 msdk: implements GstMsdkContext.
Makes GstMsdkContext to be a descendant of GstObject so that
we could track the life-cycle of the session of the driver.

Also replaces MsdkContext with this one.
Keeps msdk_d3d.c alive for the future.

https://bugzilla.gnome.org/show_bug.cgi?id=790752
2018-02-13 12:41:28 -09:00
Hyunjun Ko
3f9d0fcaa9 msdk: libva: adds utility function between mfx and libva
https://bugzilla.gnome.org/show_bug.cgi?id=790752
2018-02-13 12:39:44 -09:00
Hyunjun Ko
b45147a6d4 msdk: adds new utility functions for conversion from gstreamer to libmfx
https://bugzilla.gnome.org/show_bug.cgi?id=790752
2018-02-13 12:37:47 -09:00
Hyunjun Ko
8f0450dad4 msdk: move and rename the function msdk_video_alignment
Move the msdk_video_alignment function from decoder
to msdk.c and rename so that others could call this function
without duplicated declaration.

https://bugzilla.gnome.org/show_bug.cgi?id=790752
2018-02-13 12:36:46 -09:00
Tim-Philipp Müller
5b1a968840 audioaggregator: remove, moved to -base
https://bugzilla.gnome.org/show_bug.cgi?id=791218
2018-02-13 14:12:09 +00:00
Tim-Philipp Müller
c180f8ffed audiomixer: remove, moved to -base
https://bugzilla.gnome.org/show_bug.cgi?id=791218
2018-02-13 00:37:35 +00:00
Tim-Philipp Müller
843f118523 proxy: remove unneeded object private structs
Plugin headers are not installed.

Also mark internal funcs as internal.
2018-02-12 19:35:19 +00:00
Tim-Philipp Müller
e9bfb4edc2 qt: remove plugin, moved to -good
https://bugzilla.gnome.org/show_bug.cgi?id=754094
2018-02-12 18:48:32 +00:00
Tim-Philipp Müller
743a325df0 configure: remove two more unneeded gtk conditionals 2018-02-12 15:44:00 +00:00
Tim-Philipp Müller
90a836bb89 gtk: remove, plugin has moved to -good 2018-02-12 15:16:37 +00:00
Carlos Rafael Giani
ec963e688f interaudio: Make sure both PTS and DTS values are defined
The inter plugin originated in 0.10, which had only one timestamp. As a
result, during the port to 1.0, the DTS were left undefined. This can cause
subtle bugs with basesrc, which can end up incorrectly picking DTS over PTS
and producing output buffers with incorrect timestamps.

https://bugzilla.gnome.org/show_bug.cgi?id=791347
2018-02-11 20:41:14 +00:00
Nirbheek Chauhan
8f61785485 wasapisrc: Re-align device period if necessary
Same changes as done for wasapisink in cbe2fc40a. Turns out this is
sometimes also needed for capture. Reported by Mathieu_Du.

Also improve logging in that case for easier debugging.
2018-02-09 02:09:04 +05:30
Tim-Philipp Müller
34276dc373 meson: make version numbers ints and fix int/string comparison
WARNING: Trying to compare values of different types (str, int).
The result of this is undefined and will become a hard error
in a future Meson release.
2018-02-08 19:13:35 +00:00
Víctor Manuel Jáquez Leal
8749c61e95 Revert "gdpdepay: don't use allocator if it has custom alloc"
This reverts commit f6cb16ab8c.
2018-02-08 11:15:46 +01:00
Nirbheek Chauhan
20a6dacf71 proxy: Fix plugin definition
I'm not sure how this was missed in review...
2018-02-08 15:19:12 +05:30
Nirbheek Chauhan
f6104ca38b proxy: Remove dead code from Makefile.am
There is no gstproxytest.c
2018-02-08 14:45:28 +05:30
Nirbheek Chauhan
9078a3a41d meson: Fix wasapi build on Windows
Was missing device prober and avrt (on msvc)
2018-02-08 14:41:33 +05:30
Nirbheek Chauhan
69b90224fa wasapi: Unprepare when src/sink_prepare fails
unprepare() is not called automatically on failure.

https://bugzilla.gnome.org/show_bug.cgi?id=793289
2018-02-08 14:30:38 +05:30
Nirbheek Chauhan
cbe2fc40a4 wasapisink: Re-align device period if necessary
Sometimes the minimum period advertised by a card results in an
unaligned buffer size error during initialization in exclusive mode.
In that case, we can fetch the actual buffer size in frames and
calculate the period from that.

We can't do this pre-emptively because we can't call GetBufferSize
till Initialize has been called at least once.

https://bugzilla.gnome.org/show_bug.cgi?id=793289
2018-02-08 14:29:58 +05:30
Nirbheek Chauhan
7f1d60da5b wasapisink: pre-load the buffer with silence
This reduces the chances of startup glitches, and also reduces the
chances that we'll get garbled output due to driver bugs.

Recommended by the WASAPI documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=793289
2018-02-08 14:29:58 +05:30
Nirbheek Chauhan
4dbca8df09 wasapi: Try to use latency-time and buffer-time
So far, we have been completely discarding the values of latency-time
and buffer-time and trying to always open the device in the lowest
latency mode possible. However, sometimes this is a bad idea:

1. When we want to save power/CPU and don't want low latency
2. When the lowest latency setting causes glitches
3. Other audio-driver bugs

Now we will try to follow the user-set values of latency-time and
buffer-time in shared mode, and only latency-time in exclusive mode (we
have no control over the hardware buffer size, and there is no use in
setting GstAudioRingBuffer size to something larger).

The elements will still try to open the devices in the lowest latency
mode possible if you set the "low-latency" property to "true".

https://bugzilla.gnome.org/show_bug.cgi?id=793289
2018-02-08 14:29:58 +05:30
Nirbheek Chauhan
624de04fdb wasapi: Cover more HRESULT error messages
This requires using allocated strings, but it's the best option. For
instance, a call could fail because CoInitialize() wasn't called, or
because some other thing in the stack failed.

https://bugzilla.gnome.org/show_bug.cgi?id=793289
2018-02-08 14:29:58 +05:30
Nirbheek Chauhan
62b6224e37 wasapi: Increase thread priority to reduce glitches
This is particularly important when running in exclusive mode because
any delays will immediately cause glitching.

The MinGW version in Cerbero is too old, so we can only enable this when
building with MSVC or when people build GStreamer for MSYS2 or other
MinGW-based distributions.

To force-enable this code when building with MinGW, build with
CFLAGS="-DGST_FORCE_WIN_AVRT -lavrt".

https://bugzilla.gnome.org/show_bug.cgi?id=793289
2018-02-08 12:04:20 +05:30
Nirbheek Chauhan
6ecbb7556a wasapi: Allow opening devices in exclusive mode
This provides much lower latency compared to opening in shared mode,
but it also means that the device cannot be opened by any other
application. The advantage is that the achievable latency is much
lower.

In shared mode, WASAPI's engine period is 10ms, and so that is the
lowest latency achievable.

In exclusive mode, the limit is the device period itself, which in my
testing with USB DACs, on-board PCI sound-cards, and HDMI cards is
between 2ms and 3.33ms.

We set our audioringbuffer limits to match the device, so the
achievable sink latency is 6-9ms. Further improvements can be made if
needed.

https://bugzilla.gnome.org/show_bug.cgi?id=793289
2018-02-08 12:04:20 +05:30
Nirbheek Chauhan
4b388814af wasapi: Rename struct element for device name
We will use ->device for storing a pointer to the IMMDevice structure
which is needed for fetching the caps supported by devices in
exclusive mode.

https://bugzilla.gnome.org/show_bug.cgi?id=793289
2018-02-08 12:04:20 +05:30
Nirbheek Chauhan
3f1e039007 wasapi: Fix indentation issues missed by the commit hook
These were missed because the relevant commits were made on Windows
where `indent` wasn't installed.
2018-02-08 11:46:01 +05:30
Matthew Waters
e5c4135e81 vulkanupload: actually loop over possible uploaders
Fix some funky control that wasn't working

CID #1417219
2018-02-08 16:55:43 +11:00
Matthew Waters
6f50d35246 webrtc: Fix ffeb09e4 conditional
Fixes ffeb09e4ab

if (sscanf(...)) {  // != 0
  error;
}

Is not correct where != 0 indicates some kind of success.

Check instead that the correct number of elements were slurped.
2018-02-08 15:51:35 +11:00
Matthew Waters
7e6b4dcb49 webrtc: change dead code to an assert
CID #1429140
2018-02-08 15:47:33 +11:00
Matthew Waters
4ef2a20a83 dtls: add meson definition for recently added test 2018-02-08 15:29:56 +11:00
Matthew Waters
ffeb09e4ab webrtc: bail on invalid rtpbin names
If we fail parsing rtpbin pad names, someone has screwed up so critical
and return.

CID #1429142
2018-02-08 15:29:56 +11:00
Nirbheek Chauhan
3f7e29d5b3 Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:

* Ease of use. Buffers, events, and caps are transmitted as-is without
  copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
  special-casing.
* Enables usage with sinks or elements that are unreliable and may
  throw errors and need re-initialization, such as a network sink, a
  USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
  pipelines within a single process when combined with the `tee`
  element.

All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.

https://bugzilla.gnome.org/show_bug.cgi?id=788200
2018-02-07 22:49:36 +05:30
Matthew Waters
c5c69dcc55 qt: don't #include platform specific gstglcontext_*.h headers
They aren't public headers
2018-02-07 20:15:35 +11:00
Guillaume Desmottes
58ce84a3ea opencv: fix OPENCV_PATH_NAME when using meson
Meson was checking for $prefix/OpenCV but was then defining
OPENCV_PATH_NAME with 'OpenCv' rather than 'OpenCV'.

https://bugzilla.gnome.org/show_bug.cgi?id=793212
2018-02-06 13:06:33 +00:00
Sean DuBois
fc4fe1c10e aom: Drop pointless cast from av1enc
https://bugzilla.gnome.org/show_bug.cgi?id=791674
2018-02-05 15:34:49 +02:00
Sean DuBois
86abe6b1e6 aom: Fix all definite leaks in av1enc
Track if the encoder has been inited, and cleanup if needed. Also unref
input_state if has been set

https://bugzilla.gnome.org/show_bug.cgi?id=791674
2018-02-05 15:34:49 +02:00
Sean DuBois
327586bd26 aom: Consistent naming between av1dec and av1enc
https://bugzilla.gnome.org/show_bug.cgi?id=791674
2018-02-05 15:34:49 +02:00
Sean DuBois
3a8d50a355 aom: Implement flush for av1dec
https://bugzilla.gnome.org/show_bug.cgi?id=791674
2018-02-05 10:09:48 +02:00
Tim-Philipp Müller
4d0b06f42c autotools: use -fno-strict-aliasing where supported
https://bugzilla.gnome.org/show_bug.cgi?id=769183
2018-02-05 08:26:16 +01:00
Matthew Waters
18156a76fb tests: add a test for the dtls{enc,dec} elements 2018-02-05 17:44:33 +11:00