Commit 5b2b23f2 authored by Sam Lantinga's avatar Sam Lantinga Committed by Luca Barbato

dxva2: Retry IDirectXVideoDecoder_BeginFrame()

If the function returns E_PENDING retry for a fixed number of times.
Signed-off-by: 's avatarLuca Barbato <lu_zero@gentoo.org>
parent e22ebd04
......@@ -87,12 +87,19 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, Picture *pic,
unsigned buffer_count = 0;
DXVA2_DecodeBufferDesc buffer[4];
DXVA2_DecodeExecuteParams exec = { 0 };
int result;
if (FAILED(IDirectXVideoDecoder_BeginFrame(ctx->decoder,
ff_dxva2_get_surface(pic),
NULL))) {
av_log(avctx, AV_LOG_ERROR, "Failed to begin frame\n");
int result, runs = 0;
HRESULT hr;
do {
hr = IDirectXVideoDecoder_BeginFrame(ctx->decoder,
ff_dxva2_get_surface(pic),
NULL);
if (hr == E_PENDING)
av_usleep(2000);
} while (hr == E_PENDING && ++runs < 50);
if (FAILED(hr)) {
av_log(avctx, AV_LOG_ERROR, "Failed to begin frame: 0x%x\n", hr);
return -1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment