Chromium Code Reviews| 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; |
| } |