mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
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>
This commit is contained in:
parent
e22ebd04bc
commit
5b2b23f2d6
@ -87,12 +87,19 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, Picture *pic,
|
|||||||
unsigned buffer_count = 0;
|
unsigned buffer_count = 0;
|
||||||
DXVA2_DecodeBufferDesc buffer[4];
|
DXVA2_DecodeBufferDesc buffer[4];
|
||||||
DXVA2_DecodeExecuteParams exec = { 0 };
|
DXVA2_DecodeExecuteParams exec = { 0 };
|
||||||
int result;
|
int result, runs = 0;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
if (FAILED(IDirectXVideoDecoder_BeginFrame(ctx->decoder,
|
do {
|
||||||
ff_dxva2_get_surface(pic),
|
hr = IDirectXVideoDecoder_BeginFrame(ctx->decoder,
|
||||||
NULL))) {
|
ff_dxva2_get_surface(pic),
|
||||||
av_log(avctx, AV_LOG_ERROR, "Failed to begin frame\n");
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user