Commit 6ddd92de authored by Jean-Paul Saman's avatar Jean-Paul Saman

VAAPI: Only accept VAAPI type of pictures when vaapi-xcb is active.

Make sure that when the VAAPI-XCB video output has been started no other picture chroma,
will be accepted. The punishment for not doing this is random crashes, since surfaces are
shared between display pictures and the decoding thread. The picture is the owner of the
surface. If not honoring this, then the decoder might write into surfaces being displayed.
This will result in random crashes since surface memory will be randomly overwritten.
parent 1c89ed78
......@@ -30,6 +30,8 @@ struct vlc_va_t {
char *description;
vlc_object_t *obj;
bool b_direct;
int (*setup)(vlc_va_t *, void **hw, vlc_fourcc_t *output,
int width, int height);
int (*get)(vlc_va_t *, AVFrame *frame);
......
......@@ -997,9 +997,14 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
if( p_sys->p_va )
{
p_pic = ffmpeg_NewPictBuf( p_dec, p_sys->p_context );
do
{
p_pic = ffmpeg_NewPictBuf( p_dec, p_sys->p_context );
} while( p_sys->p_va->b_direct && p_pic == NULL );
if( p_pic && p_pic->format.i_chroma == VLC_CODEC_VAAPI_SURFACE )
{
p_sys->p_va->b_direct = true;
p_ff_pic->opaque = (void*)p_pic;
p_ff_pic->type = FF_BUFFER_TYPE_USER;
#if LIBAVCODEC_VERSION_MAJOR < 54
......@@ -1008,7 +1013,7 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
#endif
vlc_va_Put( p_sys->p_va, p_ff_pic, p_pic );
}
else
else if( !p_sys->p_va->b_direct )
{
if( p_pic ) picture_Release( p_pic );
#ifdef HAVE_AVCODEC_VA
......
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