diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-01-01 10:24:19 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-01-01 10:24:19 +0000 |
commit | c9ba917877a8cd6ce51609d2feb27496d05143cd (patch) | |
tree | 5ceb3e343ab5314f6a95e99cdcb76f0536e0f021 /mplayer.c | |
parent | 756e662b685a311ecdc9aabdf7fa8f5844e4ae43 (diff) | |
download | mpv-c9ba917877a8cd6ce51609d2feb27496d05143cd.tar.bz2 mpv-c9ba917877a8cd6ce51609d2feb27496d05143cd.tar.xz |
Avoid a uselessly high number of wakeups when playing audio-only files.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28220 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mplayer.c')
-rw-r--r-- | mplayer.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -2015,6 +2015,7 @@ static int fill_audio_out_buffers(void) current_module="play_audio"; while (1) { + int sleep_time; // all the current uses of ao_data.pts seem to be in aos that handle // sync completely wrong; there should be no need to use ao_data.pts // in get_space() @@ -2026,7 +2027,9 @@ static int fill_audio_out_buffers(void) // handle audio-only case: // this is where mplayer sleeps during audio-only playback // to avoid 100% CPU use - usec_sleep(10000); // Wait a tick before retry + sleep_time = (ao_data.outburst - bytes_to_write) * 1000 / ao_data.samplerate; + if (sleep_time < 10) sleep_time = 10; // limit to 100 wakeups per second + usec_sleep(sleep_time * 1000); } while (bytes_to_write) { |