Index: ffplay.c =================================================================== --- ffplay.c (revision 20336) +++ ffplay.c (working copy) @@ -45,9 +45,9 @@ //#define DEBUG_SYNC -#define MAX_VIDEOQ_SIZE (5 * 256 * 1024) -#define MAX_AUDIOQ_SIZE (20 * 16 * 1024) -#define MAX_SUBTITLEQ_SIZE (5 * 16 * 1024) +#define MAX_VIDEOQ_SIZE (50 * 256 * 1024) +#define MAX_AUDIOQ_SIZE (200 * 16 * 1024) +#define MAX_SUBTITLEQ_SIZE (50 * 16 * 1024) /* SDL audio buffer size, in samples. Should be small to have precise A/V sync as SDL does not have hardware buffer fullness info. */ @@ -2023,6 +2023,14 @@ eof= 0; } + /* if every queue is filled with at least 5% of max buffer size, no need to read more */ + if ( (is->audio_stream < 0 || is->audioq.size > MAX_AUDIOQ_SIZE / 20) && + (is->video_stream < 0 || is->videoq.size > MAX_VIDEOQ_SIZE / 20) && + (is->subtitle_stream < 0 || is->subtitleq.size > MAX_SUBTITLEQ_SIZE / 20)) { + /* wait 10 ms */ + SDL_Delay(10); + continue; + } /* if the queue are full, no need to read more */ if (is->audioq.size > MAX_AUDIOQ_SIZE || is->videoq.size > MAX_VIDEOQ_SIZE ||