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

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

Issue 2344993003: [Chromecast] Fade in after a mixer input stream has skipped (Closed)
Patch Set: Created 4 years, 3 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
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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 DCHECK(!IsDeleting()); 228 DCHECK(!IsDeleting());
229 if (end_of_stream) { 229 if (end_of_stream) {
230 LOG(INFO) << "End of stream for " << this; 230 LOG(INFO) << "End of stream for " << this;
231 state_ = kStateGotEos; 231 state_ = kStateGotEos;
232 } else if (state_ == kStateUninitialized) { 232 } else if (state_ == kStateUninitialized) {
233 state_ = kStateNormalPlayback; 233 state_ = kStateNormalPlayback;
234 } 234 }
235 mixer_->OnFramesQueued(); 235 mixer_->OnFramesQueued();
236 } 236 }
237 237
238 void StreamMixerAlsaInputImpl::OnSkipped() {
239 DCHECK(mixer_task_runner_->BelongsToCurrentThread());
240 if (state_ == kStateNormalPlayback) {
241 // Fade in once this input starts providing data again.
242 fade_frames_remaining_ = NormalFadeFrames();
243 }
244 }
245
238 void StreamMixerAlsaInputImpl::AfterWriteFrames( 246 void StreamMixerAlsaInputImpl::AfterWriteFrames(
239 const MediaPipelineBackendAlsa::RenderingDelay& mixer_rendering_delay) { 247 const MediaPipelineBackendAlsa::RenderingDelay& mixer_rendering_delay) {
240 DCHECK(mixer_task_runner_->BelongsToCurrentThread()); 248 DCHECK(mixer_task_runner_->BelongsToCurrentThread());
241 double resampler_queued_frames = 249 double resampler_queued_frames =
242 (resampler_ ? resampler_->BufferedFrames() : 0); 250 (resampler_ ? resampler_->BufferedFrames() : 0);
243 251
244 bool queued_more_data = false; 252 bool queued_more_data = false;
245 MediaPipelineBackendAlsa::RenderingDelay total_delay; 253 MediaPipelineBackendAlsa::RenderingDelay total_delay;
246 { 254 {
247 base::AutoLock lock(queue_lock_); 255 base::AutoLock lock(queue_lock_);
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 DCHECK(!IsDeleting()); 509 DCHECK(!IsDeleting());
502 if (multiplier > 1.0f) 510 if (multiplier > 1.0f)
503 multiplier = 1.0f; 511 multiplier = 1.0f;
504 if (multiplier < 0.0f) 512 if (multiplier < 0.0f)
505 multiplier = 0.0f; 513 multiplier = 0.0f;
506 volume_multiplier_ = multiplier; 514 volume_multiplier_ = multiplier;
507 } 515 }
508 516
509 } // namespace media 517 } // namespace media
510 } // namespace chromecast 518 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698