diff options
author | Tueidj <tueidj@hotmail.com> | 2013-08-28 21:33:00 +0800 |
---|---|---|
committer | Chih-Wei Huang <cwhuang@linux.org.tw> | 2013-09-10 23:42:53 +0800 |
commit | 1c2c376341d016f7d7da43aa9909043a6738bd5d (patch) | |
tree | 50914834f5bd9469e28c066089d8a1ecea0ae08d | |
parent | e7c00cd2232af1260e083ccc0f007910851da261 (diff) | |
download | platform_hardware_libaudio-1c2c376341d016f7d7da43aa9909043a6738bd5d.tar.gz platform_hardware_libaudio-1c2c376341d016f7d7da43aa9909043a6738bd5d.tar.bz2 platform_hardware_libaudio-1c2c376341d016f7d7da43aa9909043a6738bd5d.zip |
Fix bad sleep time
The bad sleep time occurs when pcm_get_htimestamp() fails, leaving
kernel_frames uninitialized and causing out->cur_write_threshold to be
set to a very large value. The following patch ensures kernel_frames is
initialized to a sane value, it should fix most of the "limiting sleep
time" warnings and stuttering audio caused by sleeping too much.
-rw-r--r-- | audio_hw.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -715,8 +715,10 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer, struct timespec time_stamp; if (pcm_get_htimestamp(out->pcm, (unsigned int *)&kernel_frames, - &time_stamp) < 0) + &time_stamp) < 0) { + kernel_frames = 0; /* assume no space is available */ break; + } kernel_frames = pcm_get_buffer_size(out->pcm) - kernel_frames; if (kernel_frames > out->cur_write_threshold) { |