[FFmpeg-cvslog] ffplay: do not block audio thread on WIN32
Marton Balint
git at videolan.org
Wed Aug 5 21:11:20 CEST 2015
ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Sun Feb 8 19:30:46 2015 +0100| [b1f78632c681f32c4901a85aa7ee72bf9ca6fece] | committer: Marton Balint
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 at niedermayer.cc>
Signed-off-by: Marton Balint <cus at passwd.hu>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b1f78632c681f32c4901a85aa7ee72bf9ca6fece
---
ffplay.c | 7 +++++++
1 file changed, 7 insertions(+)
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);
More information about the ffmpeg-cvslog
mailing list