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

Unified Diff: media/filters/opus_audio_decoder_unittest.cc

Issue 297553002: Add callback in VideoDecoder and AudioDecoder to return decoded frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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/opus_audio_decoder_unittest.cc
diff --git a/media/filters/opus_audio_decoder_unittest.cc b/media/filters/opus_audio_decoder_unittest.cc
index 199dd7c2d893c89a30fa574d2010d60ce8d6577f..af9811ecedbe49af4a35945ae0e4c6761b4a2ac6 100644
--- a/media/filters/opus_audio_decoder_unittest.cc
+++ b/media/filters/opus_audio_decoder_unittest.cc
@@ -35,7 +35,10 @@ class OpusAudioDecoderTest : public testing::Test {
AudioDecoderConfig config;
AVCodecContextToAudioDecoderConfig(
reader_->codec_context_for_testing(), false, &config, false);
- decoder_->Initialize(config, NewExpectedStatusCB(PIPELINE_OK));
+ decoder_->Initialize(config,
+ NewExpectedStatusCB(PIPELINE_OK),
+ base::Bind(&OpusAudioDecoderTest::OnDecoderOutput,
+ base::Unretained(this)));
base::RunLoop().RunUntilIdle();
}
@@ -85,22 +88,16 @@ class OpusAudioDecoderTest : public testing::Test {
base::RunLoop().RunUntilIdle();
}
- void DecodeFinished(AudioDecoder::Status status,
- const scoped_refptr<AudioBuffer>& buffer) {
+ void OnDecoderOutput(const scoped_refptr<AudioBuffer>& buffer) {
+ decoded_audio_.push_back(buffer);
+ }
+
+ void DecodeFinished(AudioDecoder::Status status) {
EXPECT_TRUE(pending_decode_);
pending_decode_ = false;
- if (status == AudioDecoder::kNotEnoughData) {
- EXPECT_TRUE(buffer.get() == NULL);
- Decode();
- return;
- }
-
- decoded_audio_.push_back(buffer);
-
- // If we hit a NULL buffer or have a pending reset, we expect an abort.
- if (buffer.get() == NULL || pending_reset_) {
- EXPECT_TRUE(buffer.get() == NULL);
+ // If we have a pending reset, we expect an abort.
+ if (pending_reset_) {
EXPECT_EQ(status, AudioDecoder::kAborted);
return;
}

Powered by Google App Engine
This is Rietveld 408576698