Commit 30cf73d9 authored by Jean-Paul Saman's avatar Jean-Paul Saman

VAAPI: do not run out of pictures

Fix for commit-id: 5240dc3b
The previous commit caused the vout to deplete its picture pool.
parent 5240dc3b
...@@ -754,8 +754,7 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block ) ...@@ -754,8 +754,7 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
if( p_sys->p_va && p_sys->p_ff_pic->opaque ) if( p_sys->p_va && p_sys->p_ff_pic->opaque )
{ {
p_pic = (picture_t *)p_sys->p_ff_pic->opaque; p_pic = (picture_t *)p_sys->p_ff_pic->opaque;
if( p_pic->format.i_chroma != VLC_CODEC_VAAPI_SURFACE ) if( p_pic ) decoder_LinkPicture( p_dec, p_pic );
decoder_LinkPicture( p_dec, p_pic );
/* Fill p_picture_t from AVVideoFrame and do chroma conversion /* Fill p_picture_t from AVVideoFrame and do chroma conversion
* if needed */ * if needed */
...@@ -1016,7 +1015,6 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context, ...@@ -1016,7 +1015,6 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
if( p_pic && ( p_pic->format.i_chroma == VLC_CODEC_VAAPI_SURFACE ) ) if( p_pic && ( p_pic->format.i_chroma == VLC_CODEC_VAAPI_SURFACE ) )
{ {
p_ff_pic->opaque = (void*)p_pic; p_ff_pic->opaque = (void*)p_pic;
decoder_LinkPicture( p_dec, p_pic );
vlc_va_Put( p_sys->p_va, p_ff_pic, p_pic ); vlc_va_Put( p_sys->p_va, p_ff_pic, p_pic );
} }
else else
...@@ -1157,7 +1155,7 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context, ...@@ -1157,7 +1155,7 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context,
if( p_sys->p_va ) if( p_sys->p_va )
{ {
picture_t *p_pic = (picture_t*)p_ff_pic->opaque; picture_t *p_pic = (picture_t*)p_ff_pic->opaque;
if( p_pic && p_pic->format.i_chroma == VLC_CODEC_VAAPI_SURFACE ) if( p_pic )
decoder_UnlinkPicture( p_dec, p_pic ); decoder_UnlinkPicture( p_dec, p_pic );
else else
vlc_va_Release( p_sys->p_va, p_ff_pic ); vlc_va_Release( p_sys->p_va, p_ff_pic );
...@@ -1174,8 +1172,8 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context, ...@@ -1174,8 +1172,8 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context,
else else
{ {
picture_t *p_pic = (picture_t*)p_ff_pic->opaque; picture_t *p_pic = (picture_t*)p_ff_pic->opaque;
if( p_pic )
decoder_UnlinkPicture( p_dec, p_pic ); decoder_UnlinkPicture( p_dec, p_pic );
} }
for( int i = 0; i < 4; i++ ) for( int i = 0; i < 4; i++ )
p_ff_pic->data[i] = NULL; p_ff_pic->data[i] = NULL;
......
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