| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "media/base/audio_decoder_config.h" | 6 #include "media/base/audio_decoder_config.h" |
| 7 #include "media/base/mock_callback.h" | 7 #include "media/base/mock_callback.h" |
| 8 #include "media/base/mock_demuxer_host.h" | 8 #include "media/base/mock_demuxer_host.h" |
| 9 #include "media/base/test_data_util.h" | 9 #include "media/base/test_data_util.h" |
| 10 #include "media/filters/chunk_demuxer.h" | 10 #include "media/filters/chunk_demuxer.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // The size of TrackEntry element in test file "webm_vp8_track_entry" starts at | 31 // The size of TrackEntry element in test file "webm_vp8_track_entry" starts at |
| 32 // index 1 and spans 8 bytes. | 32 // index 1 and spans 8 bytes. |
| 33 static const int kVideoTrackSizeOffset = 1; | 33 static const int kVideoTrackSizeOffset = 1; |
| 34 static const int kVideoTrackSizeWidth = 8; | 34 static const int kVideoTrackSizeWidth = 8; |
| 35 static const int kVideoTrackEntryHeaderSize = kVideoTrackSizeOffset + | 35 static const int kVideoTrackEntryHeaderSize = kVideoTrackSizeOffset + |
| 36 kVideoTrackSizeWidth; | 36 kVideoTrackSizeWidth; |
| 37 | 37 |
| 38 static const int kVideoTrackNum = 1; | 38 static const int kVideoTrackNum = 1; |
| 39 static const int kAudioTrackNum = 2; | 39 static const int kAudioTrackNum = 2; |
| 40 | 40 |
| 41 static const char* kSourceId = "SourceId"; |
| 42 static const char* kDefaultSourceType = "video/webm; codecs=\"vp8, vorbis\""; |
| 43 |
| 44 |
| 41 base::TimeDelta kDefaultDuration() { | 45 base::TimeDelta kDefaultDuration() { |
| 42 return base::TimeDelta::FromMilliseconds(201224); | 46 return base::TimeDelta::FromMilliseconds(201224); |
| 43 } | 47 } |
| 44 | 48 |
| 45 // Write an integer into buffer in the form of vint that spans 8 bytes. | 49 // Write an integer into buffer in the form of vint that spans 8 bytes. |
| 46 // The data pointed by |buffer| should be at least 8 bytes long. | 50 // The data pointed by |buffer| should be at least 8 bytes long. |
| 47 // |number| should be in the range 0 <= number < 0x00FFFFFFFFFFFFFF. | 51 // |number| should be in the range 0 <= number < 0x00FFFFFFFFFFFFFF. |
| 48 static void WriteInt64(uint8* buffer, int64 number) { | 52 static void WriteInt64(uint8* buffer, int64 number) { |
| 49 DCHECK(number >= 0 && number < GG_LONGLONG(0x00FFFFFFFFFFFFFF)); | 53 DCHECK(number >= 0 && number < GG_LONGLONG(0x00FFFFFFFFFFFFFF)); |
| 50 buffer[0] = 0x01; | 54 buffer[0] = 0x01; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 } | 161 } |
| 158 buf += video_track_entry_size; | 162 buf += video_track_entry_size; |
| 159 } | 163 } |
| 160 } | 164 } |
| 161 | 165 |
| 162 bool AppendData(const uint8* data, size_t length) { | 166 bool AppendData(const uint8* data, size_t length) { |
| 163 EXPECT_CALL(host_, SetBufferedBytes(_)).Times(AnyNumber()); | 167 EXPECT_CALL(host_, SetBufferedBytes(_)).Times(AnyNumber()); |
| 164 EXPECT_CALL(host_, SetBufferedTime(_)).Times(AnyNumber()); | 168 EXPECT_CALL(host_, SetBufferedTime(_)).Times(AnyNumber()); |
| 165 EXPECT_CALL(host_, SetNetworkActivity(true)) | 169 EXPECT_CALL(host_, SetNetworkActivity(true)) |
| 166 .Times(AnyNumber()); | 170 .Times(AnyNumber()); |
| 167 return demuxer_->AppendData(data, length); | 171 return demuxer_->AppendData(kSourceId, data, length); |
| 168 } | 172 } |
| 169 | 173 |
| 170 bool AppendDataInPieces(const uint8* data, size_t length) { | 174 bool AppendDataInPieces(const uint8* data, size_t length) { |
| 171 return AppendDataInPieces(data, length, 7); | 175 return AppendDataInPieces(data, length, 7); |
| 172 } | 176 } |
| 173 | 177 |
| 174 bool AppendDataInPieces(const uint8* data, size_t length, size_t piece_size) { | 178 bool AppendDataInPieces(const uint8* data, size_t length, size_t piece_size) { |
| 175 const uint8* start = data; | 179 const uint8* start = data; |
| 176 const uint8* end = data + length; | 180 const uint8* end = data + length; |
| 177 while (start < end) { | 181 while (start < end) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 216 |
| 213 bool InitDemuxer(bool has_audio, bool has_video, | 217 bool InitDemuxer(bool has_audio, bool has_video, |
| 214 bool video_content_encoded) { | 218 bool video_content_encoded) { |
| 215 PipelineStatus expected_status = | 219 PipelineStatus expected_status = |
| 216 (has_audio || has_video) ? PIPELINE_OK : DEMUXER_ERROR_COULD_NOT_OPEN; | 220 (has_audio || has_video) ? PIPELINE_OK : DEMUXER_ERROR_COULD_NOT_OPEN; |
| 217 | 221 |
| 218 EXPECT_CALL(*client_, DemuxerOpened(_)); | 222 EXPECT_CALL(*client_, DemuxerOpened(_)); |
| 219 demuxer_->Initialize( | 223 demuxer_->Initialize( |
| 220 &host_, CreateInitDoneCB(kDefaultDuration(), expected_status)); | 224 &host_, CreateInitDoneCB(kDefaultDuration(), expected_status)); |
| 221 | 225 |
| 226 DCHECK_EQ(demuxer_->AddId(kSourceId, kDefaultSourceType), |
| 227 ChunkDemuxer::kOk); |
| 228 |
| 222 return AppendInfoTracks(has_audio, has_video, video_content_encoded); | 229 return AppendInfoTracks(has_audio, has_video, video_content_encoded); |
| 223 } | 230 } |
| 224 | 231 |
| 225 void ShutdownDemuxer() { | 232 void ShutdownDemuxer() { |
| 226 if (demuxer_) { | 233 if (demuxer_) { |
| 227 EXPECT_CALL(*client_, DemuxerClosed()); | 234 EXPECT_CALL(*client_, DemuxerClosed()); |
| 228 demuxer_->Shutdown(); | 235 demuxer_->Shutdown(); |
| 229 } | 236 } |
| 230 } | 237 } |
| 231 | 238 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 bool ParseWebMFile(const std::string& filename, | 272 bool ParseWebMFile(const std::string& filename, |
| 266 const BufferTimestamps* timestamps, | 273 const BufferTimestamps* timestamps, |
| 267 const base::TimeDelta& duration) { | 274 const base::TimeDelta& duration) { |
| 268 scoped_array<uint8> buffer; | 275 scoped_array<uint8> buffer; |
| 269 int buffer_size = 0; | 276 int buffer_size = 0; |
| 270 | 277 |
| 271 EXPECT_CALL(*client_, DemuxerOpened(_)); | 278 EXPECT_CALL(*client_, DemuxerOpened(_)); |
| 272 demuxer_->Initialize( | 279 demuxer_->Initialize( |
| 273 &host_, CreateInitDoneCB(duration, PIPELINE_OK)); | 280 &host_, CreateInitDoneCB(duration, PIPELINE_OK)); |
| 274 | 281 |
| 282 DCHECK_EQ(demuxer_->AddId(kSourceId, kDefaultSourceType), |
| 283 ChunkDemuxer::kOk); |
| 284 |
| 275 // Read a WebM file into memory and send the data to the demuxer. | 285 // Read a WebM file into memory and send the data to the demuxer. |
| 276 ReadTestDataFile(filename, &buffer, &buffer_size); | 286 ReadTestDataFile(filename, &buffer, &buffer_size); |
| 277 if (!AppendDataInPieces(buffer.get(), buffer_size, 512)) | 287 if (!AppendDataInPieces(buffer.get(), buffer_size, 512)) |
| 278 return false; | 288 return false; |
| 279 | 289 |
| 280 scoped_refptr<DemuxerStream> audio = | 290 scoped_refptr<DemuxerStream> audio = |
| 281 demuxer_->GetStream(DemuxerStream::AUDIO); | 291 demuxer_->GetStream(DemuxerStream::AUDIO); |
| 282 scoped_refptr<DemuxerStream> video = | 292 scoped_refptr<DemuxerStream> video = |
| 283 demuxer_->GetStream(DemuxerStream::VIDEO); | 293 demuxer_->GetStream(DemuxerStream::VIDEO); |
| 284 | 294 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 ExpectRead(audio, 5007); | 463 ExpectRead(audio, 5007); |
| 454 ExpectRead(video, 5035); | 464 ExpectRead(video, 5035); |
| 455 } | 465 } |
| 456 | 466 |
| 457 // Test the case where AppendData() is called before Init(). | 467 // Test the case where AppendData() is called before Init(). |
| 458 TEST_F(ChunkDemuxerTest, TestAppendDataBeforeInit) { | 468 TEST_F(ChunkDemuxerTest, TestAppendDataBeforeInit) { |
| 459 scoped_array<uint8> info_tracks; | 469 scoped_array<uint8> info_tracks; |
| 460 int info_tracks_size = 0; | 470 int info_tracks_size = 0; |
| 461 CreateInfoTracks(true, true, false, &info_tracks, &info_tracks_size); | 471 CreateInfoTracks(true, true, false, &info_tracks, &info_tracks_size); |
| 462 | 472 |
| 463 EXPECT_FALSE(demuxer_->AppendData(info_tracks.get(), info_tracks_size)); | 473 EXPECT_FALSE(demuxer_->AppendData(kSourceId, info_tracks.get(), |
| 474 info_tracks_size)); |
| 464 } | 475 } |
| 465 | 476 |
| 466 // Make sure Read() callbacks are dispatched with the proper data. | 477 // Make sure Read() callbacks are dispatched with the proper data. |
| 467 TEST_F(ChunkDemuxerTest, TestRead) { | 478 TEST_F(ChunkDemuxerTest, TestRead) { |
| 468 ASSERT_TRUE(InitDemuxer(true, true, false)); | 479 ASSERT_TRUE(InitDemuxer(true, true, false)); |
| 469 | 480 |
| 470 scoped_refptr<DemuxerStream> audio = | 481 scoped_refptr<DemuxerStream> audio = |
| 471 demuxer_->GetStream(DemuxerStream::AUDIO); | 482 demuxer_->GetStream(DemuxerStream::AUDIO); |
| 472 scoped_refptr<DemuxerStream> video = | 483 scoped_refptr<DemuxerStream> video = |
| 473 demuxer_->GetStream(DemuxerStream::VIDEO); | 484 demuxer_->GetStream(DemuxerStream::VIDEO); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 // Make sure that AppendData() fails because this cluster data | 531 // Make sure that AppendData() fails because this cluster data |
| 521 // is before previous data. | 532 // is before previous data. |
| 522 EXPECT_CALL(host_, OnDemuxerError(PIPELINE_ERROR_DECODE)); | 533 EXPECT_CALL(host_, OnDemuxerError(PIPELINE_ERROR_DECODE)); |
| 523 ASSERT_TRUE(AppendData(cluster_b->data(), cluster_b->size())); | 534 ASSERT_TRUE(AppendData(cluster_b->data(), cluster_b->size())); |
| 524 | 535 |
| 525 // Verify that AppendData() doesn't accept more data now. | 536 // Verify that AppendData() doesn't accept more data now. |
| 526 cb.SetClusterTimecode(45); | 537 cb.SetClusterTimecode(45); |
| 527 AddSimpleBlock(&cb, kAudioTrackNum, 45); | 538 AddSimpleBlock(&cb, kAudioTrackNum, 45); |
| 528 AddSimpleBlock(&cb, kVideoTrackNum, 45); | 539 AddSimpleBlock(&cb, kVideoTrackNum, 45); |
| 529 scoped_ptr<Cluster> cluster_c(cb.Finish()); | 540 scoped_ptr<Cluster> cluster_c(cb.Finish()); |
| 530 EXPECT_FALSE(demuxer_->AppendData(cluster_c->data(), cluster_c->size())); | 541 EXPECT_FALSE(demuxer_->AppendData(kSourceId, cluster_c->data(), |
| 542 cluster_c->size())); |
| 531 } | 543 } |
| 532 | 544 |
| 533 TEST_F(ChunkDemuxerTest, TestNonMonotonicButAboveClusterTimecode) { | 545 TEST_F(ChunkDemuxerTest, TestNonMonotonicButAboveClusterTimecode) { |
| 534 ASSERT_TRUE(InitDemuxer(true, true, false)); | 546 ASSERT_TRUE(InitDemuxer(true, true, false)); |
| 535 | 547 |
| 536 ClusterBuilder cb; | 548 ClusterBuilder cb; |
| 537 | 549 |
| 538 // Test the case where block timecodes are not monotonically | 550 // Test the case where block timecodes are not monotonically |
| 539 // increasing but stay above the cluster timecode. | 551 // increasing but stay above the cluster timecode. |
| 540 cb.SetClusterTimecode(5); | 552 cb.SetClusterTimecode(5); |
| 541 AddSimpleBlock(&cb, kAudioTrackNum, 5); | 553 AddSimpleBlock(&cb, kAudioTrackNum, 5); |
| 542 AddSimpleBlock(&cb, kVideoTrackNum, 10); | 554 AddSimpleBlock(&cb, kVideoTrackNum, 10); |
| 543 AddSimpleBlock(&cb, kAudioTrackNum, 7); | 555 AddSimpleBlock(&cb, kAudioTrackNum, 7); |
| 544 AddSimpleBlock(&cb, kVideoTrackNum, 15); | 556 AddSimpleBlock(&cb, kVideoTrackNum, 15); |
| 545 scoped_ptr<Cluster> cluster_a(cb.Finish()); | 557 scoped_ptr<Cluster> cluster_a(cb.Finish()); |
| 546 | 558 |
| 547 EXPECT_CALL(host_, OnDemuxerError(PIPELINE_ERROR_DECODE)); | 559 EXPECT_CALL(host_, OnDemuxerError(PIPELINE_ERROR_DECODE)); |
| 548 ASSERT_TRUE(AppendData(cluster_a->data(), cluster_a->size())); | 560 ASSERT_TRUE(AppendData(cluster_a->data(), cluster_a->size())); |
| 549 | 561 |
| 550 // Verify that AppendData() doesn't accept more data now. | 562 // Verify that AppendData() doesn't accept more data now. |
| 551 cb.SetClusterTimecode(20); | 563 cb.SetClusterTimecode(20); |
| 552 AddSimpleBlock(&cb, kAudioTrackNum, 20); | 564 AddSimpleBlock(&cb, kAudioTrackNum, 20); |
| 553 AddSimpleBlock(&cb, kVideoTrackNum, 20); | 565 AddSimpleBlock(&cb, kVideoTrackNum, 20); |
| 554 scoped_ptr<Cluster> cluster_b(cb.Finish()); | 566 scoped_ptr<Cluster> cluster_b(cb.Finish()); |
| 555 EXPECT_FALSE(demuxer_->AppendData(cluster_b->data(), cluster_b->size())); | 567 EXPECT_FALSE(demuxer_->AppendData(kSourceId, cluster_b->data(), |
| 568 cluster_b->size())); |
| 556 } | 569 } |
| 557 | 570 |
| 558 TEST_F(ChunkDemuxerTest, TestBackwardsAndBeforeClusterTimecode) { | 571 TEST_F(ChunkDemuxerTest, TestBackwardsAndBeforeClusterTimecode) { |
| 559 ASSERT_TRUE(InitDemuxer(true, true, false)); | 572 ASSERT_TRUE(InitDemuxer(true, true, false)); |
| 560 | 573 |
| 561 ClusterBuilder cb; | 574 ClusterBuilder cb; |
| 562 | 575 |
| 563 // Test timecodes going backwards and including values less than the cluster | 576 // Test timecodes going backwards and including values less than the cluster |
| 564 // timecode. | 577 // timecode. |
| 565 cb.SetClusterTimecode(5); | 578 cb.SetClusterTimecode(5); |
| 566 AddSimpleBlock(&cb, kAudioTrackNum, 5); | 579 AddSimpleBlock(&cb, kAudioTrackNum, 5); |
| 567 AddSimpleBlock(&cb, kVideoTrackNum, 5); | 580 AddSimpleBlock(&cb, kVideoTrackNum, 5); |
| 568 AddSimpleBlock(&cb, kAudioTrackNum, 3); | 581 AddSimpleBlock(&cb, kAudioTrackNum, 3); |
| 569 AddSimpleBlock(&cb, kVideoTrackNum, 3); | 582 AddSimpleBlock(&cb, kVideoTrackNum, 3); |
| 570 scoped_ptr<Cluster> cluster_a(cb.Finish()); | 583 scoped_ptr<Cluster> cluster_a(cb.Finish()); |
| 571 | 584 |
| 572 EXPECT_CALL(host_, OnDemuxerError(PIPELINE_ERROR_DECODE)); | 585 EXPECT_CALL(host_, OnDemuxerError(PIPELINE_ERROR_DECODE)); |
| 573 ASSERT_TRUE(AppendData(cluster_a->data(), cluster_a->size())); | 586 ASSERT_TRUE(AppendData(cluster_a->data(), cluster_a->size())); |
| 574 | 587 |
| 575 // Verify that AppendData() doesn't accept more data now. | 588 // Verify that AppendData() doesn't accept more data now. |
| 576 cb.SetClusterTimecode(6); | 589 cb.SetClusterTimecode(6); |
| 577 AddSimpleBlock(&cb, kAudioTrackNum, 6); | 590 AddSimpleBlock(&cb, kAudioTrackNum, 6); |
| 578 AddSimpleBlock(&cb, kVideoTrackNum, 6); | 591 AddSimpleBlock(&cb, kVideoTrackNum, 6); |
| 579 scoped_ptr<Cluster> cluster_b(cb.Finish()); | 592 scoped_ptr<Cluster> cluster_b(cb.Finish()); |
| 580 EXPECT_FALSE(demuxer_->AppendData(cluster_b->data(), cluster_b->size())); | 593 EXPECT_FALSE(demuxer_->AppendData(kSourceId, cluster_b->data(), |
| 594 cluster_b->size())); |
| 581 } | 595 } |
| 582 | 596 |
| 583 | 597 |
| 584 TEST_F(ChunkDemuxerTest, TestPerStreamMonotonicallyIncreasingTimestamps) { | 598 TEST_F(ChunkDemuxerTest, TestPerStreamMonotonicallyIncreasingTimestamps) { |
| 585 ASSERT_TRUE(InitDemuxer(true, true, false)); | 599 ASSERT_TRUE(InitDemuxer(true, true, false)); |
| 586 | 600 |
| 587 ClusterBuilder cb; | 601 ClusterBuilder cb; |
| 588 | 602 |
| 589 // Test strict monotonic increasing timestamps on a per stream | 603 // Test strict monotonic increasing timestamps on a per stream |
| 590 // basis. | 604 // basis. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 619 scoped_ptr<Cluster> cluster_b(cb.Finish()); | 633 scoped_ptr<Cluster> cluster_b(cb.Finish()); |
| 620 | 634 |
| 621 EXPECT_CALL(host_, OnDemuxerError(PIPELINE_ERROR_DECODE)); | 635 EXPECT_CALL(host_, OnDemuxerError(PIPELINE_ERROR_DECODE)); |
| 622 ASSERT_TRUE(AppendData(cluster_b->data(), cluster_b->size())); | 636 ASSERT_TRUE(AppendData(cluster_b->data(), cluster_b->size())); |
| 623 | 637 |
| 624 // Verify that AppendData() doesn't accept more data now. | 638 // Verify that AppendData() doesn't accept more data now. |
| 625 cb.SetClusterTimecode(10); | 639 cb.SetClusterTimecode(10); |
| 626 AddSimpleBlock(&cb, kAudioTrackNum, 10); | 640 AddSimpleBlock(&cb, kAudioTrackNum, 10); |
| 627 AddSimpleBlock(&cb, kVideoTrackNum, 10); | 641 AddSimpleBlock(&cb, kVideoTrackNum, 10); |
| 628 scoped_ptr<Cluster> cluster_c(cb.Finish()); | 642 scoped_ptr<Cluster> cluster_c(cb.Finish()); |
| 629 EXPECT_FALSE(demuxer_->AppendData(cluster_c->data(), cluster_c->size())); | 643 EXPECT_FALSE(demuxer_->AppendData(kSourceId, cluster_c->data(), |
| 644 cluster_c->size())); |
| 630 } | 645 } |
| 631 | 646 |
| 632 // Test the case where a cluster is passed to AppendData() before | 647 // Test the case where a cluster is passed to AppendData() before |
| 633 // INFO & TRACKS data. | 648 // INFO & TRACKS data. |
| 634 TEST_F(ChunkDemuxerTest, TestClusterBeforeInfoTracks) { | 649 TEST_F(ChunkDemuxerTest, TestClusterBeforeInfoTracks) { |
| 635 EXPECT_CALL(*client_, DemuxerOpened(_)); | 650 EXPECT_CALL(*client_, DemuxerOpened(_)); |
| 636 demuxer_->Initialize( | 651 demuxer_->Initialize( |
| 637 &host_, NewExpectedStatusCB(DEMUXER_ERROR_COULD_NOT_OPEN)); | 652 &host_, NewExpectedStatusCB(DEMUXER_ERROR_COULD_NOT_OPEN)); |
| 638 | 653 |
| 654 DCHECK_EQ(demuxer_->AddId(kSourceId, kDefaultSourceType), ChunkDemuxer::kOk); |
| 655 |
| 639 ClusterBuilder cb; | 656 ClusterBuilder cb; |
| 640 cb.SetClusterTimecode(0); | 657 cb.SetClusterTimecode(0); |
| 641 AddSimpleBlock(&cb, kVideoTrackNum, 0); | 658 AddSimpleBlock(&cb, kVideoTrackNum, 0); |
| 642 scoped_ptr<Cluster> cluster(cb.Finish()); | 659 scoped_ptr<Cluster> cluster(cb.Finish()); |
| 643 | 660 |
| 644 ASSERT_TRUE(AppendData(cluster->data(), cluster->size())); | 661 ASSERT_TRUE(AppendData(cluster->data(), cluster->size())); |
| 645 } | 662 } |
| 646 | 663 |
| 647 // Test cases where we get an EndOfStream() call during initialization. | 664 // Test cases where we get an EndOfStream() call during initialization. |
| 648 TEST_F(ChunkDemuxerTest, TestEOSDuringInit) { | 665 TEST_F(ChunkDemuxerTest, TestEOSDuringInit) { |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 end_of_stream_helper_3.CheckIfReadDonesWereCalled(true); | 845 end_of_stream_helper_3.CheckIfReadDonesWereCalled(true); |
| 829 } | 846 } |
| 830 | 847 |
| 831 // Make sure AppendData() will accept elements that span multiple calls. | 848 // Make sure AppendData() will accept elements that span multiple calls. |
| 832 TEST_F(ChunkDemuxerTest, TestAppendingInPieces) { | 849 TEST_F(ChunkDemuxerTest, TestAppendingInPieces) { |
| 833 | 850 |
| 834 EXPECT_CALL(*client_, DemuxerOpened(_)); | 851 EXPECT_CALL(*client_, DemuxerOpened(_)); |
| 835 demuxer_->Initialize( | 852 demuxer_->Initialize( |
| 836 &host_, CreateInitDoneCB(kDefaultDuration(), PIPELINE_OK)); | 853 &host_, CreateInitDoneCB(kDefaultDuration(), PIPELINE_OK)); |
| 837 | 854 |
| 855 DCHECK_EQ(demuxer_->AddId(kSourceId, kDefaultSourceType), ChunkDemuxer::kOk); |
| 856 |
| 838 scoped_array<uint8> info_tracks; | 857 scoped_array<uint8> info_tracks; |
| 839 int info_tracks_size = 0; | 858 int info_tracks_size = 0; |
| 840 CreateInfoTracks(true, true, false, &info_tracks, &info_tracks_size); | 859 CreateInfoTracks(true, true, false, &info_tracks, &info_tracks_size); |
| 841 | 860 |
| 842 ClusterBuilder cb; | 861 ClusterBuilder cb; |
| 843 cb.SetClusterTimecode(0); | 862 cb.SetClusterTimecode(0); |
| 844 AddSimpleBlock(&cb, kAudioTrackNum, 32, 512); | 863 AddSimpleBlock(&cb, kAudioTrackNum, 32, 512); |
| 845 AddSimpleBlock(&cb, kVideoTrackNum, 123, 1024); | 864 AddSimpleBlock(&cb, kVideoTrackNum, 123, 1024); |
| 846 scoped_ptr<Cluster> cluster_a(cb.Finish()); | 865 scoped_ptr<Cluster> cluster_a(cb.Finish()); |
| 847 | 866 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 EXPECT_TRUE(video_read_done); | 1045 EXPECT_TRUE(video_read_done); |
| 1027 } | 1046 } |
| 1028 | 1047 |
| 1029 | 1048 |
| 1030 TEST_F(ChunkDemuxerTest, TestParseErrorDuringInit) { | 1049 TEST_F(ChunkDemuxerTest, TestParseErrorDuringInit) { |
| 1031 EXPECT_CALL(host_, OnDemuxerError(PIPELINE_ERROR_DECODE)); | 1050 EXPECT_CALL(host_, OnDemuxerError(PIPELINE_ERROR_DECODE)); |
| 1032 | 1051 |
| 1033 EXPECT_CALL(*client_, DemuxerOpened(_)); | 1052 EXPECT_CALL(*client_, DemuxerOpened(_)); |
| 1034 demuxer_->Initialize( | 1053 demuxer_->Initialize( |
| 1035 &host_, CreateInitDoneCB(kDefaultDuration(), PIPELINE_OK)); | 1054 &host_, CreateInitDoneCB(kDefaultDuration(), PIPELINE_OK)); |
| 1055 |
| 1056 DCHECK_EQ(demuxer_->AddId(kSourceId, kDefaultSourceType), ChunkDemuxer::kOk); |
| 1057 |
| 1036 ASSERT_TRUE(AppendInfoTracks(true, true, false)); | 1058 ASSERT_TRUE(AppendInfoTracks(true, true, false)); |
| 1037 | 1059 |
| 1038 uint8 tmp = 0; | 1060 uint8 tmp = 0; |
| 1039 ASSERT_TRUE(demuxer_->AppendData(&tmp, 1)); | 1061 ASSERT_TRUE(demuxer_->AppendData(kSourceId, &tmp, 1)); |
| 1040 } | 1062 } |
| 1041 | 1063 |
| 1042 } // namespace media | 1064 } // namespace media |
| OLD | NEW |