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

Side by Side Diff: media/filters/source_buffer_stream_unittest.cc

Issue 1786733004: Revert of media config: expand is_encrypted to a struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « media/filters/source_buffer_stream.cc ('k') | media/formats/mp2t/es_adapter_video_unittest.cc » ('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 "media/filters/source_buffer_stream.h" 5 #include "media/filters/source_buffer_stream.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 void SetTextStream() { 89 void SetTextStream() {
90 video_config_ = TestVideoConfig::Invalid(); 90 video_config_ = TestVideoConfig::Invalid();
91 TextTrackConfig config(kTextSubtitles, "", "", ""); 91 TextTrackConfig config(kTextSubtitles, "", "", "");
92 stream_.reset(new SourceBufferStream(config, media_log_, true)); 92 stream_.reset(new SourceBufferStream(config, media_log_, true));
93 SetStreamInfo(2, 2); 93 SetStreamInfo(2, 2);
94 } 94 }
95 95
96 void SetAudioStream() { 96 void SetAudioStream() {
97 video_config_ = TestVideoConfig::Invalid(); 97 video_config_ = TestVideoConfig::Invalid();
98 audio_config_.Initialize(kCodecVorbis, kSampleFormatPlanarF32, 98 audio_config_.Initialize(kCodecVorbis,
99 CHANNEL_LAYOUT_STEREO, 1000, EmptyExtraData(), 99 kSampleFormatPlanarF32,
100 Unencrypted(), base::TimeDelta(), 0); 100 CHANNEL_LAYOUT_STEREO,
101 1000,
102 EmptyExtraData(),
103 false,
104 base::TimeDelta(),
105 0);
101 stream_.reset(new SourceBufferStream(audio_config_, media_log_, true)); 106 stream_.reset(new SourceBufferStream(audio_config_, media_log_, true));
102 107
103 // Equivalent to 2ms per frame. 108 // Equivalent to 2ms per frame.
104 SetStreamInfo(500, 500); 109 SetStreamInfo(500, 500);
105 } 110 }
106 111
107 void NewCodedFrameGroupAppend(int starting_position, int number_of_buffers) { 112 void NewCodedFrameGroupAppend(int starting_position, int number_of_buffers) {
108 AppendBuffers(starting_position, number_of_buffers, true, 113 AppendBuffers(starting_position, number_of_buffers, true,
109 base::TimeDelta(), true, &kDataA, kDataSize); 114 base::TimeDelta(), true, &kDataA, kDataSize);
110 } 115 }
(...skipping 3530 matching lines...) Expand 10 before | Expand all | Expand 10 after
3641 AppendBuffers("90 110K 150"); 3646 AppendBuffers("90 110K 150");
3642 Seek(0); 3647 Seek(0);
3643 CheckExpectedBuffers("0K 20 40 60 80 90 90 110K 150"); 3648 CheckExpectedBuffers("0K 20 40 60 80 90 90 110K 150");
3644 CheckNoNextBuffer(); 3649 CheckNoNextBuffer();
3645 CheckExpectedRangesByTimestamp("{ [0,190) }"); 3650 CheckExpectedRangesByTimestamp("{ [0,190) }");
3646 } 3651 }
3647 3652
3648 // Test all the valid same timestamp cases for audio. 3653 // Test all the valid same timestamp cases for audio.
3649 TEST_F(SourceBufferStreamTest, SameTimestamp_Audio) { 3654 TEST_F(SourceBufferStreamTest, SameTimestamp_Audio) {
3650 AudioDecoderConfig config(kCodecMP3, kSampleFormatF32, CHANNEL_LAYOUT_STEREO, 3655 AudioDecoderConfig config(kCodecMP3, kSampleFormatF32, CHANNEL_LAYOUT_STEREO,
3651 44100, EmptyExtraData(), Unencrypted()); 3656 44100, EmptyExtraData(), false);
3652 stream_.reset(new SourceBufferStream(config, media_log_, true)); 3657 stream_.reset(new SourceBufferStream(config, media_log_, true));
3653 Seek(0); 3658 Seek(0);
3654 NewCodedFrameGroupAppend("0K 0K 30K 30 60 60"); 3659 NewCodedFrameGroupAppend("0K 0K 30K 30 60 60");
3655 CheckExpectedBuffers("0K 0K 30K 30 60 60"); 3660 CheckExpectedBuffers("0K 0K 30K 30 60 60");
3656 } 3661 }
3657 3662
3658 TEST_F(SourceBufferStreamTest, SameTimestamp_Audio_SingleAppend_Warning) { 3663 TEST_F(SourceBufferStreamTest, SameTimestamp_Audio_SingleAppend_Warning) {
3659 EXPECT_MEDIA_LOG(ContainsSameTimestampAt30MillisecondsLog()); 3664 EXPECT_MEDIA_LOG(ContainsSameTimestampAt30MillisecondsLog());
3660 3665
3661 AudioDecoderConfig config(kCodecMP3, kSampleFormatF32, CHANNEL_LAYOUT_STEREO, 3666 AudioDecoderConfig config(kCodecMP3, kSampleFormatF32, CHANNEL_LAYOUT_STEREO,
3662 44100, EmptyExtraData(), Unencrypted()); 3667 44100, EmptyExtraData(), false);
3663 stream_.reset(new SourceBufferStream(config, media_log_, true)); 3668 stream_.reset(new SourceBufferStream(config, media_log_, true));
3664 Seek(0); 3669 Seek(0);
3665 3670
3666 // Note, in reality, a non-keyframe audio frame is rare or perhaps not 3671 // Note, in reality, a non-keyframe audio frame is rare or perhaps not
3667 // possible. 3672 // possible.
3668 NewCodedFrameGroupAppend("0K 30 30K 60"); 3673 NewCodedFrameGroupAppend("0K 30 30K 60");
3669 CheckExpectedBuffers("0K 30 30K 60"); 3674 CheckExpectedBuffers("0K 30 30K 60");
3670 } 3675 }
3671 3676
3672 // If seeking past any existing range and the seek is pending 3677 // If seeking past any existing range and the seek is pending
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
4217 CheckNoNextBuffer(); 4222 CheckNoNextBuffer();
4218 } 4223 }
4219 4224
4220 TEST_F(SourceBufferStreamTest, Audio_SpliceFrame_ConfigChange) { 4225 TEST_F(SourceBufferStreamTest, Audio_SpliceFrame_ConfigChange) {
4221 EXPECT_MEDIA_LOG(ContainsGeneratedSpliceLog(3000, 5000)); 4226 EXPECT_MEDIA_LOG(ContainsGeneratedSpliceLog(3000, 5000));
4222 4227
4223 SetAudioStream(); 4228 SetAudioStream();
4224 4229
4225 AudioDecoderConfig new_config(kCodecVorbis, kSampleFormatPlanarF32, 4230 AudioDecoderConfig new_config(kCodecVorbis, kSampleFormatPlanarF32,
4226 CHANNEL_LAYOUT_MONO, 1000, EmptyExtraData(), 4231 CHANNEL_LAYOUT_MONO, 1000, EmptyExtraData(),
4227 Unencrypted()); 4232 false);
4228 ASSERT_NE(new_config.channel_layout(), audio_config_.channel_layout()); 4233 ASSERT_NE(new_config.channel_layout(), audio_config_.channel_layout());
4229 4234
4230 Seek(0); 4235 Seek(0);
4231 CheckAudioConfig(audio_config_); 4236 CheckAudioConfig(audio_config_);
4232 NewCodedFrameGroupAppend("0K 2K 4K 6K"); 4237 NewCodedFrameGroupAppend("0K 2K 4K 6K");
4233 stream_->UpdateAudioConfig(new_config); 4238 stream_->UpdateAudioConfig(new_config);
4234 NewCodedFrameGroupAppend("5K 8K 12K"); 4239 NewCodedFrameGroupAppend("5K 8K 12K");
4235 CheckExpectedBuffers("0K 2K 4K 6K C 5K 8K 12K"); 4240 CheckExpectedBuffers("0K 2K 4K 6K C 5K 8K 12K");
4236 CheckAudioConfig(new_config); 4241 CheckAudioConfig(new_config);
4237 CheckNoNextBuffer(); 4242 CheckNoNextBuffer();
(...skipping 20 matching lines...) Expand all
4258 CheckNoNextBuffer(); 4263 CheckNoNextBuffer();
4259 } 4264 }
4260 4265
4261 TEST_F(SourceBufferStreamTest, Audio_SpliceFrame_NoMillisecondSplices) { 4266 TEST_F(SourceBufferStreamTest, Audio_SpliceFrame_NoMillisecondSplices) {
4262 EXPECT_MEDIA_LOG( 4267 EXPECT_MEDIA_LOG(
4263 HasSubstr("Skipping splice frame generation: not enough samples for " 4268 HasSubstr("Skipping splice frame generation: not enough samples for "
4264 "splicing new buffer at 1250us. Have 750us, but need 1000us.")); 4269 "splicing new buffer at 1250us. Have 750us, but need 1000us."));
4265 4270
4266 video_config_ = TestVideoConfig::Invalid(); 4271 video_config_ = TestVideoConfig::Invalid();
4267 audio_config_.Initialize(kCodecVorbis, kSampleFormatPlanarF32, 4272 audio_config_.Initialize(kCodecVorbis, kSampleFormatPlanarF32,
4268 CHANNEL_LAYOUT_STEREO, 4000, EmptyExtraData(), 4273 CHANNEL_LAYOUT_STEREO, 4000, EmptyExtraData(), false,
4269 Unencrypted(), base::TimeDelta(), 0); 4274 base::TimeDelta(), 0);
4270 stream_.reset(new SourceBufferStream(audio_config_, media_log_, true)); 4275 stream_.reset(new SourceBufferStream(audio_config_, media_log_, true));
4271 // Equivalent to 0.5ms per frame. 4276 // Equivalent to 0.5ms per frame.
4272 SetStreamInfo(2000, 2000); 4277 SetStreamInfo(2000, 2000);
4273 Seek(0); 4278 Seek(0);
4274 4279
4275 // Append four buffers with a 0.5ms duration each. 4280 // Append four buffers with a 0.5ms duration each.
4276 NewCodedFrameGroupAppend(0, 4); 4281 NewCodedFrameGroupAppend(0, 4);
4277 CheckExpectedRangesByTimestamp("{ [0,2) }"); 4282 CheckExpectedRangesByTimestamp("{ [0,2) }");
4278 4283
4279 // Overlap the range [0, 2) with [1.25, 2); this results in an overlap of 4284 // Overlap the range [0, 2) with [1.25, 2); this results in an overlap of
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
4758 CheckNoNextBuffer(); 4763 CheckNoNextBuffer();
4759 } 4764 }
4760 4765
4761 // TODO(vrk): Add unit tests where keyframes are unaligned between streams. 4766 // TODO(vrk): Add unit tests where keyframes are unaligned between streams.
4762 // (crbug.com/133557) 4767 // (crbug.com/133557)
4763 4768
4764 // TODO(vrk): Add unit tests with end of stream being called at interesting 4769 // TODO(vrk): Add unit tests with end of stream being called at interesting
4765 // times. 4770 // times.
4766 4771
4767 } // namespace media 4772 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/source_buffer_stream.cc ('k') | media/formats/mp2t/es_adapter_video_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698