[go: nahoru, domu]

Plumb through the WaitingCB when waiting for keys

When using a DecryptingRenderer and DecryptingMediaResource we do not
currently handle the prescence of a CdmContext with the absence of the
media keys correctly. This was previously handled by providing a
callback that would invoked OnWaiting() on the RendererClient interface.
This callback needs to be provided when using a DecryptingMediaResource.

Bug: None.
Change-Id: I007e444663ea7abc1a6c6e309148474139581f07
Reviewed-on: https://chromium-review.googlesource.com/c/1398514
Reviewed-by: Sergey Volk <servolk@chromium.org>
Reviewed-by: Xiaohan Wang <xhwang@chromium.org>
Commit-Queue: Chad Duffin <chadduffin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#620599}
diff --git a/media/filters/decrypting_media_resource.cc b/media/filters/decrypting_media_resource.cc
index 882f1be..8f783923 100644
--- a/media/filters/decrypting_media_resource.cc
+++ b/media/filters/decrypting_media_resource.cc
@@ -53,7 +53,7 @@
   return media_resource_->GetMediaUrlParams();
 }
 
-void DecryptingMediaResource::Initialize(InitCB init_cb) {
+void DecryptingMediaResource::Initialize(InitCB init_cb, WaitingCB waiting_cb) {
   DCHECK(init_cb);
 
   auto streams = media_resource_->GetAllStreams();
@@ -64,11 +64,8 @@
   num_dds_pending_init_ = streams.size();
 
   for (auto* stream : streams) {
-    // TODO(chadduffin): Implement proper handling of the media::WaitingCB such
-    // that when the DecryptingDemuxerStream is waiting for a decryption key
-    // the firing of the callback will be bubbled up to the media pipeline.
     auto decrypting_demuxer_stream = std::make_unique<DecryptingDemuxerStream>(
-        task_runner_, media_log_, base::DoNothing());
+        task_runner_, media_log_, waiting_cb);
 
     // DecryptingDemuxerStream always invokes the callback asynchronously so
     // that we have no reentrancy issues. "All public APIs and callbacks are