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

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

Issue 903083003: Chromecast: change BrowserCdmCast threading model. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 5 years, 10 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"
11 #include "chromecast/media/base/decrypt_context.h" 11 #include "chromecast/media/base/decrypt_context.h"
12 #include "chromecast/media/cdm/browser_cdm_cast.h" 12 #include "chromecast/media/cdm/browser_cdm_cast.h"
13 #include "chromecast/media/cma/backend/media_clock_device.h" 13 #include "chromecast/media/cma/backend/media_clock_device.h"
14 #include "chromecast/media/cma/backend/media_component_device.h" 14 #include "chromecast/media/cma/backend/media_component_device.h"
15 #include "chromecast/media/cma/base/buffering_frame_provider.h" 15 #include "chromecast/media/cma/base/buffering_frame_provider.h"
16 #include "chromecast/media/cma/base/buffering_state.h" 16 #include "chromecast/media/cma/base/buffering_state.h"
17 #include "chromecast/media/cma/base/cma_logging.h" 17 #include "chromecast/media/cma/base/cma_logging.h"
18 #include "chromecast/media/cma/base/coded_frame_provider.h" 18 #include "chromecast/media/cma/base/coded_frame_provider.h"
19 #include "chromecast/media/cma/base/decoder_buffer_base.h" 19 #include "chromecast/media/cma/base/decoder_buffer_base.h"
20 #include "chromecast/media/cma/pipeline/decrypt_util.h" 20 #include "chromecast/media/cma/pipeline/decrypt_util.h"
21 #include "media/base/audio_decoder_config.h" 21 #include "media/base/audio_decoder_config.h"
22 #include "media/base/bind_to_current_loop.h"
22 #include "media/base/decrypt_config.h" 23 #include "media/base/decrypt_config.h"
23 24
24 namespace chromecast { 25 namespace chromecast {
25 namespace media { 26 namespace media {
26 27
27 namespace { 28 namespace {
28 29
29 const int kNoCallbackId = -1; 30 const int kNoCallbackId = -1;
30 31
31 } // namespace 32 } // namespace
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 181
181 void AvPipelineImpl::SetCdm(BrowserCdmCast* media_keys) { 182 void AvPipelineImpl::SetCdm(BrowserCdmCast* media_keys) {
182 DCHECK(thread_checker_.CalledOnValidThread()); 183 DCHECK(thread_checker_.CalledOnValidThread());
183 DCHECK(media_keys); 184 DCHECK(media_keys);
184 185
185 if (media_keys_ && media_keys_callback_id_ != kNoCallbackId) 186 if (media_keys_ && media_keys_callback_id_ != kNoCallbackId)
186 media_keys_->UnregisterPlayer(media_keys_callback_id_); 187 media_keys_->UnregisterPlayer(media_keys_callback_id_);
187 188
188 media_keys_ = media_keys; 189 media_keys_ = media_keys;
189 media_keys_callback_id_ = media_keys_->RegisterPlayer( 190 media_keys_callback_id_ = media_keys_->RegisterPlayer(
190 base::Bind(&AvPipelineImpl::OnCdmStateChanged, weak_this_), 191 ::media::BindToCurrentLoop(
191 base::Bind(&AvPipelineImpl::OnCdmDestroyed, weak_this_)); 192 base::Bind(&AvPipelineImpl::OnCdmStateChanged, weak_this_)),
193 ::media::BindToCurrentLoop(
194 base::Bind(&AvPipelineImpl::OnCdmDestroyed, weak_this_)));
192 } 195 }
193 196
194 void AvPipelineImpl::OnEos() { 197 void AvPipelineImpl::OnEos() {
195 DCHECK(thread_checker_.CalledOnValidThread()); 198 DCHECK(thread_checker_.CalledOnValidThread());
196 CMALOG(kLogControl) << __FUNCTION__; 199 CMALOG(kLogControl) << __FUNCTION__;
197 if (state_ != kPlaying) 200 if (state_ != kPlaying)
198 return; 201 return;
199 202
200 if (!client_.eos_cb.is_null()) 203 if (!client_.eos_cb.is_null())
201 client_.eos_cb.Run(); 204 client_.eos_cb.Run();
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 } 382 }
380 } 383 }
381 384
382 // The frame is playable: remove it from the list of non playable frames. 385 // The frame is playable: remove it from the list of non playable frames.
383 non_playable_frames_.pop_front(); 386 non_playable_frames_.pop_front();
384 } 387 }
385 } 388 }
386 389
387 } // namespace media 390 } // namespace media
388 } // namespace chromecast 391 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/media/cdm/browser_cdm_cast.cc ('k') | chromecast/media/cma/pipeline/media_pipeline_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698