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