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

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

Issue 987513006: Chromecast: fixes crash in AvPipelineImpl teardown. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changes Finalize signature (not a build failure on arm...) Created 5 years, 9 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/av_pipeline_impl.h" 5 #include "chromecast/media/cma/pipeline/av_pipeline_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 pending_push_(false), 44 pending_push_(false),
45 enable_time_update_(false), 45 enable_time_update_(false),
46 pending_time_update_task_(false), 46 pending_time_update_task_(false),
47 media_keys_(NULL), 47 media_keys_(NULL),
48 media_keys_callback_id_(kNoCallbackId) { 48 media_keys_callback_id_(kNoCallbackId) {
49 DCHECK(media_component_device); 49 DCHECK(media_component_device);
50 thread_checker_.DetachFromThread(); 50 thread_checker_.DetachFromThread();
51 } 51 }
52 52
53 AvPipelineImpl::~AvPipelineImpl() { 53 AvPipelineImpl::~AvPipelineImpl() {
54 // If there are weak pointers in the wild, they must be invalidated
55 // on the right thread.
56 DCHECK(thread_checker_.CalledOnValidThread());
57 media_component_device_->SetClient(MediaComponentDevice::Client());
58
59 {
60 base::AutoLock lock(media_keys_lock_);
61 if (media_keys_ && media_keys_callback_id_ != kNoCallbackId)
62 media_keys_->UnregisterPlayer(media_keys_callback_id_);
63 }
64 } 54 }
65 55
66 void AvPipelineImpl::TransitionToState(State state) { 56 void AvPipelineImpl::TransitionToState(State state) {
67 DCHECK(thread_checker_.CalledOnValidThread()); 57 DCHECK(thread_checker_.CalledOnValidThread());
68 state_ = state; 58 state_ = state;
69 } 59 }
70 60
71 void AvPipelineImpl::SetCodedFrameProvider( 61 void AvPipelineImpl::SetCodedFrameProvider(
72 scoped_ptr<CodedFrameProvider> frame_provider, 62 scoped_ptr<CodedFrameProvider> frame_provider,
73 size_t max_buffer_size, 63 size_t max_buffer_size,
(...skipping 22 matching lines...) Expand all
96 86
97 MediaComponentDevice::Client client; 87 MediaComponentDevice::Client client;
98 client.eos_cb = base::Bind(&AvPipelineImpl::OnEos, this); 88 client.eos_cb = base::Bind(&AvPipelineImpl::OnEos, this);
99 media_component_device_->SetClient(client); 89 media_component_device_->SetClient(client);
100 if (!media_component_device_->SetState(MediaComponentDevice::kStateIdle)) 90 if (!media_component_device_->SetState(MediaComponentDevice::kStateIdle))
101 return false; 91 return false;
102 92
103 return true; 93 return true;
104 } 94 }
105 95
96 void AvPipelineImpl::Finalize() {
97 DCHECK(thread_checker_.CalledOnValidThread());
98 media_component_device_->SetClient(MediaComponentDevice::Client());
99
100 enable_feeding_ = false;
101 media_component_device_ = NULL;
102
103 {
104 base::AutoLock lock(media_keys_lock_);
105 if (media_keys_ && media_keys_callback_id_ != kNoCallbackId)
106 media_keys_->UnregisterPlayer(media_keys_callback_id_);
107 }
108 }
109
106 bool AvPipelineImpl::StartPlayingFrom( 110 bool AvPipelineImpl::StartPlayingFrom(
107 base::TimeDelta time, 111 base::TimeDelta time,
108 const scoped_refptr<BufferingState>& buffering_state) { 112 const scoped_refptr<BufferingState>& buffering_state) {
109 DCHECK(thread_checker_.CalledOnValidThread()); 113 DCHECK(thread_checker_.CalledOnValidThread());
110 DCHECK_EQ(state_, kFlushed); 114 DCHECK_EQ(state_, kFlushed);
111 115
112 // Media time where rendering should start 116 // Media time where rendering should start
113 // and switch to a state where the audio device accepts incoming buffers. 117 // and switch to a state where the audio device accepts incoming buffers.
114 if (!media_component_device_->SetStartPts(time) || 118 if (!media_component_device_->SetStartPts(time) ||
115 !media_component_device_->SetState(MediaComponentDevice::kStatePaused)) { 119 !media_component_device_->SetState(MediaComponentDevice::kStatePaused)) {
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 } 396 }
393 } 397 }
394 398
395 // The frame is playable: remove it from the list of non playable frames. 399 // The frame is playable: remove it from the list of non playable frames.
396 non_playable_frames_.pop_front(); 400 non_playable_frames_.pop_front();
397 } 401 }
398 } 402 }
399 403
400 } // namespace media 404 } // namespace media
401 } // namespace chromecast 405 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/media/cma/pipeline/av_pipeline_impl.h ('k') | chromecast/media/cma/pipeline/video_pipeline_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698