[vlc-devel] [PATCH 1/5] dxva2: clean error handling
Steve Lhomme
robux4 at ycbcr.xyz
Tue Jan 16 16:33:22 CET 2018
---
modules/codec/avcodec/dxva2.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 077c118b77..3836c7394a 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -607,9 +607,7 @@ static int DxCreateVideoDecoder(vlc_va_t *va, int codec_id,
NULL);
if (FAILED(hr)) {
msg_Err(va, "extra buffer impossible, avoid a crash (hr=0x%0lx)", hr);
- for (unsigned i = 0; i < surface_count; i++)
- IDirect3DSurface9_Release( sys->hw_surface[i] );
- return VLC_EGENERIC;
+ goto error;
}
IDirect3DSurface9_Release(tstCrash);
@@ -650,9 +648,7 @@ static int DxCreateVideoDecoder(vlc_va_t *va, int codec_id,
&cfg_count,
&cfg_list))) {
msg_Err(va, "IDirectXVideoDecoderService_GetDecoderConfigurations failed");
- for (unsigned i = 0; i < surface_count; i++)
- IDirect3DSurface9_Release( sys->hw_surface[i] );
- return VLC_EGENERIC;
+ goto error;
}
msg_Dbg(va, "we got %d decoder configurations", cfg_count);
@@ -697,14 +693,16 @@ static int DxCreateVideoDecoder(vlc_va_t *va, int codec_id,
surface_count,
&decoder))) {
msg_Err(va, "IDirectXVideoDecoderService_CreateVideoDecoder failed");
- for (unsigned i = 0; i < surface_count; i++)
- IDirect3DSurface9_Release( sys->hw_surface[i] );
- return VLC_EGENERIC;
+ goto error;
}
sys->decoder = decoder;
msg_Dbg(va, "IDirectXVideoDecoderService_CreateVideoDecoder succeed");
return VLC_SUCCESS;
+error:
+ for (unsigned i = 0; i < surface_count; i++)
+ IDirect3DSurface9_Release( sys->hw_surface[i] );
+ return VLC_EGENERIC;
}
static void DxDestroyVideoDecoder(vlc_va_t *va)
--
2.14.2
More information about the vlc-devel
mailing list