summaryrefslogtreecommitdiffstats
path: root/ffplay.c
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2015-02-08 19:30:46 +0100
committerMarton Balint <cus@passwd.hu>2015-08-05 21:09:30 +0200
commitb1f78632c681f32c4901a85aa7ee72bf9ca6fece (patch)
treecb774cb604e71022ad2edd38059cc057a334e221 /ffplay.c
parent8db0f71b49a360dd64ae482fa4244db055f117eb (diff)
downloadffmpeg-streaming-b1f78632c681f32c4901a85aa7ee72bf9ca6fece.zip
ffmpeg-streaming-b1f78632c681f32c4901a85aa7ee72bf9ca6fece.tar.gz
ffplay: do not block audio thread on WIN32
The windows SDL audio driver plays the old data in the buffer in a loop if it is not updated in time. So instead of waiting for data and blocking the the audio thread, return silence if no data is available. Should fix ticket #2289. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'ffplay.c')
-rw-r--r--ffplay.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ffplay.c b/ffplay.c
index cc61dde..67cf9ea 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -2303,6 +2303,13 @@ static int audio_decode_frame(VideoState *is)
return -1;
do {
+#if defined(_WIN32)
+ while (frame_queue_nb_remaining(&is->sampq) == 0) {
+ if ((av_gettime_relative() - audio_callback_time) > 1000000LL * is->audio_hw_buf_size / is->audio_tgt.bytes_per_sec / 2)
+ return -1;
+ av_usleep (1000);
+ }
+#endif
if (!(af = frame_queue_peek_readable(&is->sampq)))
return -1;
frame_queue_next(&is->sampq);
OpenPOWER on IntegriCloud