summaryrefslogtreecommitdiffstats
path: root/ffplay.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2010-01-30 21:27:17 +0000
committerMichael Niedermayer <michaelni@gmx.at>2010-01-30 21:27:17 +0000
commit79ee46836578e78ef9539f0232cd1f589ee2e2dc (patch)
tree429e117b26136ac33951940c169bbc02f27593ec /ffplay.c
parentce2421a5c3c19b1536a747a109e3a794712d462a (diff)
downloadffmpeg-streaming-79ee46836578e78ef9539f0232cd1f589ee2e2dc.zip
ffmpeg-streaming-79ee46836578e78ef9539f0232cd1f589ee2e2dc.tar.gz
Redesign packet queue full check to be more robust.
Originally committed as revision 21555 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffplay.c')
-rw-r--r--ffplay.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/ffplay.c b/ffplay.c
index c1b9cfc..69588d6 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -49,9 +49,9 @@ const int program_birth_year = 2003;
//#define DEBUG_SYNC
-#define MAX_VIDEOQ_SIZE (30 * 256 * 1024)
-#define MAX_AUDIOQ_SIZE (20 * 16 * 1024)
-#define MAX_SUBTITLEQ_SIZE (5 * 16 * 1024)
+#define MAX_QUEUE_SIZE (15 * 1024 * 1024)
+#define MIN_AUDIOQ_SIZE (20 * 16 * 1024)
+#define MIN_FRAMES 5
/* SDL audio buffer size, in samples. Should be small to have precise
A/V sync as SDL does not have hardware buffer fullness info. */
@@ -2026,9 +2026,10 @@ static int decode_thread(void *arg)
}
/* if the queue are full, no need to read more */
- if (is->audioq.size > MAX_AUDIOQ_SIZE ||
- is->videoq.size > MAX_VIDEOQ_SIZE ||
- is->subtitleq.size > MAX_SUBTITLEQ_SIZE) {
+ if ( is->audioq.size + is->videoq.size + is->subtitleq.size > MAX_QUEUE_SIZE
+ || ( (is->audioq .size > MIN_AUDIOQ_SIZE || is->audio_stream<0)
+ && (is->videoq .nb_packets > MIN_FRAMES || is->video_stream<0)
+ && (is->subtitleq.nb_packets > MIN_FRAMES || is->subtitle_stream<0))) {
/* wait 10 ms */
SDL_Delay(10);
continue;
OpenPOWER on IntegriCloud