Chromium Code Reviews| 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 <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 underflow_cb_.Reset(); | 209 underflow_cb_.Reset(); |
| 210 time_cb_.Reset(); | 210 time_cb_.Reset(); |
| 211 flush_cb_.Reset(); | 211 flush_cb_.Reset(); |
| 212 } | 212 } |
| 213 | 213 |
| 214 if (sink_) { | 214 if (sink_) { |
| 215 sink_->Stop(); | 215 sink_->Stop(); |
| 216 sink_ = NULL; | 216 sink_ = NULL; |
| 217 } | 217 } |
| 218 | 218 |
| 219 if (decrypting_demuxer_stream_) { | |
| 220 DCHECK(decoder_); | |
| 221 decrypting_demuxer_stream_->Stop( | |
| 222 base::Bind(&AudioRendererImpl::StopDecoder, weak_this_)); | |
| 223 return; | |
| 224 } | |
| 225 | |
| 219 if (decoder_) { | 226 if (decoder_) { |
|
ddorwin
2014/02/14 04:30:51
I wonder if it makes sense to just call StopDecode
xhwang
2014/02/14 18:48:06
Done.
| |
| 220 decoder_->Stop(base::ResetAndReturn(&stop_cb_)); | 227 StopDecoder(); |
| 221 return; | 228 return; |
| 222 } | 229 } |
| 223 | 230 |
| 224 task_runner_->PostTask(FROM_HERE, base::ResetAndReturn(&stop_cb_)); | 231 task_runner_->PostTask(FROM_HERE, base::ResetAndReturn(&stop_cb_)); |
| 225 } | 232 } |
| 226 | 233 |
| 234 void AudioRendererImpl::StopDecoder() { | |
| 235 DCHECK(!stop_cb_.is_null()); | |
| 236 decoder_->Stop(base::ResetAndReturn(&stop_cb_)); | |
| 237 } | |
| 238 | |
| 227 void AudioRendererImpl::Preroll(base::TimeDelta time, | 239 void AudioRendererImpl::Preroll(base::TimeDelta time, |
| 228 const PipelineStatusCB& cb) { | 240 const PipelineStatusCB& cb) { |
| 229 DCHECK(task_runner_->BelongsToCurrentThread()); | 241 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 230 | 242 |
| 231 base::AutoLock auto_lock(lock_); | 243 base::AutoLock auto_lock(lock_); |
| 232 DCHECK(!sink_playing_); | 244 DCHECK(!sink_playing_); |
| 233 DCHECK_EQ(state_, kPaused); | 245 DCHECK_EQ(state_, kPaused); |
| 234 DCHECK(!pending_read_) << "Pending read must complete before seeking"; | 246 DCHECK(!pending_read_) << "Pending read must complete before seeking"; |
| 235 DCHECK(preroll_cb_.is_null()); | 247 DCHECK(preroll_cb_.is_null()); |
| 236 | 248 |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 728 } | 740 } |
| 729 } | 741 } |
| 730 | 742 |
| 731 void AudioRendererImpl::ChangeState_Locked(State new_state) { | 743 void AudioRendererImpl::ChangeState_Locked(State new_state) { |
| 732 DVLOG(1) << __FUNCTION__ << " : " << state_ << " -> " << new_state; | 744 DVLOG(1) << __FUNCTION__ << " : " << state_ << " -> " << new_state; |
| 733 lock_.AssertAcquired(); | 745 lock_.AssertAcquired(); |
| 734 state_ = new_state; | 746 state_ = new_state; |
| 735 } | 747 } |
| 736 | 748 |
| 737 } // namespace media | 749 } // namespace media |
| OLD | NEW |