Loading hal/audio_hw.c +20 −1 Original line number Diff line number Diff line Loading @@ -3327,6 +3327,25 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer, out->config.channels * format_to_bitwidth_table[out->hal_op_format])); } else { /* * To avoid underrun in DSP when the application is not pumping * data at required rate, check for the no. of bytes and ignore * pcm_write if it is less than actual buffer size. * It is a work around to a change in compress VOIP driver. */ if ((out->flags & AUDIO_OUTPUT_FLAG_VOIP_RX) && bytes < (out->config.period_size * out->config.channels * audio_bytes_per_sample(out->format))) { size_t voip_buf_size = out->config.period_size * out->config.channels * audio_bytes_per_sample(out->format); ALOGE("%s:VOIP underrun: bytes received %zu, required:%zu\n", __func__, bytes, voip_buf_size); usleep(((uint64_t)voip_buf_size - bytes) * 1000000 / audio_stream_out_frame_size(stream) / out_get_sample_rate(&out->stream.common)); ret = 0; } else ret = pcm_write(out->pcm, (void *)buffer, bytes); } Loading Loading
hal/audio_hw.c +20 −1 Original line number Diff line number Diff line Loading @@ -3327,6 +3327,25 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer, out->config.channels * format_to_bitwidth_table[out->hal_op_format])); } else { /* * To avoid underrun in DSP when the application is not pumping * data at required rate, check for the no. of bytes and ignore * pcm_write if it is less than actual buffer size. * It is a work around to a change in compress VOIP driver. */ if ((out->flags & AUDIO_OUTPUT_FLAG_VOIP_RX) && bytes < (out->config.period_size * out->config.channels * audio_bytes_per_sample(out->format))) { size_t voip_buf_size = out->config.period_size * out->config.channels * audio_bytes_per_sample(out->format); ALOGE("%s:VOIP underrun: bytes received %zu, required:%zu\n", __func__, bytes, voip_buf_size); usleep(((uint64_t)voip_buf_size - bytes) * 1000000 / audio_stream_out_frame_size(stream) / out_get_sample_rate(&out->stream.common)); ret = 0; } else ret = pcm_write(out->pcm, (void *)buffer, bytes); } Loading