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