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

Side by Side Diff: media/base/pipeline_impl.cc

Issue 1812543003: Allow muting/unmuting audio through media track API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blink-sb-tracks6
Patch Set: Avoid ChunkDemuxer/PipelineImpl deadlock Created 4 years, 8 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
« no previous file with comments | « media/base/pipeline_impl.h ('k') | media/base/renderer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « media/base/pipeline_impl.h ('k') | media/base/renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698