Commit bbcc2d8f authored by kmackay's avatar kmackay Committed by Commit bot

[Chromecast] Don't DCHECK the result of snd_pcm_status_get_avail

The result of snd_pcm_status_get_avail() can be nonsensical if the
PCM handle is in the XRUN state.

BUG= internal b/31506355

Review-Url: https://codereview.chromium.org/2342913002
Cr-Commit-Position: refs/heads/master@{#418909}
parent 1ed1c6ff
...@@ -764,6 +764,8 @@ bool StreamMixerAlsa::TryWriteFrames() { ...@@ -764,6 +764,8 @@ bool StreamMixerAlsa::TryWriteFrames() {
return false; return false;
} }
const int min_frames_in_buffer =
output_samples_per_second_ * kMinBufferedDataMs / 1000;
int chunk_size = output_samples_per_second_ * kMaxWriteSizeMs / 1000; int chunk_size = output_samples_per_second_ * kMaxWriteSizeMs / 1000;
std::vector<InputQueue*> active_inputs; std::vector<InputQueue*> active_inputs;
for (auto&& input : inputs_) { for (auto&& input : inputs_) {
...@@ -777,11 +779,8 @@ bool StreamMixerAlsa::TryWriteFrames() { ...@@ -777,11 +779,8 @@ bool StreamMixerAlsa::TryWriteFrames() {
return false; return false;
} }
const int min_frames_in_buffer =
output_samples_per_second_ * kMinBufferedDataMs / 1000;
int frames_in_buffer = int frames_in_buffer =
alsa_buffer_size_ - alsa_->PcmStatusGetAvail(pcm_status_); alsa_buffer_size_ - alsa_->PcmStatusGetAvail(pcm_status_);
DCHECK_GE(frames_in_buffer, 0);
if (alsa_->PcmStatusGetState(pcm_status_) == SND_PCM_STATE_XRUN || if (alsa_->PcmStatusGetState(pcm_status_) == SND_PCM_STATE_XRUN ||
frames_in_buffer < min_frames_in_buffer) { frames_in_buffer < min_frames_in_buffer) {
// If there has been (or soon will be) an underrun, continue without the // If there has been (or soon will be) an underrun, continue without the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment