| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 sink_->Initialize(audio_parameters_, this); | 193 sink_->Initialize(audio_parameters_, this); |
| 194 | 194 |
| 195 sink_->Start(); | 195 sink_->Start(); |
| 196 is_initialized_ = true; | 196 is_initialized_ = true; |
| 197 | 197 |
| 198 // Finally, execute the start callback. | 198 // Finally, execute the start callback. |
| 199 state_ = kPaused; | 199 state_ = kPaused; |
| 200 init_cb.Run(PIPELINE_OK); | 200 init_cb.Run(PIPELINE_OK); |
| 201 } | 201 } |
| 202 | 202 |
| 203 bool AudioRendererImpl::HasEnded() { | |
| 204 base::AutoLock auto_lock(lock_); | |
| 205 DCHECK(!rendered_end_of_stream_ || !algorithm_->CanFillBuffer()); | |
| 206 | |
| 207 return received_end_of_stream_ && rendered_end_of_stream_; | |
| 208 } | |
| 209 | |
| 210 void AudioRendererImpl::ResumeAfterUnderflow(bool buffer_more_audio) { | 203 void AudioRendererImpl::ResumeAfterUnderflow(bool buffer_more_audio) { |
| 211 base::AutoLock auto_lock(lock_); | 204 base::AutoLock auto_lock(lock_); |
| 212 if (state_ == kUnderflow) { | 205 if (state_ == kUnderflow) { |
| 213 if (buffer_more_audio) | 206 if (buffer_more_audio) |
| 214 algorithm_->IncreaseQueueCapacity(); | 207 algorithm_->IncreaseQueueCapacity(); |
| 215 | 208 |
| 216 state_ = kRebuffering; | 209 state_ = kRebuffering; |
| 217 } | 210 } |
| 218 } | 211 } |
| 219 | 212 |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 case kUnderflow: | 534 case kUnderflow: |
| 542 case kRebuffering: | 535 case kRebuffering: |
| 543 case kStopped: | 536 case kStopped: |
| 544 if (status != PIPELINE_OK) | 537 if (status != PIPELINE_OK) |
| 545 error_cb_.Run(status); | 538 error_cb_.Run(status); |
| 546 return; | 539 return; |
| 547 } | 540 } |
| 548 } | 541 } |
| 549 | 542 |
| 550 } // namespace media | 543 } // namespace media |
| OLD | NEW |