[go: nahoru, domu]

Break out DecoderStatus from Status.

Moves all the status codes that media::Decoder used for ::Initialize()
and ::Decode() out into their own TypedStatus implementation.

This is the last major thing to remove from StatusCodeType - with just
Mojo and PipelineError left.

R=liberato

Change-Id: I6ba6af1151076cb5a67a2c5a2395ced53d98faef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3353823
Reviewed-by: Kenneth MacKay <kmackay@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Reviewed-by: Eugene Zemtsov <eugene@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: David Staessens <dstaessens@chromium.org>
Reviewed-by: Yusuke Sato <yusukes@chromium.org>
Commit-Queue: Ted (Chromium) Meyer <tmathmeyer@chromium.org>
Cr-Commit-Position: refs/heads/main@{#957889}
diff --git a/media/filters/decrypting_audio_decoder_unittest.cc b/media/filters/decrypting_audio_decoder_unittest.cc
index a55e5d5f..0774de1 100644
--- a/media/filters/decrypting_audio_decoder_unittest.cc
+++ b/media/filters/decrypting_audio_decoder_unittest.cc
@@ -89,7 +89,7 @@
     decoder_->Initialize(
         config, cdm_context_.get(),
         base::BindOnce(
-            [](bool success, Status status) {
+            [](bool success, DecoderStatus status) {
               EXPECT_EQ(status.is_ok(), success);
             },
             success),
@@ -132,7 +132,8 @@
         .WillOnce(RunOnceCallback<1>(true));
     decoder_->Initialize(
         new_config, cdm_context_.get(),
-        base::BindOnce([](Status status) { EXPECT_TRUE(status.is_ok()); }),
+        base::BindOnce(
+            [](DecoderStatus status) { EXPECT_TRUE(status.is_ok()); }),
         base::BindRepeating(&DecryptingAudioDecoderTest::FrameReady,
                             base::Unretained(this)),
         base::BindRepeating(&DecryptingAudioDecoderTest::OnWaiting,
@@ -140,7 +141,8 @@
   }
 
   // Decode |buffer| and expect DecodeDone to get called with |status|.
-  void DecodeAndExpect(scoped_refptr<DecoderBuffer> buffer, StatusCode status) {
+  void DecodeAndExpect(scoped_refptr<DecoderBuffer> buffer,
+                       DecoderStatus status) {
     EXPECT_CALL(*this, DecodeDone(HasStatusCode(status)));
     decoder_->Decode(buffer,
                      base::BindOnce(&DecryptingAudioDecoderTest::DecodeDone,
@@ -176,7 +178,7 @@
             Invoke(this, &DecryptingAudioDecoderTest::DecryptAndDecodeAudio));
     EXPECT_CALL(*this, FrameReady(decoded_frame_));
     for (int i = 0; i < kDecodingDelay + 1; ++i)
-      DecodeAndExpect(encrypted_buffer_, DecodeStatus::OK);
+      DecodeAndExpect(encrypted_buffer_, DecoderStatus::Codes::kOk);
   }
 
   // Sets up expectations and actions to put DecryptingAudioDecoder in an end
@@ -185,7 +187,8 @@
   void EnterEndOfStreamState() {
     // The codec in the |decryptor_| will be flushed.
     EXPECT_CALL(*this, FrameReady(decoded_frame_)).Times(kDecodingDelay);
-    DecodeAndExpect(DecoderBuffer::CreateEOSBuffer(), DecodeStatus::OK);
+    DecodeAndExpect(DecoderBuffer::CreateEOSBuffer(),
+                    DecoderStatus::Codes::kOk);
     EXPECT_EQ(0, num_frames_in_decryptor_);
   }
 
@@ -252,7 +255,7 @@
   }
 
   MOCK_METHOD1(FrameReady, void(scoped_refptr<AudioBuffer>));
-  MOCK_METHOD1(DecodeDone, void(Status));
+  MOCK_METHOD1(DecodeDone, void(DecoderStatus));
 
   MOCK_METHOD1(OnWaiting, void(WaitingReason));
 
@@ -329,7 +332,7 @@
       .WillRepeatedly(
           RunOnceCallback<1>(Decryptor::kError, Decryptor::AudioFrames()));
 
-  DecodeAndExpect(encrypted_buffer_, DecodeStatus::DECODE_ERROR);
+  DecodeAndExpect(encrypted_buffer_, DecoderStatus::Codes::kFailed);
 }
 
 // Test the case where the decryptor returns multiple decoded frames.
@@ -353,7 +356,7 @@
   EXPECT_CALL(*this, FrameReady(decoded_frame_));
   EXPECT_CALL(*this, FrameReady(frame_a));
   EXPECT_CALL(*this, FrameReady(frame_b));
-  DecodeAndExpect(encrypted_buffer_, DecodeStatus::OK);
+  DecodeAndExpect(encrypted_buffer_, DecoderStatus::Codes::kOk);
 }
 
 // Test the case where the decryptor receives end-of-stream buffer.
@@ -461,7 +464,7 @@
   Initialize();
   EnterPendingDecodeState();
 
-  EXPECT_CALL(*this, DecodeDone(HasStatusCode(StatusCode::kAborted)));
+  EXPECT_CALL(*this, DecodeDone(HasStatusCode(DecoderStatus::Codes::kAborted)));
 
   Reset();
 }
@@ -471,7 +474,7 @@
   Initialize();
   EnterWaitingForKeyState();
 
-  EXPECT_CALL(*this, DecodeDone(HasStatusCode(StatusCode::kAborted)));
+  EXPECT_CALL(*this, DecodeDone(HasStatusCode(DecoderStatus::Codes::kAborted)));
 
   Reset();
 }