changeset 34605:b85d4539ad07

Try to detect when an audio driver ends up hanging after repeated seeks. This should at least give a clear message in the case of bug 2039.
author reimar
date Sun, 12 Feb 2012 13:35:17 +0000
parents 1efa9c367aab
children ed612f6f4778
files mplayer.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mplayer.c	Sun Feb 12 00:37:23 2012 +0000
+++ b/mplayer.c	Sun Feb 12 13:35:17 2012 +0000
@@ -2119,6 +2119,7 @@
     int audio_eof = 0;
     int bytes_to_write;
     int format_change = 0;
+    int timeout = 0;
     sh_audio_t *const sh_audio = mpctx->sh_audio;
 
     current_module = "play_audio";
@@ -2132,6 +2133,10 @@
         bytes_to_write = mpctx->audio_out->get_space();
         if (mpctx->sh_video || bytes_to_write >= ao_data.outburst)
             break;
+        if (timeout++ > 10) {
+            mp_msg(MSGT_CPLAYER, MSGL_WARN, "Audio device got stuck!\n");
+            break;
+        }
 
         // handle audio-only case:
         // this is where mplayer sleeps during audio-only playback