Ticket #2289: 0001-ffplay-do-not-block-audio-thread-on-WIN32.patch

File 0001-ffplay-do-not-block-audio-thread-on-WIN32.patch, 1.1 KB (added by Marton Balint, 12 years ago)
  • ffplay.c

    From 488477ea08b07839acb60d3b123c8080ebf112fb Mon Sep 17 00:00:00 2001
    From: Marton Balint <cus@passwd.hu>
    Date: Sun, 8 Feb 2015 19:30:46 +0100
    Subject: [PATCH] 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.
    
    Signed-off-by: Marton Balint <cus@passwd.hu>
    ---
     ffplay.c | 7 +++++++
     1 file changed, 7 insertions(+)
    
    diff --git a/ffplay.c b/ffplay.c
    index c112ead..0c2a614 100644
    a b static int audio_decode_frame(VideoState *is)  
    24192419        return -1;
    24202420
    24212421    do {
     2422#if defined(_WIN32)
     2423       while (frame_queue_nb_remaining(&is->sampq) == 0) {
     2424           if ((av_gettime_relative() - audio_callback_time) > 1000000LL * is->audio_hw_buf_size / is->audio_tgt.bytes_per_sec / 2)
     2425               return -1;
     2426           av_usleep (1000);
     2427       }
     2428#endif
    24222429        if (!(af = frame_queue_peek_readable(&is->sampq)))
    24232430            return -1;
    24242431        frame_queue_next(&is->sampq);