mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-11-24 19:59:46 +00:00
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>
This commit is contained in:
parent
8db0f71b49
commit
b1f78632c6
7
ffplay.c
7
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);
|
||||
|
Loading…
Reference in New Issue
Block a user