diff options
author | erickung <erickung@chromium.org> | 2015-12-14 19:16:06 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-15 03:16:48 +0000 |
commit | 86c41b95fa00dfbd2efafa304db2cf8c8d752256 (patch) | |
tree | 9564c6dffbcca1029062e7402d0ef5a15c9118bd /chromecast | |
parent | 8ab64d267b768d3486c7b892df313c13ea9f7c7c (diff) | |
download | chromium_src-86c41b95fa00dfbd2efafa304db2cf8c8d752256.zip chromium_src-86c41b95fa00dfbd2efafa304db2cf8c8d752256.tar.gz chromium_src-86c41b95fa00dfbd2efafa304db2cf8c8d752256.tar.bz2 |
Chromecast: Hook up waiting_for_decryption_key callback
Bug: b/20956662
Review URL: https://codereview.chromium.org/1521543003
Cr-Commit-Position: refs/heads/master@{#365144}
Diffstat (limited to 'chromecast')
-rw-r--r-- | chromecast/browser/media/cma_message_filter_host.cc | 10 | ||||
-rw-r--r-- | chromecast/browser/media/cma_message_filter_host.h | 1 | ||||
-rw-r--r-- | chromecast/common/media/cma_messages.h | 3 | ||||
-rw-r--r-- | chromecast/media/cma/pipeline/av_pipeline_client.h | 3 | ||||
-rw-r--r-- | chromecast/media/cma/pipeline/av_pipeline_impl.cc | 2 | ||||
-rw-r--r-- | chromecast/renderer/media/cma_message_filter_proxy.cc | 12 | ||||
-rw-r--r-- | chromecast/renderer/media/cma_message_filter_proxy.h | 1 | ||||
-rw-r--r-- | chromecast/renderer/media/cma_renderer.cc | 9 | ||||
-rw-r--r-- | chromecast/renderer/media/cma_renderer.h | 1 |
9 files changed, 41 insertions, 1 deletions
diff --git a/chromecast/browser/media/cma_message_filter_host.cc b/chromecast/browser/media/cma_message_filter_host.cc index 96136b5..0a737cb 100644 --- a/chromecast/browser/media/cma_message_filter_host.cc +++ b/chromecast/browser/media/cma_message_filter_host.cc @@ -350,6 +350,8 @@ void CmaMessageFilterHost::AudioInitialize( } AvPipelineClient client; + client.wait_for_key_cb = ::media::BindToCurrentLoop(base::Bind( + &CmaMessageFilterHost::OnWaitForKey, weak_this_, media_id, track_id)); client.eos_cb = ::media::BindToCurrentLoop(base::Bind( &CmaMessageFilterHost::OnEos, weak_this_, media_id, track_id)); client.playback_error_cb = ::media::BindToCurrentLoop(base::Bind( @@ -380,6 +382,9 @@ void CmaMessageFilterHost::VideoInitialize( } VideoPipelineClient client; + client.av_pipeline_client.wait_for_key_cb = ::media::BindToCurrentLoop( + base::Bind(&CmaMessageFilterHost::OnWaitForKey, weak_this_, + media_id, track_id)); client.av_pipeline_client.eos_cb = ::media::BindToCurrentLoop( base::Bind(&CmaMessageFilterHost::OnEos, weak_this_, media_id, track_id)); @@ -498,6 +503,11 @@ void CmaMessageFilterHost::OnBufferingNotification( Send(new CmaMsg_BufferingNotification(media_id, state)); } +void CmaMessageFilterHost::OnWaitForKey(int media_id, TrackId track_id) { + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); + Send(new CmaMsg_WaitForKey(media_id, track_id)); +} + void CmaMessageFilterHost::OnEos(int media_id, TrackId track_id) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); Send(new CmaMsg_Eos(media_id, track_id)); diff --git a/chromecast/browser/media/cma_message_filter_host.h b/chromecast/browser/media/cma_message_filter_host.h index 6a1d6f2..acaafe3 100644 --- a/chromecast/browser/media/cma_message_filter_host.h +++ b/chromecast/browser/media/cma_message_filter_host.h @@ -101,6 +101,7 @@ class CmaMessageFilterHost base::TimeDelta max_media_time, base::TimeTicks stc); void OnBufferingNotification(int media_id, ::media::BufferingState state); + void OnWaitForKey(int media_id, TrackId track_id); void OnEos(int media_id, TrackId track_id); void OnPlaybackError(int media_id, TrackId track_id, ::media::PipelineStatus status); diff --git a/chromecast/common/media/cma_messages.h b/chromecast/common/media/cma_messages.h index 1649cc0..e273a68 100644 --- a/chromecast/common/media/cma_messages.h +++ b/chromecast/common/media/cma_messages.h @@ -92,6 +92,9 @@ IPC_MESSAGE_CONTROL2(CmaMsg_NotifyPipeRead, int /* Media pipeline ID */, chromecast::media::TrackId /* Track ID */) +IPC_MESSAGE_CONTROL2(CmaMsg_WaitForKey, + int /* Media pipeline ID */, + chromecast::media::TrackId /* Track ID */) IPC_MESSAGE_CONTROL2(CmaMsg_Eos, int /* Media pipeline ID */, chromecast::media::TrackId /* Track ID */) diff --git a/chromecast/media/cma/pipeline/av_pipeline_client.h b/chromecast/media/cma/pipeline/av_pipeline_client.h index 6928716..14525c6 100644 --- a/chromecast/media/cma/pipeline/av_pipeline_client.h +++ b/chromecast/media/cma/pipeline/av_pipeline_client.h @@ -19,6 +19,9 @@ struct AvPipelineClient { AvPipelineClient(); ~AvPipelineClient(); + // Decryption key status notification. + base::Closure wait_for_key_cb; + // End of stream notification. base::Closure eos_cb; diff --git a/chromecast/media/cma/pipeline/av_pipeline_impl.cc b/chromecast/media/cma/pipeline/av_pipeline_impl.cc index ee2d97c..71b29f1 100644 --- a/chromecast/media/cma/pipeline/av_pipeline_impl.cc +++ b/chromecast/media/cma/pipeline/av_pipeline_impl.cc @@ -250,6 +250,8 @@ void AvPipelineImpl::ProcessPendingBuffer() { CMALOG(kLogControl) << "frame(pts=" << pending_buffer_->timestamp() << "): waiting for key id " << base::HexEncode(&key_id[0], key_id.size()); + if (!client_.wait_for_key_cb.is_null()) + client_.wait_for_key_cb.Run(); return; } diff --git a/chromecast/renderer/media/cma_message_filter_proxy.cc b/chromecast/renderer/media/cma_message_filter_proxy.cc index c502ea2..c1e2c89 100644 --- a/chromecast/renderer/media/cma_message_filter_proxy.cc +++ b/chromecast/renderer/media/cma_message_filter_proxy.cc @@ -113,6 +113,7 @@ bool CmaMessageFilterProxy::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(CmaMsg_NotifyPipeRead, OnPipeRead) IPC_MESSAGE_HANDLER(CmaMsg_MediaStateChanged, OnMediaStateChanged) IPC_MESSAGE_HANDLER(CmaMsg_TrackStateChanged, OnTrackStateChanged) + IPC_MESSAGE_HANDLER(CmaMsg_WaitForKey, OnWaitForKey) IPC_MESSAGE_HANDLER(CmaMsg_Eos, OnEos) IPC_MESSAGE_HANDLER(CmaMsg_TimeUpdate, OnTimeUpdate) IPC_MESSAGE_HANDLER(CmaMsg_BufferingNotification, OnBufferingNotification) @@ -192,6 +193,17 @@ void CmaMessageFilterProxy::OnTrackStateChanged( cb.Run(status); } +void CmaMessageFilterProxy::OnWaitForKey(int id, TrackId track_id) { + DelegateEntry* entry = delegates_.Lookup(id); + if (!entry) + return; + const base::Closure& cb = (track_id == kAudioTrackId) ? + entry->audio_delegate.client.wait_for_key_cb : + entry->video_delegate.client.av_pipeline_client.wait_for_key_cb; + if (!cb.is_null()) + cb.Run(); +} + void CmaMessageFilterProxy::OnEos(int id, TrackId track_id) { DelegateEntry* entry = delegates_.Lookup(id); if (!entry) diff --git a/chromecast/renderer/media/cma_message_filter_proxy.h b/chromecast/renderer/media/cma_message_filter_proxy.h index ab00711..360f930 100644 --- a/chromecast/renderer/media/cma_message_filter_proxy.h +++ b/chromecast/renderer/media/cma_message_filter_proxy.h @@ -103,6 +103,7 @@ class CmaMessageFilterProxy : public IPC::MessageFilter { void OnMediaStateChanged(int id, ::media::PipelineStatus status); void OnTrackStateChanged(int id, TrackId track_id, ::media::PipelineStatus status); + void OnWaitForKey(int id, TrackId track_id); void OnEos(int id, TrackId track_id); void OnTimeUpdate(int id, base::TimeDelta time, diff --git a/chromecast/renderer/media/cma_renderer.cc b/chromecast/renderer/media/cma_renderer.cc index 0ba2b28..c410967 100644 --- a/chromecast/renderer/media/cma_renderer.cc +++ b/chromecast/renderer/media/cma_renderer.cc @@ -110,7 +110,6 @@ void CmaRenderer::Initialize( buffering_state_cb_ = buffering_state_cb; ended_cb_ = ended_cb; error_cb_ = error_cb; - // TODO(erickung): wire up waiting_for_decryption_key_cb. waiting_for_decryption_key_cb_ = waiting_for_decryption_key_cb; MediaPipelineClient media_pipeline_client; @@ -257,6 +256,8 @@ void CmaRenderer::InitializeAudioPipeline() { // Receive events from the audio pipeline. AvPipelineClient av_pipeline_client; + av_pipeline_client.wait_for_key_cb = ::media::BindToCurrentLoop( + base::Bind(&CmaRenderer::OnWaitForKey, weak_this_, true)); av_pipeline_client.eos_cb = ::media::BindToCurrentLoop( base::Bind(&CmaRenderer::OnEosReached, weak_this_, true)); av_pipeline_client.playback_error_cb = @@ -317,6 +318,8 @@ void CmaRenderer::InitializeVideoPipeline() { // Receive events from the video pipeline. VideoPipelineClient client; + client.av_pipeline_client.wait_for_key_cb = ::media::BindToCurrentLoop( + base::Bind(&CmaRenderer::OnWaitForKey, weak_this_, false)); client.av_pipeline_client.eos_cb = ::media::BindToCurrentLoop( base::Bind(&CmaRenderer::OnEosReached, weak_this_, false)); client.av_pipeline_client.playback_error_cb = @@ -364,6 +367,10 @@ void CmaRenderer::OnVideoPipelineInitializeDone( base::ResetAndReturn(&init_cb_).Run(::media::PIPELINE_OK); } +void CmaRenderer::OnWaitForKey(bool is_audio) { + waiting_for_decryption_key_cb_.Run(); +} + void CmaRenderer::OnEosReached(bool is_audio) { DCHECK(thread_checker_.CalledOnValidThread()); if (state_ != kPlaying) { diff --git a/chromecast/renderer/media/cma_renderer.h b/chromecast/renderer/media/cma_renderer.h index 0e674cb..70cbdf3 100644 --- a/chromecast/renderer/media/cma_renderer.h +++ b/chromecast/renderer/media/cma_renderer.h @@ -79,6 +79,7 @@ class CmaRenderer : public ::media::Renderer { ::media::PipelineStatus status); // Callbacks for AvPipelineClient. + void OnWaitForKey(bool is_audio); void OnEosReached(bool is_audio); void OnStatisticsUpdated(const ::media::PipelineStatistics& stats); void OnNaturalSizeChanged(const gfx::Size& size); |