OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "media/filters/audio_renderer_impl.h" | 5 #include "media/filters/audio_renderer_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 if (pending_read_ || state_ == kPaused) | 299 if (pending_read_ || state_ == kPaused) |
300 return; | 300 return; |
301 pending_read_ = true; | 301 pending_read_ = true; |
302 decoder_->Read(read_cb_); | 302 decoder_->Read(read_cb_); |
303 } | 303 } |
304 | 304 |
305 void AudioRendererImpl::SetPlaybackRate(float playback_rate) { | 305 void AudioRendererImpl::SetPlaybackRate(float playback_rate) { |
306 DCHECK_LE(0.0f, playback_rate); | 306 DCHECK_LE(0.0f, playback_rate); |
307 | 307 |
308 if (!stopped_) { | 308 if (!stopped_) { |
309 // Notify sink of new playback rate. | |
310 sink_->SetPlaybackRate(playback_rate); | |
311 | |
312 // We have two cases here: | 309 // We have two cases here: |
313 // Play: GetPlaybackRate() == 0.0 && playback_rate != 0.0 | 310 // Play: GetPlaybackRate() == 0.0 && playback_rate != 0.0 |
314 // Pause: GetPlaybackRate() != 0.0 && playback_rate == 0.0 | 311 // Pause: GetPlaybackRate() != 0.0 && playback_rate == 0.0 |
315 if (GetPlaybackRate() == 0.0f && playback_rate != 0.0f) { | 312 if (GetPlaybackRate() == 0.0f && playback_rate != 0.0f) { |
316 DoPlay(); | 313 DoPlay(); |
317 } else if (GetPlaybackRate() != 0.0f && playback_rate == 0.0f) { | 314 } else if (GetPlaybackRate() != 0.0f && playback_rate == 0.0f) { |
318 // Pause is easy, we can always pause. | 315 // Pause is easy, we can always pause. |
319 DoPause(); | 316 DoPause(); |
320 } | 317 } |
321 } | 318 } |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 case kUnderflow: | 541 case kUnderflow: |
545 case kRebuffering: | 542 case kRebuffering: |
546 case kStopped: | 543 case kStopped: |
547 if (status != PIPELINE_OK) | 544 if (status != PIPELINE_OK) |
548 error_cb_.Run(status); | 545 error_cb_.Run(status); |
549 return; | 546 return; |
550 } | 547 } |
551 } | 548 } |
552 | 549 |
553 } // namespace media | 550 } // namespace media |
OLD | NEW |