OLD | NEW |
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/pipeline_integration_test_base.h" | 5 #include "media/filters/pipeline_integration_test_base.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 int initial_append_size) | 233 int initial_append_size) |
234 : file_path_(GetTestDataFilePath(filename)), | 234 : file_path_(GetTestDataFilePath(filename)), |
235 current_position_(0), | 235 current_position_(0), |
236 initial_append_size_(initial_append_size), | 236 initial_append_size_(initial_append_size), |
237 mimetype_(mimetype), | 237 mimetype_(mimetype), |
238 chunk_demuxer_(new ChunkDemuxer( | 238 chunk_demuxer_(new ChunkDemuxer( |
239 base::Bind(&MockMediaSource::DemuxerOpened, | 239 base::Bind(&MockMediaSource::DemuxerOpened, |
240 base::Unretained(this)), | 240 base::Unretained(this)), |
241 base::Bind(&MockMediaSource::DemuxerNeedKey, | 241 base::Bind(&MockMediaSource::DemuxerNeedKey, |
242 base::Unretained(this)), | 242 base::Unretained(this)), |
243 base::Bind(&MockMediaSource::OnTextTrack, | |
244 base::Unretained(this)), | |
245 LogCB())), | 243 LogCB())), |
246 owned_chunk_demuxer_(chunk_demuxer_) { | 244 owned_chunk_demuxer_(chunk_demuxer_) { |
247 | 245 |
248 file_data_ = ReadTestDataFile(filename); | 246 file_data_ = ReadTestDataFile(filename); |
249 | 247 |
250 if (initial_append_size_ == kAppendWholeFile) | 248 if (initial_append_size_ == kAppendWholeFile) |
251 initial_append_size_ = file_data_->data_size(); | 249 initial_append_size_ = file_data_->data_size(); |
252 | 250 |
253 DCHECK_GT(initial_append_size_, 0); | 251 DCHECK_GT(initial_append_size_, 0); |
254 DCHECK_LE(initial_append_size_, file_data_->data_size()); | 252 DCHECK_LE(initial_append_size_, file_data_->data_size()); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 AppendData(initial_append_size_); | 334 AppendData(initial_append_size_); |
337 } | 335 } |
338 | 336 |
339 void DemuxerNeedKey(const std::string& type, | 337 void DemuxerNeedKey(const std::string& type, |
340 const std::vector<uint8>& init_data) { | 338 const std::vector<uint8>& init_data) { |
341 DCHECK(!init_data.empty()); | 339 DCHECK(!init_data.empty()); |
342 CHECK(!need_key_cb_.is_null()); | 340 CHECK(!need_key_cb_.is_null()); |
343 need_key_cb_.Run(type, init_data); | 341 need_key_cb_.Run(type, init_data); |
344 } | 342 } |
345 | 343 |
346 scoped_ptr<TextTrack> OnTextTrack(TextKind kind, | |
347 const std::string& label, | |
348 const std::string& language) { | |
349 return scoped_ptr<TextTrack>(); | |
350 } | |
351 | |
352 private: | 344 private: |
353 base::FilePath file_path_; | 345 base::FilePath file_path_; |
354 scoped_refptr<DecoderBuffer> file_data_; | 346 scoped_refptr<DecoderBuffer> file_data_; |
355 int current_position_; | 347 int current_position_; |
356 int initial_append_size_; | 348 int initial_append_size_; |
357 std::string mimetype_; | 349 std::string mimetype_; |
358 ChunkDemuxer* chunk_demuxer_; | 350 ChunkDemuxer* chunk_demuxer_; |
359 scoped_ptr<Demuxer> owned_chunk_demuxer_; | 351 scoped_ptr<Demuxer> owned_chunk_demuxer_; |
360 Demuxer::NeedKeyCB need_key_cb_; | 352 Demuxer::NeedKeyCB need_key_cb_; |
361 }; | 353 }; |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 TEST_F(PipelineIntegrationTest, BasicPlayback_VP8A_WebM) { | 1072 TEST_F(PipelineIntegrationTest, BasicPlayback_VP8A_WebM) { |
1081 EXPECT_CALL(*this, OnSetOpaque(false)).Times(AnyNumber()); | 1073 EXPECT_CALL(*this, OnSetOpaque(false)).Times(AnyNumber()); |
1082 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8a.webm"), | 1074 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8a.webm"), |
1083 PIPELINE_OK)); | 1075 PIPELINE_OK)); |
1084 Play(); | 1076 Play(); |
1085 ASSERT_TRUE(WaitUntilOnEnded()); | 1077 ASSERT_TRUE(WaitUntilOnEnded()); |
1086 EXPECT_EQ(last_video_frame_format_, VideoFrame::YV12A); | 1078 EXPECT_EQ(last_video_frame_format_, VideoFrame::YV12A); |
1087 } | 1079 } |
1088 | 1080 |
1089 // Verify that VP8 video with inband text track can be played back. | 1081 // Verify that VP8 video with inband text track can be played back. |
1090 TEST_F(PipelineIntegrationTest, BasicPlayback_VP8_WebVTT_WebM) { | 1082 TEST_F(PipelineIntegrationTest, |
| 1083 BasicPlayback_VP8_WebVTT_WebM) { |
1091 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8-webvtt.webm"), | 1084 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8-webvtt.webm"), |
1092 PIPELINE_OK)); | 1085 PIPELINE_OK)); |
1093 Play(); | 1086 Play(); |
1094 ASSERT_TRUE(WaitUntilOnEnded()); | 1087 ASSERT_TRUE(WaitUntilOnEnded()); |
1095 } | 1088 } |
1096 | 1089 |
1097 } // namespace media | 1090 } // namespace media |
OLD | NEW |