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

Unified Diff: media/filters/source_buffer_stream_unittest.cc

Issue 251903008: Fix incorrect config id being associated with post splice buffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ChunkDemuxer test. Created 6 years, 8 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
« no previous file with comments | « media/filters/source_buffer_stream.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/source_buffer_stream_unittest.cc
diff --git a/media/filters/source_buffer_stream_unittest.cc b/media/filters/source_buffer_stream_unittest.cc
index ccd4f586ccfd569b4ef9b688504ba7e4e47070ef..97394107f60c4e6a97e7534c7bea2106d683424e 100644
--- a/media/filters/source_buffer_stream_unittest.cc
+++ b/media/filters/source_buffer_stream_unittest.cc
@@ -58,14 +58,17 @@ class SourceBufferStreamTest : public testing::Test {
void SetAudioStream() {
video_config_ = TestVideoConfig::Invalid();
accurate_durations_ = true;
- AudioDecoderConfig config(kCodecVorbis,
- kSampleFormatPlanarF32,
- CHANNEL_LAYOUT_STEREO,
- 1000,
- NULL,
- 0,
- false);
- stream_.reset(new SourceBufferStream(config, LogCB(), true));
+ audio_config_.Initialize(kCodecVorbis,
+ kSampleFormatPlanarF32,
+ CHANNEL_LAYOUT_STEREO,
+ 1000,
+ NULL,
+ 0,
+ false,
+ false,
+ base::TimeDelta(),
+ 0);
+ stream_.reset(new SourceBufferStream(audio_config_, LogCB(), true));
// Equivalent to 2ms per frame.
SetStreamInfo(500, 500);
@@ -316,6 +319,13 @@ class SourceBufferStreamTest : public testing::Test {
<< "\nActual: " << actual.AsHumanReadableString();
}
+ void CheckAudioConfig(const AudioDecoderConfig& config) {
+ const AudioDecoderConfig& actual = stream_->GetCurrentAudioDecoderConfig();
+ EXPECT_TRUE(actual.Matches(config))
+ << "Expected: " << config.AsHumanReadableString()
+ << "\nActual: " << actual.AsHumanReadableString();
+ }
+
const LogCB log_cb() {
return base::Bind(&SourceBufferStreamTest::DebugMediaLog,
base::Unretained(this));
@@ -325,6 +335,7 @@ class SourceBufferStreamTest : public testing::Test {
scoped_ptr<SourceBufferStream> stream_;
VideoDecoderConfig video_config_;
+ AudioDecoderConfig audio_config_;
private:
base::TimeDelta ConvertToFrameDuration(int frames_per_second) {
@@ -465,6 +476,7 @@ class SourceBufferStreamTest : public testing::Test {
if (last_splice_frame) {
// Require at least one additional buffer for a splice.
CHECK(!pre_splice_buffers.empty());
+ buffer->SetConfigId(splice_config_id);
buffer->ConvertToSpliceBuffer(pre_splice_buffers);
pre_splice_buffers.clear();
}
@@ -3593,8 +3605,9 @@ TEST_F(SourceBufferStreamTest, SpliceFrame_ConfigChangeWithinSplice) {
CheckExpectedBuffers("0K 3K C");
CheckVideoConfig(new_config);
CheckExpectedBuffers("6 9 C");
+ CheckExpectedBuffers("10 C");
CheckVideoConfig(video_config_);
- CheckExpectedBuffers("10 15");
+ CheckExpectedBuffers("15");
CheckNoNextBuffer();
}
@@ -3628,8 +3641,9 @@ TEST_F(SourceBufferStreamTest,
CheckExpectedBuffers("7K C");
CheckVideoConfig(new_config);
CheckExpectedBuffers("8 9 C");
+ CheckExpectedBuffers("10 C");
CheckVideoConfig(video_config_);
- CheckExpectedBuffers("10 20");
+ CheckExpectedBuffers("20");
CheckNoNextBuffer();
}
@@ -3704,6 +3718,28 @@ TEST_F(SourceBufferStreamTest, Audio_SpliceFrame_CorrectMediaSegmentStartTime) {
CheckNoNextBuffer();
}
+TEST_F(SourceBufferStreamTest, Audio_SpliceFrame_ConfigChange) {
+ SetAudioStream();
+
+ AudioDecoderConfig new_config(kCodecVorbis,
+ kSampleFormatPlanarF32,
+ CHANNEL_LAYOUT_MONO,
+ 1000,
+ NULL,
+ 0,
+ false);
+ ASSERT_NE(new_config.channel_layout(), audio_config_.channel_layout());
+
+ Seek(0);
+ CheckAudioConfig(audio_config_);
+ NewSegmentAppend("0K 2K 4K 6K");
+ stream_->UpdateAudioConfig(new_config);
+ NewSegmentAppend("5K 8K 12K");
+ CheckExpectedBuffers("0K 2K 4K 6K C 5K 8K 12K");
+ CheckAudioConfig(new_config);
+ CheckNoNextBuffer();
+}
+
// TODO(vrk): Add unit tests where keyframes are unaligned between streams.
// (crbug.com/133557)
« no previous file with comments | « media/filters/source_buffer_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698