Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: chromecast/media/cma/backend/alsa/stream_mixer_alsa_input_impl.cc

Issue 2677643002: [Chromecast] Fix unit test failures due to underflow. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chromecast/media/cma/backend/multizone_backend_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromecast/media/cma/backend/alsa/stream_mixer_alsa_input_impl.h" 5 #include "chromecast/media/cma/backend/alsa/stream_mixer_alsa_input_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 MediaPipelineBackendAlsa::RenderingDelay StreamMixerAlsaInputImpl::QueueData( 201 MediaPipelineBackendAlsa::RenderingDelay StreamMixerAlsaInputImpl::QueueData(
202 const scoped_refptr<DecoderBufferBase>& data) { 202 const scoped_refptr<DecoderBufferBase>& data) {
203 queue_lock_.AssertAcquired(); 203 queue_lock_.AssertAcquired();
204 if (!data->end_of_stream()) { 204 if (!data->end_of_stream()) {
205 int frames = data->data_size() / (kNumOutputChannels * sizeof(float)); 205 int frames = data->data_size() / (kNumOutputChannels * sizeof(float));
206 queue_.push_back(data); 206 queue_.push_back(data);
207 queued_frames_ += frames; 207 queued_frames_ += frames;
208 queued_frames_including_resampler_ += frames; 208 queued_frames_including_resampler_ += frames;
209 } 209 }
210 210
211 if (is_underflowing_) {
212 return MediaPipelineBackendAlsa::RenderingDelay();
213 }
214
211 MediaPipelineBackendAlsa::RenderingDelay delay = mixer_rendering_delay_; 215 MediaPipelineBackendAlsa::RenderingDelay delay = mixer_rendering_delay_;
212 if (delay.timestamp_microseconds != kNoTimestamp) { 216 if (delay.timestamp_microseconds != kNoTimestamp) {
213 delay.delay_microseconds += static_cast<int64_t>( 217 delay.delay_microseconds += static_cast<int64_t>(
214 queued_frames_including_resampler_ * 218 queued_frames_including_resampler_ *
215 base::Time::kMicrosecondsPerSecond / input_samples_per_second_); 219 base::Time::kMicrosecondsPerSecond / input_samples_per_second_);
216 } 220 }
217 return delay; 221 return delay;
218 } 222 }
219 223
220 void StreamMixerAlsaInputImpl::PostPcmCallback( 224 void StreamMixerAlsaInputImpl::PostPcmCallback(
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 526
523 void StreamMixerAlsaInputImpl::VolumeScaleAccumulate(bool repeat_transition, 527 void StreamMixerAlsaInputImpl::VolumeScaleAccumulate(bool repeat_transition,
524 const float* src, 528 const float* src,
525 int frames, 529 int frames,
526 float* dest) { 530 float* dest) {
527 slew_volume_.ProcessFMAC(repeat_transition, src, frames, dest); 531 slew_volume_.ProcessFMAC(repeat_transition, src, frames, dest);
528 } 532 }
529 533
530 } // namespace media 534 } // namespace media
531 } // namespace chromecast 535 } // namespace chromecast
OLDNEW
« no previous file with comments | « no previous file | chromecast/media/cma/backend/multizone_backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698