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

codec/avcodec/vaapi.c: increase the number of surfaces.

Increase the number of surfaces requested to 30. VAAPI X11 vout
creates enough pictures to take the direct rendering code path
in vout core. Which means there are about 30 pictures in flight.

With a low number of surfaces these will be reused before they
are being displayed and this results in out of order display of
pictures. The viewer will see a stuttering image.
parent 7295b5b9
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <vlc_fourcc.h> #include <vlc_fourcc.h>
#include <vlc_picture.h> #include <vlc_picture.h>
#include <assert.h> #include <assert.h>
#include <vlc_arrays.h>
#ifdef HAVE_LIBAVCODEC_AVCODEC_H #ifdef HAVE_LIBAVCODEC_AVCODEC_H
# include <libavcodec/avcodec.h> # include <libavcodec/avcodec.h>
...@@ -86,35 +87,39 @@ static int Open( vlc_va_vaapi_t *p_va, int i_codec_id ) ...@@ -86,35 +87,39 @@ static int Open( vlc_va_vaapi_t *p_va, int i_codec_id )
VAProfile i_profile; VAProfile i_profile;
int i_surface_count; int i_surface_count;
/* */ /* NOTE: The number of surfaces requested is calculated
based on the amount of pictures vout core needs for
direct rendering. In general that is 20/30 pictures.
i_surface_count = requested_count - (codec_needs + 1)
+ codec_needs + 1;
*/
switch( i_codec_id ) switch( i_codec_id )
{ {
case CODEC_ID_MPEG1VIDEO: case CODEC_ID_MPEG1VIDEO:
case CODEC_ID_MPEG2VIDEO: case CODEC_ID_MPEG2VIDEO:
i_profile = VAProfileMPEG2Main; i_profile = VAProfileMPEG2Main;
i_surface_count = 2+1; i_surface_count = 17+2+1;
break; break;
case CODEC_ID_MPEG4: case CODEC_ID_MPEG4:
i_profile = VAProfileMPEG4AdvancedSimple; i_profile = VAProfileMPEG4AdvancedSimple;
i_surface_count = 2+1; i_surface_count = 17+2+1;
break; break;
case CODEC_ID_WMV3: case CODEC_ID_WMV3:
i_profile = VAProfileVC1Main; i_profile = VAProfileVC1Main;
i_surface_count = 2+1; i_surface_count = 17+2+1;
break; break;
case CODEC_ID_VC1: case CODEC_ID_VC1:
i_profile = VAProfileVC1Advanced; i_profile = VAProfileVC1Advanced;
i_surface_count = 2+1; i_surface_count = 17+2+1;
break; break;
case CODEC_ID_H264: case CODEC_ID_H264:
i_profile = VAProfileH264High; i_profile = VAProfileH264High;
i_surface_count = 16+1; i_surface_count = 13+16+1;
break; break;
default: default:
return VLC_EGENERIC; return VLC_EGENERIC;
} }
/* FIXME: in case of vaapi-x11 double the number of surfaces */
i_surface_count *= 2;
/* */ /* */
memset( p_va, 0, sizeof(*p_va) ); memset( p_va, 0, sizeof(*p_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