diff options
author | Sam Lantinga <slouken@libsdl.org> | 2014-01-09 19:59:54 +0000 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2014-01-21 12:46:28 +0100 |
commit | 5b2b23f2d69e05c5fcd1c933e383fe60e185574d (patch) | |
tree | b64a7b4a81f4852a1c14e40caafddf5b453da453 /libavcodec | |
parent | e22ebd04bcab7f86548794556c28ecca46d9c2ac (diff) | |
download | ffmpeg-5b2b23f2d69e05c5fcd1c933e383fe60e185574d.tar.gz |
dxva2: Retry IDirectXVideoDecoder_BeginFrame()
If the function returns E_PENDING retry for a fixed number of times.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/dxva2.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c index bc43cae813..b6efa157d0 100644 --- a/libavcodec/dxva2.c +++ b/libavcodec/dxva2.c @@ -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; } |