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

Unified Diff: media/filters/ffmpeg_video_decoder_unittest.cc

Issue 10964055: Call Decryptor::Stop() in FFmpegVideoDecoder::Reset(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: media/filters/ffmpeg_video_decoder_unittest.cc
diff --git a/media/filters/ffmpeg_video_decoder_unittest.cc b/media/filters/ffmpeg_video_decoder_unittest.cc
index 35c7bcbb8530bfc2ae2a32a41530545fd8c5d4fa..5a10eff826ef10b25baeaadf5935fe22eee3b4ae 100644
--- a/media/filters/ffmpeg_video_decoder_unittest.cc
+++ b/media/filters/ffmpeg_video_decoder_unittest.cc
@@ -64,6 +64,10 @@ ACTION_P2(RunDecryptCB, status, buffer) {
arg1.Run(status, buffer);
}
+ACTION_P3(RunDecryptCB3, decrypt_cb, status, buffer) {
+ decrypt_cb.Run(status, buffer);
+}
+
class FFmpegVideoDecoderTest : public testing::Test {
public:
FFmpegVideoDecoderTest()
@@ -574,6 +578,30 @@ TEST_F(FFmpegVideoDecoderTest, Reset_DuringPendingRead) {
message_loop_.RunAllPending();
}
+// Test resetting when there is a pending decrypt on the decryptor.
+TEST_F(FFmpegVideoDecoderTest, Reset_DuringPendingDecrypt) {
+ InitializeWithEncryptedConfig();
+
+ EXPECT_CALL(*demuxer_, Read(_))
+ .WillRepeatedly(ReturnBuffer(encrypted_i_frame_buffer_));
+
+ Decryptor::DecryptCB decrypt_cb;
+ EXPECT_CALL(*decryptor_, Decrypt(encrypted_i_frame_buffer_, _))
+ .WillOnce(SaveArg<1>(&decrypt_cb));
+
+ decoder_->Read(read_cb_);
+ message_loop_.RunAllPending();
+ // Make sure the Read() on the decoder triggers a Decrypt() on the decryptor.
+ EXPECT_FALSE(decrypt_cb.is_null());
+
+ EXPECT_CALL(*decryptor_, Stop())
+ .WillOnce(RunDecryptCB3(decrypt_cb, Decryptor::kError,
+ scoped_refptr<DecoderBuffer>(NULL)));
+ EXPECT_CALL(*this, FrameReady(VideoDecoder::kOk, IsNull()));
+ Reset();
+ message_loop_.RunAllPending();
+}
+
// Test stopping when decoder has initialized but not decoded.
TEST_F(FFmpegVideoDecoderTest, Stop_Initialized) {
Initialize();
@@ -606,8 +634,7 @@ TEST_F(FFmpegVideoDecoderTest, Stop_DuringPendingRead) {
decoder_->Read(read_cb_);
message_loop_.RunAllPending();
- // Make sure the Read() on the decoder triggers a Read() on
- // the demuxer.
+ // Make sure the Read() on the decoder triggers a Read() on the demuxer.
EXPECT_FALSE(read_cb.is_null());
Stop();
@@ -618,6 +645,29 @@ TEST_F(FFmpegVideoDecoderTest, Stop_DuringPendingRead) {
message_loop_.RunAllPending();
}
+// Test stopping when there is a pending decrypt on the decryptor.
+TEST_F(FFmpegVideoDecoderTest, Stop_DuringPendingDecrypt) {
+ InitializeWithEncryptedConfig();
+
+ EXPECT_CALL(*demuxer_, Read(_))
+ .WillRepeatedly(ReturnBuffer(encrypted_i_frame_buffer_));
+
+ Decryptor::DecryptCB decrypt_cb;
+ EXPECT_CALL(*decryptor_, Decrypt(encrypted_i_frame_buffer_, _))
+ .WillOnce(SaveArg<1>(&decrypt_cb));
+
+ decoder_->Read(read_cb_);
+ message_loop_.RunAllPending();
+ // Make sure the Read() on the decoder triggers a Decrypt() on the decryptor.
+ EXPECT_FALSE(decrypt_cb.is_null());
+
+ EXPECT_CALL(*decryptor_, Stop())
+ .WillOnce(RunDecryptCB3(decrypt_cb, Decryptor::kError,
+ scoped_refptr<DecoderBuffer>(NULL)));
+ EXPECT_CALL(*this, FrameReady(VideoDecoder::kOk, IsNull()));
+ Stop();
+ message_loop_.RunAllPending();
+}
// Test aborted read on the demuxer stream.
TEST_F(FFmpegVideoDecoderTest, AbortPendingRead) {
« media/filters/ffmpeg_video_decoder.cc ('K') | « media/filters/ffmpeg_video_decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698