gstreamer/sys
Seungha Yang 6195fcf857 mfvideoenc: Improve latency performance for hardware encoder
Unlike software MFT (Media Foundation Transform) which is synchronous
in terms of processing input and output data, hardware MFT works
in asynchronous mode. output data might not be available right after
we pushed one input data into MFT.
Note that async MFT will fire two events, one is "METransformNeedInput"
which happens when MFT can accept more input data,
and the other is "METransformHaveOutput", that's for signaling
there's pending data which can be outputted immediately.

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

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

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

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1520>
2020-12-19 18:56:33 +00:00
..
androidmedia amc: Fix crash when encoding AVC 2020-10-29 17:51:57 +00:00
applemedia vtdec/vulkan: use Shared storage mode for IOSurface textures 2020-09-23 23:21:50 +00:00
bluez gsta2dpsink: Fix GstPad leak 2020-11-11 22:19:33 +05:30
d3d11 d3d11videosink: Add a property to support rendering statistics data on window 2020-12-04 05:22:14 +09:00
d3dvideosink d3dvideosink: Use secondary rank 2020-06-03 17:57:40 +09:00
decklink decklinkaudiosrc: Fix duration of the first audio frame after each discont 2020-12-17 09:00:24 +00:00
directsound bad: use of g_value_dup_string 2019-12-30 14:13:03 +00:00
dshowdecwrapper documentation: fixed a heap o' typos 2019-11-05 09:11:25 -05:00
dshowsrcwrapper dshowsrcwrapper: Update build instructions. Add _builddir to include search path. 2020-08-28 23:00:53 +00:00
dshowvideosink documentation: fixed a heap o' typos 2019-11-05 09:11:25 -05:00
dvb plugins: uddate gst_type_mark_as_plugin_api() calls 2020-06-06 00:40:42 +02:00
fbdev Remove autotools build system 2019-10-14 13:54:27 +01:00
ipcpipeline ipcpipeline: Minimal fixes that allow building with MSVC 2020-01-14 09:23:02 +05:30
kms kmssink: Do not source using padded width/height 2020-09-18 16:26:23 +00:00
magicleap mlaudiosink: Fix crash when stopping pipeline 2019-12-06 15:29:29 +00:00
mediafoundation mfvideoenc: Improve latency performance for hardware encoder 2020-12-19 18:56:33 +00:00
msdk msdkh264dec: Accept constrained-high and progressive-high profiles 2020-11-18 15:46:52 -05:00
nvcodec cuda: Fix lowest targetted architecture for CUDA >= 11.0 2020-12-03 12:23:44 +01:00
opensles opensles: Remove hard-coded buffer-/latency-time values 2020-05-16 19:23:06 +00:00
shm Don't pass default GLib marshallers for signals 2019-11-06 14:27:46 +00:00
tinyalsa Remove autotools build system 2019-10-14 13:54:27 +01:00
uvch264 plugins: uddate gst_type_mark_as_plugin_api() calls 2020-06-06 00:40:42 +02:00
v4l2codecs codecs: h264decoder: Store reference picture type using enum value 2020-11-13 15:25:42 +00:00
va va: decode: fix display type 2020-12-06 18:03:47 +01:00
wasapi wasapisrc: Make sure that wasapisrc produces data in loopback mode 2020-09-30 12:57:34 +00:00
wasapi2 wasapi2: Ensure unmute when opening audio client 2020-12-14 19:08:21 +00:00
winks documentation: fixed a heap o' typos 2019-11-05 09:11:25 -05:00
winscreencap plugins: Use g_win32_error_message for HRESULT to string conversion 2020-07-18 11:05:52 +09:00
meson.build va: VA-API H.264 decoder and infrastructure 2020-06-28 11:47:35 +02:00