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

Side by Side Diff: media/filters/chunk_demuxer_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, 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/media/webmediaplayer_impl.cc ('k') | media/filters/source_buffer_stream.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 2551 matching lines...) Expand 10 before | Expand all | Expand 10 after
2562 EXPECT_EQ(audio_config_1.samples_per_second(), 44100); 2562 EXPECT_EQ(audio_config_1.samples_per_second(), 44100);
2563 EXPECT_EQ(audio_config_1.extra_data_size(), 3863u); 2563 EXPECT_EQ(audio_config_1.extra_data_size(), 3863u);
2564 2564
2565 ExpectRead(DemuxerStream::AUDIO, 0); 2565 ExpectRead(DemuxerStream::AUDIO, 0);
2566 2566
2567 // The first config change seen is from a splice frame representing an overlap 2567 // The first config change seen is from a splice frame representing an overlap
2568 // of buffer from config 1 by buffers from config 2. 2568 // of buffer from config 1 by buffers from config 2.
2569 ReadUntilNotOkOrEndOfStream(DemuxerStream::AUDIO, &status, &last_timestamp); 2569 ReadUntilNotOkOrEndOfStream(DemuxerStream::AUDIO, &status, &last_timestamp);
2570 ASSERT_EQ(status, DemuxerStream::kConfigChanged); 2570 ASSERT_EQ(status, DemuxerStream::kConfigChanged);
2571 EXPECT_EQ(last_timestamp.InMilliseconds(), 524); 2571 EXPECT_EQ(last_timestamp.InMilliseconds(), 524);
2572 ASSERT_TRUE(audio_config_1.Matches(audio->audio_decoder_config()));
2573
2574 // The next is due to a typical config difference.
2575 ReadUntilNotOkOrEndOfStream(DemuxerStream::AUDIO, &status, &last_timestamp);
2576 ASSERT_EQ(status, DemuxerStream::kConfigChanged);
2577 EXPECT_EQ(last_timestamp.InMilliseconds(), 527);
2578 2572
2579 // Fetch the new decoder config. 2573 // Fetch the new decoder config.
2580 const AudioDecoderConfig& audio_config_2 = audio->audio_decoder_config(); 2574 const AudioDecoderConfig& audio_config_2 = audio->audio_decoder_config();
2581 ASSERT_TRUE(audio_config_2.IsValidConfig()); 2575 ASSERT_TRUE(audio_config_2.IsValidConfig());
2582 EXPECT_EQ(audio_config_2.samples_per_second(), 44100); 2576 EXPECT_EQ(audio_config_2.samples_per_second(), 44100);
2583 EXPECT_EQ(audio_config_2.extra_data_size(), 3935u); 2577 EXPECT_EQ(audio_config_2.extra_data_size(), 3935u);
2584 2578
2585 // The next config change is from a splice frame representing an overlap of 2579 // The next config change is from a splice frame representing an overlap of
2586 // buffers from config 2 by buffers from config 1. 2580 // buffers from config 2 by buffers from config 1.
2587 ReadUntilNotOkOrEndOfStream(DemuxerStream::AUDIO, &status, &last_timestamp); 2581 ReadUntilNotOkOrEndOfStream(DemuxerStream::AUDIO, &status, &last_timestamp);
2588 ASSERT_EQ(status, DemuxerStream::kConfigChanged); 2582 ASSERT_EQ(status, DemuxerStream::kConfigChanged);
2589 EXPECT_EQ(last_timestamp.InMilliseconds(), 782); 2583 EXPECT_EQ(last_timestamp.InMilliseconds(), 782);
2590 ASSERT_TRUE(audio_config_2.Matches(audio->audio_decoder_config()));
2591
2592 ReadUntilNotOkOrEndOfStream(DemuxerStream::AUDIO, &status, &last_timestamp);
2593
2594 ASSERT_EQ(status, DemuxerStream::kConfigChanged);
2595 EXPECT_EQ(last_timestamp.InMilliseconds(), 779);
2596
2597 // Get the new config and verify that it matches the first one.
2598 ASSERT_TRUE(audio_config_1.Matches(audio->audio_decoder_config())); 2584 ASSERT_TRUE(audio_config_1.Matches(audio->audio_decoder_config()));
2599 2585
2600 // Read until the end of the stream just to make sure there aren't any other 2586 // Read until the end of the stream just to make sure there aren't any other
2601 // config changes. 2587 // config changes.
2602 ReadUntilNotOkOrEndOfStream(DemuxerStream::AUDIO, &status, &last_timestamp); 2588 ReadUntilNotOkOrEndOfStream(DemuxerStream::AUDIO, &status, &last_timestamp);
2603 ASSERT_EQ(status, DemuxerStream::kOk); 2589 ASSERT_EQ(status, DemuxerStream::kOk);
2604 EXPECT_EQ(last_timestamp.InMilliseconds(), 2744); 2590 EXPECT_EQ(last_timestamp.InMilliseconds(), 2744);
2605 } 2591 }
2606 2592
2607 TEST_P(ChunkDemuxerTest, ConfigChange_Seek) { 2593 TEST_P(ChunkDemuxerTest, ConfigChange_Seek) {
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
3199 // Verify that audio & video streams continue to return expected values. 3185 // Verify that audio & video streams continue to return expected values.
3200 CheckExpectedBuffers(audio_stream, "160 180"); 3186 CheckExpectedBuffers(audio_stream, "160 180");
3201 CheckExpectedBuffers(video_stream, "180 210"); 3187 CheckExpectedBuffers(video_stream, "180 210");
3202 } 3188 }
3203 3189
3204 // TODO(wolenetz): Enable testing of new frame processor based on this flag, 3190 // TODO(wolenetz): Enable testing of new frame processor based on this flag,
3205 // once the new processor has landed. See http://crbug.com/249422. 3191 // once the new processor has landed. See http://crbug.com/249422.
3206 INSTANTIATE_TEST_CASE_P(LegacyFrameProcessor, ChunkDemuxerTest, Values(true)); 3192 INSTANTIATE_TEST_CASE_P(LegacyFrameProcessor, ChunkDemuxerTest, Values(true));
3207 3193
3208 } // namespace media 3194 } // namespace media
OLDNEW
« no previous file with comments | « content/renderer/media/webmediaplayer_impl.cc ('k') | media/filters/source_buffer_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698