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

Side by Side Diff: chromecast/media/cma/pipeline/media_pipeline_impl.cc

Issue 1306843003: CmaMediaPipelineClient to watch media pipeline status (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chromecast/media/cma/pipeline/media_pipeline_impl.h" 5 #include "chromecast/media/cma/pipeline/media_pipeline_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 statistics_rolling_counter_(0), 59 statistics_rolling_counter_(0),
60 weak_factory_(this) { 60 weak_factory_(this) {
61 CMALOG(kLogControl) << __FUNCTION__; 61 CMALOG(kLogControl) << __FUNCTION__;
62 weak_this_ = weak_factory_.GetWeakPtr(); 62 weak_this_ = weak_factory_.GetWeakPtr();
63 thread_checker_.DetachFromThread(); 63 thread_checker_.DetachFromThread();
64 } 64 }
65 65
66 MediaPipelineImpl::~MediaPipelineImpl() { 66 MediaPipelineImpl::~MediaPipelineImpl() {
67 CMALOG(kLogControl) << __FUNCTION__; 67 CMALOG(kLogControl) << __FUNCTION__;
68 DCHECK(thread_checker_.CalledOnValidThread()); 68 DCHECK(thread_checker_.CalledOnValidThread());
69
70 weak_factory_.InvalidateWeakPtrs();
71
72 // Since av pipeline still need to access device components in their
73 // destructor, it's important to delete them first.
74 video_pipeline_.reset();
75 audio_pipeline_.reset();
76 media_pipeline_backend_.reset();
77 client_.device_components_destroy_cb.Run();
halliwell 2015/08/25 00:48:34 I think you have to check is_null before calling?
yucliu1 2015/08/25 00:53:11 The SetClient requires that all the callbacks can
halliwell 2015/08/25 01:02:49 You didn't add DCHECKs to SetClient for these new
yucliu1 2015/08/25 04:27:58 Done.
69 } 78 }
70 79
71 void MediaPipelineImpl::Initialize( 80 void MediaPipelineImpl::Initialize(
72 LoadType load_type, 81 LoadType load_type,
73 scoped_ptr<MediaPipelineBackend> media_pipeline_backend) { 82 scoped_ptr<MediaPipelineBackend> media_pipeline_backend) {
74 CMALOG(kLogControl) << __FUNCTION__; 83 CMALOG(kLogControl) << __FUNCTION__;
75 DCHECK(thread_checker_.CalledOnValidThread()); 84 DCHECK(thread_checker_.CalledOnValidThread());
76 media_pipeline_backend_.reset(media_pipeline_backend.release()); 85 media_pipeline_backend_.reset(media_pipeline_backend.release());
77 clock_device_ = media_pipeline_backend_->GetClock(); 86 clock_device_ = media_pipeline_backend_->GetClock();
87 client_.device_components_create_cb.Run();
halliwell 2015/08/25 00:48:34 same here.
yucliu1 2015/08/25 04:27:58 Done.
78 88
79 if (load_type == kLoadTypeURL || load_type == kLoadTypeMediaSource) { 89 if (load_type == kLoadTypeURL || load_type == kLoadTypeMediaSource) {
80 base::TimeDelta low_threshold(kLowBufferThresholdURL); 90 base::TimeDelta low_threshold(kLowBufferThresholdURL);
81 base::TimeDelta high_threshold(kHighBufferThresholdURL); 91 base::TimeDelta high_threshold(kHighBufferThresholdURL);
82 if (load_type == kLoadTypeMediaSource) { 92 if (load_type == kLoadTypeMediaSource) {
83 low_threshold = kLowBufferThresholdMediaSource; 93 low_threshold = kLowBufferThresholdMediaSource;
84 high_threshold = kHighBufferThresholdMediaSource; 94 high_threshold = kHighBufferThresholdMediaSource;
85 } 95 }
86 scoped_refptr<BufferingConfig> buffering_config( 96 scoped_refptr<BufferingConfig> buffering_config(
87 new BufferingConfig(low_threshold, high_threshold)); 97 new BufferingConfig(low_threshold, high_threshold));
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 378
369 void MediaPipelineImpl::OnError(::media::PipelineStatus error) { 379 void MediaPipelineImpl::OnError(::media::PipelineStatus error) {
370 DCHECK(thread_checker_.CalledOnValidThread()); 380 DCHECK(thread_checker_.CalledOnValidThread());
371 DCHECK_NE(error, ::media::PIPELINE_OK) << "PIPELINE_OK is not an error!"; 381 DCHECK_NE(error, ::media::PIPELINE_OK) << "PIPELINE_OK is not an error!";
372 if (!client_.error_cb.is_null()) 382 if (!client_.error_cb.is_null())
373 client_.error_cb.Run(error); 383 client_.error_cb.Run(error);
374 } 384 }
375 385
376 } // namespace media 386 } // namespace media
377 } // namespace chromecast 387 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698