d3d11decoder: Do more retry for ID3D11VideoContext::DecoderBeginFrame failure

Some GPUs (especially NVIDIA) are complaining that GPU is still busy
even we did 50 times of retry with 1ms sleep per failure.
Because DXVA/D3D11 doesn't provide API for "GPU-IS-READY-TO-DECODE"
like signal, there seems to be still no better solution other than sleep.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1913>
This commit is contained in:
Seungha Yang 2020-12-28 02:35:38 +09:00 committed by GStreamer Merge Bot
parent 3f43fef3ce
commit 46c577222d

View file

@ -903,15 +903,19 @@ gst_d3d11_decoder_begin_frame (GstD3D11Decoder * decoder,
priv->decoder, output_view, content_key_size, content_key);
gst_d3d11_device_unlock (priv->device);
if (hr == E_PENDING && retry_count < 50) {
GST_LOG_OBJECT (decoder, "GPU busy, try again");
/* HACK: no better idea other than sleep...
* 1ms waiting like msdkdec */
/* HACK: Do 100 times retry with 1ms sleep per failure, since DXVA/D3D11
* doesn't provide API for "GPU-IS-READY-TO-DECODE" like signal.
* In the worst case, we will error out after 100ms.
* Note that Windows' clock precision is known to be incorrect,
* so it would be longer than 100ms in reality.
*/
if (hr == E_PENDING && retry_count < 100) {
GST_LOG_OBJECT (decoder, "GPU is busy, try again. Retry count %d",
retry_count);
g_usleep (1000);
} else {
if (gst_d3d11_result (hr, priv->device))
GST_LOG_OBJECT (decoder, "Success with retry %d", retry_count);
GST_LOG_OBJECT (decoder, "Succeeded with retry count %d", retry_count);
break;
}