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

Unified 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: CmaMediaPipelineClient Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chromecast/media/cma/pipeline/media_pipeline_impl.cc
diff --git a/chromecast/media/cma/pipeline/media_pipeline_impl.cc b/chromecast/media/cma/pipeline/media_pipeline_impl.cc
index c9d0e288c76479a9604ef9e5c689fe7a440fe2c3..3feb62526150465f5a42bf821e4aad6ff68bd69f 100644
--- a/chromecast/media/cma/pipeline/media_pipeline_impl.cc
+++ b/chromecast/media/cma/pipeline/media_pipeline_impl.cc
@@ -66,6 +66,16 @@ MediaPipelineImpl::MediaPipelineImpl()
MediaPipelineImpl::~MediaPipelineImpl() {
CMALOG(kLogControl) << __FUNCTION__;
DCHECK(thread_checker_.CalledOnValidThread());
+
+ weak_factory_.InvalidateWeakPtrs();
+
+ // Since av pipeline still need to access device components in their
+ // destructor, it's important to delete them first.
+ video_pipeline_.reset();
+ audio_pipeline_.reset();
+ media_pipeline_backend_.reset();
+ if (!client_.pipeline_backend_destroyed_cb.is_null())
+ client_.pipeline_backend_destroyed_cb.Run();
}
void MediaPipelineImpl::Initialize(
@@ -75,6 +85,8 @@ void MediaPipelineImpl::Initialize(
DCHECK(thread_checker_.CalledOnValidThread());
media_pipeline_backend_.reset(media_pipeline_backend.release());
clock_device_ = media_pipeline_backend_->GetClock();
+ if (!client_.pipeline_backend_created_cb.is_null())
gunsch 2015/08/31 15:56:52 can we remove these checks, since they're also che
yucliu1 2015/08/31 17:30:08 In some tests, SetClient is never called, which le
+ client_.pipeline_backend_created_cb.Run();
if (load_type == kLoadTypeURL || load_type == kLoadTypeMediaSource) {
base::TimeDelta low_threshold(kLowBufferThresholdURL);
@@ -102,6 +114,8 @@ void MediaPipelineImpl::SetClient(const MediaPipelineClient& client) {
DCHECK(!client.error_cb.is_null());
DCHECK(!client.time_update_cb.is_null());
DCHECK(!client.buffering_state_cb.is_null());
+ DCHECK(!client.pipeline_backend_created_cb.is_null());
+ DCHECK(!client.pipeline_backend_destroyed_cb.is_null());
client_ = client;
}

Powered by Google App Engine
This is Rietveld 408576698