| 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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 int initial_append_size) | 231 int initial_append_size) |
| 232 : file_path_(GetTestDataFilePath(filename)), | 232 : file_path_(GetTestDataFilePath(filename)), |
| 233 current_position_(0), | 233 current_position_(0), |
| 234 initial_append_size_(initial_append_size), | 234 initial_append_size_(initial_append_size), |
| 235 mimetype_(mimetype), | 235 mimetype_(mimetype), |
| 236 chunk_demuxer_(new ChunkDemuxer( | 236 chunk_demuxer_(new ChunkDemuxer( |
| 237 base::Bind(&MockMediaSource::DemuxerOpened, | 237 base::Bind(&MockMediaSource::DemuxerOpened, |
| 238 base::Unretained(this)), | 238 base::Unretained(this)), |
| 239 base::Bind(&MockMediaSource::DemuxerNeedKey, | 239 base::Bind(&MockMediaSource::DemuxerNeedKey, |
| 240 base::Unretained(this)), | 240 base::Unretained(this)), |
| 241 base::Bind(&MockMediaSource::OnTextTrack, |
| 242 base::Unretained(this)), |
| 241 LogCB())), | 243 LogCB())), |
| 242 owned_chunk_demuxer_(chunk_demuxer_) { | 244 owned_chunk_demuxer_(chunk_demuxer_) { |
| 243 | 245 |
| 244 file_data_ = ReadTestDataFile(filename); | 246 file_data_ = ReadTestDataFile(filename); |
| 245 | 247 |
| 246 if (initial_append_size_ == kAppendWholeFile) | 248 if (initial_append_size_ == kAppendWholeFile) |
| 247 initial_append_size_ = file_data_->GetDataSize(); | 249 initial_append_size_ = file_data_->GetDataSize(); |
| 248 | 250 |
| 249 DCHECK_GT(initial_append_size_, 0); | 251 DCHECK_GT(initial_append_size_, 0); |
| 250 DCHECK_LE(initial_append_size_, file_data_->GetDataSize()); | 252 DCHECK_LE(initial_append_size_, file_data_->GetDataSize()); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 | 320 |
| 319 void DemuxerNeedKey(const std::string& type, | 321 void DemuxerNeedKey(const std::string& type, |
| 320 scoped_ptr<uint8[]> init_data, int init_data_size) { | 322 scoped_ptr<uint8[]> init_data, int init_data_size) { |
| 321 DCHECK(init_data.get()); | 323 DCHECK(init_data.get()); |
| 322 DCHECK_GT(init_data_size, 0); | 324 DCHECK_GT(init_data_size, 0); |
| 323 CHECK(!need_key_cb_.is_null()); | 325 CHECK(!need_key_cb_.is_null()); |
| 324 need_key_cb_.Run( | 326 need_key_cb_.Run( |
| 325 std::string(), std::string(), type, init_data.Pass(), init_data_size); | 327 std::string(), std::string(), type, init_data.Pass(), init_data_size); |
| 326 } | 328 } |
| 327 | 329 |
| 330 scoped_ptr<TextTrack> OnTextTrack(TextKind kind, |
| 331 const std::string& label, |
| 332 const std::string& language) { |
| 333 return scoped_ptr<TextTrack>(); |
| 334 } |
| 335 |
| 328 private: | 336 private: |
| 329 base::FilePath file_path_; | 337 base::FilePath file_path_; |
| 330 scoped_refptr<DecoderBuffer> file_data_; | 338 scoped_refptr<DecoderBuffer> file_data_; |
| 331 int current_position_; | 339 int current_position_; |
| 332 int initial_append_size_; | 340 int initial_append_size_; |
| 333 std::string mimetype_; | 341 std::string mimetype_; |
| 334 ChunkDemuxer* chunk_demuxer_; | 342 ChunkDemuxer* chunk_demuxer_; |
| 335 scoped_ptr<Demuxer> owned_chunk_demuxer_; | 343 scoped_ptr<Demuxer> owned_chunk_demuxer_; |
| 336 NeedKeyCB need_key_cb_; | 344 NeedKeyCB need_key_cb_; |
| 337 }; | 345 }; |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 | 948 |
| 941 // Verify that VP8 video with alpha channel can be played back. | 949 // Verify that VP8 video with alpha channel can be played back. |
| 942 TEST_F(PipelineIntegrationTest, BasicPlayback_VP8A_WebM) { | 950 TEST_F(PipelineIntegrationTest, BasicPlayback_VP8A_WebM) { |
| 943 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8a.webm"), | 951 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8a.webm"), |
| 944 PIPELINE_OK)); | 952 PIPELINE_OK)); |
| 945 Play(); | 953 Play(); |
| 946 ASSERT_TRUE(WaitUntilOnEnded()); | 954 ASSERT_TRUE(WaitUntilOnEnded()); |
| 947 EXPECT_EQ(last_video_frame_format_, VideoFrame::YV12A); | 955 EXPECT_EQ(last_video_frame_format_, VideoFrame::YV12A); |
| 948 } | 956 } |
| 949 | 957 |
| 958 // Verify that VP8 video with inband text track can be played back. |
| 959 TEST_F(PipelineIntegrationTest, BasicPlayback_VP8_WebVTT_WebM) { |
| 960 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8-webvtt.webm"), |
| 961 PIPELINE_OK)); |
| 962 Play(); |
| 963 ASSERT_TRUE(WaitUntilOnEnded()); |
| 964 } |
| 965 |
| 950 } // namespace media | 966 } // namespace media |
| OLD | NEW |