[go: nahoru, domu]

media: Add WaitingCB and WaitingReason

- Add WaitingCB that is the generic callback to indicate that the media
  pipeline is stalling/waiting. The status for waiting is indicated in
  WaitingReason.
- Replace WaitingForDecryptionKeyCB with WaitingCB.

Bug: 858286
Test: No functionality change.
Change-Id: Ic709114e3a7ad94a2a9d0682c026815a306807a9
Reviewed-on: https://chromium-review.googlesource.com/c/1374200
Commit-Queue: Xiaohan Wang <xhwang@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Luke Halliwell <halliwell@chromium.org>
Reviewed-by: Dan Sanders <sandersd@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Frank Liberato <liberato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#617580}
diff --git a/media/filters/decrypting_audio_decoder_unittest.cc b/media/filters/decrypting_audio_decoder_unittest.cc
index 39d394a..00819b3a 100644
--- a/media/filters/decrypting_audio_decoder_unittest.cc
+++ b/media/filters/decrypting_audio_decoder_unittest.cc
@@ -80,12 +80,11 @@
         kNoTimestamp);
     decoded_frame_list_.push_back(decoded_frame_);
 
-    decoder_->Initialize(
-        config, cdm_context_.get(), NewExpectedBoolCB(success),
-        base::Bind(&DecryptingAudioDecoderTest::FrameReady,
-                   base::Unretained(this)),
-        base::Bind(&DecryptingAudioDecoderTest::OnWaitingForDecryptionKey,
-                   base::Unretained(this)));
+    decoder_->Initialize(config, cdm_context_.get(), NewExpectedBoolCB(success),
+                         base::Bind(&DecryptingAudioDecoderTest::FrameReady,
+                                    base::Unretained(this)),
+                         base::Bind(&DecryptingAudioDecoderTest::OnWaiting,
+                                    base::Unretained(this)));
     base::RunLoop().RunUntilIdle();
   }
 
@@ -119,12 +118,12 @@
         .WillOnce(RunCallback<1>(true));
     EXPECT_CALL(*decryptor_, RegisterNewKeyCB(Decryptor::kAudio, _))
         .WillOnce(SaveArg<1>(&key_added_cb_));
-    decoder_->Initialize(
-        new_config, cdm_context_.get(), NewExpectedBoolCB(true),
-        base::Bind(&DecryptingAudioDecoderTest::FrameReady,
-                   base::Unretained(this)),
-        base::Bind(&DecryptingAudioDecoderTest::OnWaitingForDecryptionKey,
-                   base::Unretained(this)));
+    decoder_->Initialize(new_config, cdm_context_.get(),
+                         NewExpectedBoolCB(true),
+                         base::Bind(&DecryptingAudioDecoderTest::FrameReady,
+                                    base::Unretained(this)),
+                         base::Bind(&DecryptingAudioDecoderTest::OnWaiting,
+                                    base::Unretained(this)));
   }
 
   // Decode |buffer| and expect DecodeDone to get called with |status|.
@@ -195,7 +194,7 @@
     EXPECT_CALL(*decryptor_, DecryptAndDecodeAudio(encrypted_buffer_, _))
         .WillRepeatedly(
             RunCallback<1>(Decryptor::kNoKey, Decryptor::AudioFrames()));
-    EXPECT_CALL(*this, OnWaitingForDecryptionKey());
+    EXPECT_CALL(*this, OnWaiting(WaitingReason::kNoDecryptionKey));
     decoder_->Decode(encrypted_buffer_,
                      base::Bind(&DecryptingAudioDecoderTest::DecodeDone,
                                 base::Unretained(this)));
@@ -241,7 +240,7 @@
   MOCK_METHOD1(FrameReady, void(const scoped_refptr<AudioBuffer>&));
   MOCK_METHOD1(DecodeDone, void(DecodeStatus));
 
-  MOCK_METHOD0(OnWaitingForDecryptionKey, void(void));
+  MOCK_METHOD1(OnWaiting, void(WaitingReason));
 
   base::MessageLoop message_loop_;
   MediaLog media_log_;