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/base/pipeline_impl.h" | 5 #include "media/base/pipeline_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 return statistics_; | 197 return statistics_; |
198 } | 198 } |
199 | 199 |
200 void PipelineImpl::SetCdm(CdmContext* cdm_context, | 200 void PipelineImpl::SetCdm(CdmContext* cdm_context, |
201 const CdmAttachedCB& cdm_attached_cb) { | 201 const CdmAttachedCB& cdm_attached_cb) { |
202 task_runner_->PostTask( | 202 task_runner_->PostTask( |
203 FROM_HERE, base::Bind(&PipelineImpl::SetCdmTask, weak_this_, cdm_context, | 203 FROM_HERE, base::Bind(&PipelineImpl::SetCdmTask, weak_this_, cdm_context, |
204 cdm_attached_cb)); | 204 cdm_attached_cb)); |
205 } | 205 } |
206 | 206 |
| 207 void PipelineImpl::OnEnabledAudioStreamsChanged( |
| 208 const std::vector<const DemuxerStream*>& enabledAudioStreams) { |
| 209 if (!task_runner_->BelongsToCurrentThread()) { |
| 210 task_runner_->PostTask( |
| 211 FROM_HERE, base::Bind(&PipelineImpl::OnEnabledAudioStreamsChanged, |
| 212 weak_factory_.GetWeakPtr(), enabledAudioStreams)); |
| 213 return; |
| 214 } |
| 215 base::AutoLock auto_lock(lock_); |
| 216 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 217 if (renderer_) { |
| 218 renderer_->OnEnabledAudioStreamsChanged(enabledAudioStreams); |
| 219 } |
| 220 } |
| 221 |
| 222 void PipelineImpl::OnSelectedVideoStreamChanged( |
| 223 const DemuxerStream* selectedVideoStream) { |
| 224 if (!task_runner_->BelongsToCurrentThread()) { |
| 225 task_runner_->PostTask( |
| 226 FROM_HERE, base::Bind(&PipelineImpl::OnSelectedVideoStreamChanged, |
| 227 weak_factory_.GetWeakPtr(), selectedVideoStream)); |
| 228 return; |
| 229 } |
| 230 base::AutoLock auto_lock(lock_); |
| 231 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 232 if (renderer_) { |
| 233 renderer_->OnSelectedVideoStreamChanged(selectedVideoStream); |
| 234 } |
| 235 } |
| 236 |
207 void PipelineImpl::SetErrorForTesting(PipelineStatus status) { | 237 void PipelineImpl::SetErrorForTesting(PipelineStatus status) { |
208 OnError(status); | 238 OnError(status); |
209 } | 239 } |
210 | 240 |
211 bool PipelineImpl::HasWeakPtrsForTesting() const { | 241 bool PipelineImpl::HasWeakPtrsForTesting() const { |
212 DCHECK(task_runner_->BelongsToCurrentThread()); | 242 DCHECK(task_runner_->BelongsToCurrentThread()); |
213 return weak_factory_.HasWeakPtrs(); | 243 return weak_factory_.HasWeakPtrs(); |
214 } | 244 } |
215 | 245 |
216 void PipelineImpl::SetState(State next_state) { | 246 void PipelineImpl::SetState(State next_state) { |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 metadata_cb_.Run(metadata); | 893 metadata_cb_.Run(metadata); |
864 } | 894 } |
865 | 895 |
866 void PipelineImpl::BufferingStateChanged(BufferingState new_buffering_state) { | 896 void PipelineImpl::BufferingStateChanged(BufferingState new_buffering_state) { |
867 DVLOG(1) << __FUNCTION__ << "(" << new_buffering_state << ") "; | 897 DVLOG(1) << __FUNCTION__ << "(" << new_buffering_state << ") "; |
868 DCHECK(task_runner_->BelongsToCurrentThread()); | 898 DCHECK(task_runner_->BelongsToCurrentThread()); |
869 buffering_state_cb_.Run(new_buffering_state); | 899 buffering_state_cb_.Run(new_buffering_state); |
870 } | 900 } |
871 | 901 |
872 } // namespace media | 902 } // namespace media |
OLD | NEW |