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

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

Issue 2815303006: Convert MediaLog from being ref counted to owned by WebMediaPlayer. (Closed)
Patch Set: Rebase. Created 3 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 unified diff | Download patch
« no previous file with comments | « media/filters/frame_processor.cc ('k') | media/filters/gpu_video_decoder.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 // Test parameter determines indicates if the TEST_P instance is targeted for 59 // Test parameter determines indicates if the TEST_P instance is targeted for
60 // sequence mode (if true), or segments mode (if false). 60 // sequence mode (if true), or segments mode (if false).
61 class FrameProcessorTest : public testing::TestWithParam<bool> { 61 class FrameProcessorTest : public testing::TestWithParam<bool> {
62 protected: 62 protected:
63 FrameProcessorTest() 63 FrameProcessorTest()
64 : frame_processor_(new FrameProcessor( 64 : frame_processor_(new FrameProcessor(
65 base::Bind( 65 base::Bind(
66 &FrameProcessorTestCallbackHelper::OnPossibleDurationIncrease, 66 &FrameProcessorTestCallbackHelper::OnPossibleDurationIncrease,
67 base::Unretained(&callbacks_)), 67 base::Unretained(&callbacks_)),
68 new MediaLog())), 68 &media_log_)),
69 append_window_end_(kInfiniteDuration), 69 append_window_end_(kInfiniteDuration),
70 frame_duration_(base::TimeDelta::FromMilliseconds(10)), 70 frame_duration_(base::TimeDelta::FromMilliseconds(10)),
71 audio_id_(1), 71 audio_id_(1),
72 video_id_(2) {} 72 video_id_(2) {}
73 73
74 enum StreamFlags { 74 enum StreamFlags {
75 HAS_AUDIO = 1 << 0, 75 HAS_AUDIO = 1 << 0,
76 HAS_VIDEO = 1 << 1 76 HAS_VIDEO = 1 << 1
77 }; 77 };
78 78
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 kNoDecodeTimestamp(); 257 kNoDecodeTimestamp();
258 } 258 }
259 259
260 void seek(ChunkDemuxerStream* stream, base::TimeDelta seek_time) { 260 void seek(ChunkDemuxerStream* stream, base::TimeDelta seek_time) {
261 stream->AbortReads(); 261 stream->AbortReads();
262 stream->Seek(seek_time); 262 stream->Seek(seek_time);
263 stream->StartReturningData(); 263 stream->StartReturningData();
264 } 264 }
265 265
266 base::MessageLoop message_loop_; 266 base::MessageLoop message_loop_;
267 MediaLog media_log_;
267 StrictMock<FrameProcessorTestCallbackHelper> callbacks_; 268 StrictMock<FrameProcessorTestCallbackHelper> callbacks_;
268 269
269 std::unique_ptr<FrameProcessor> frame_processor_; 270 std::unique_ptr<FrameProcessor> frame_processor_;
270 base::TimeDelta append_window_start_; 271 base::TimeDelta append_window_start_;
271 base::TimeDelta append_window_end_; 272 base::TimeDelta append_window_end_;
272 base::TimeDelta timestamp_offset_; 273 base::TimeDelta timestamp_offset_;
273 base::TimeDelta frame_duration_; 274 base::TimeDelta frame_duration_;
274 std::unique_ptr<ChunkDemuxerStream> audio_; 275 std::unique_ptr<ChunkDemuxerStream> audio_;
275 std::unique_ptr<ChunkDemuxerStream> video_; 276 std::unique_ptr<ChunkDemuxerStream> video_;
276 const TrackId audio_id_; 277 const TrackId audio_id_;
(...skipping 23 matching lines...) Expand all
300 void CreateAndConfigureStream(DemuxerStream::Type type) { 301 void CreateAndConfigureStream(DemuxerStream::Type type) {
301 // TODO(wolenetz/dalecurtis): Also test with splicing disabled? 302 // TODO(wolenetz/dalecurtis): Also test with splicing disabled?
302 switch (type) { 303 switch (type) {
303 case DemuxerStream::AUDIO: { 304 case DemuxerStream::AUDIO: {
304 ASSERT_FALSE(audio_); 305 ASSERT_FALSE(audio_);
305 audio_.reset(new ChunkDemuxerStream(DemuxerStream::AUDIO, "1")); 306 audio_.reset(new ChunkDemuxerStream(DemuxerStream::AUDIO, "1"));
306 AudioDecoderConfig decoder_config(kCodecVorbis, kSampleFormatPlanarF32, 307 AudioDecoderConfig decoder_config(kCodecVorbis, kSampleFormatPlanarF32,
307 CHANNEL_LAYOUT_STEREO, 1000, 308 CHANNEL_LAYOUT_STEREO, 1000,
308 EmptyExtraData(), Unencrypted()); 309 EmptyExtraData(), Unencrypted());
309 frame_processor_->OnPossibleAudioConfigUpdate(decoder_config); 310 frame_processor_->OnPossibleAudioConfigUpdate(decoder_config);
310 ASSERT_TRUE(audio_->UpdateAudioConfig(decoder_config, new MediaLog())); 311 ASSERT_TRUE(audio_->UpdateAudioConfig(decoder_config, &media_log_));
311 break; 312 break;
312 } 313 }
313 case DemuxerStream::VIDEO: { 314 case DemuxerStream::VIDEO: {
314 ASSERT_FALSE(video_); 315 ASSERT_FALSE(video_);
315 video_.reset(new ChunkDemuxerStream(DemuxerStream::VIDEO, "2")); 316 video_.reset(new ChunkDemuxerStream(DemuxerStream::VIDEO, "2"));
316 ASSERT_TRUE(video_->UpdateVideoConfig(TestVideoConfig::Normal(), 317 ASSERT_TRUE(
317 new MediaLog())); 318 video_->UpdateVideoConfig(TestVideoConfig::Normal(), &media_log_));
318 break; 319 break;
319 } 320 }
320 // TODO(wolenetz): Test text coded frame processing. 321 // TODO(wolenetz): Test text coded frame processing.
321 case DemuxerStream::TEXT: 322 case DemuxerStream::TEXT:
322 case DemuxerStream::UNKNOWN: { 323 case DemuxerStream::UNKNOWN: {
323 ASSERT_FALSE(true); 324 ASSERT_FALSE(true);
324 } 325 }
325 } 326 }
326 } 327 }
327 328
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 StreamParserBuffer* last_read_parser_buffer = 899 StreamParserBuffer* last_read_parser_buffer =
899 static_cast<StreamParserBuffer*>(last_read_buffer_.get()); 900 static_cast<StreamParserBuffer*>(last_read_buffer_.get());
900 ASSERT_EQ(base::TimeDelta::FromMilliseconds(0), 901 ASSERT_EQ(base::TimeDelta::FromMilliseconds(0),
901 last_read_parser_buffer->preroll_buffer()->duration()); 902 last_read_parser_buffer->preroll_buffer()->duration());
902 } 903 }
903 904
904 INSTANTIATE_TEST_CASE_P(SequenceMode, FrameProcessorTest, Values(true)); 905 INSTANTIATE_TEST_CASE_P(SequenceMode, FrameProcessorTest, Values(true));
905 INSTANTIATE_TEST_CASE_P(SegmentsMode, FrameProcessorTest, Values(false)); 906 INSTANTIATE_TEST_CASE_P(SegmentsMode, FrameProcessorTest, Values(false));
906 907
907 } // namespace media 908 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/frame_processor.cc ('k') | media/filters/gpu_video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698