hardware/libaudio
Révision | 1c2c376341d016f7d7da43aa9909043a6738bd5d (tree) |
---|---|
l'heure | 2013-09-11 00:42:53 |
Auteur | Tueidj <tueidj@hotm...> |
Commiter | Chih-Wei Huang |
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.
@@ -715,8 +715,10 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer, | ||
715 | 715 | struct timespec time_stamp; |
716 | 716 | if (pcm_get_htimestamp(out->pcm, |
717 | 717 | (unsigned int *)&kernel_frames, |
718 | - &time_stamp) < 0) | |
718 | + &time_stamp) < 0) { | |
719 | + kernel_frames = 0; /* assume no space is available */ | |
719 | 720 | break; |
721 | + } | |
720 | 722 | kernel_frames = pcm_get_buffer_size(out->pcm) - kernel_frames; |
721 | 723 | |
722 | 724 | if (kernel_frames > out->cur_write_threshold) { |