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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <deque> | 9 #include <deque> |
10 #include <string> | 10 #include <string> |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 | 466 |
467 // Attempt a read from the audio stream and run the message loop until done. | 467 // Attempt a read from the audio stream and run the message loop until done. |
468 DemuxerStream* audio = GetStream(DemuxerStream::AUDIO); | 468 DemuxerStream* audio = GetStream(DemuxerStream::AUDIO); |
469 | 469 |
470 audio->Read(NewReadCB(FROM_HERE, 29, 0, true)); | 470 audio->Read(NewReadCB(FROM_HERE, 29, 0, true)); |
471 base::RunLoop().Run(); | 471 base::RunLoop().Run(); |
472 | 472 |
473 audio->Read(NewReadCB(FROM_HERE, 27, 3000, true)); | 473 audio->Read(NewReadCB(FROM_HERE, 27, 3000, true)); |
474 base::RunLoop().Run(); | 474 base::RunLoop().Run(); |
475 | 475 |
476 EXPECT_EQ(166866, demuxer_->GetMemoryUsage()); | 476 EXPECT_EQ(22084, demuxer_->GetMemoryUsage()); |
477 } | 477 } |
478 | 478 |
479 TEST_F(FFmpegDemuxerTest, Read_Video) { | 479 TEST_F(FFmpegDemuxerTest, Read_Video) { |
480 // We test that on a successful video packet read. | 480 // We test that on a successful video packet read. |
481 CreateDemuxer("bear-320x240.webm"); | 481 CreateDemuxer("bear-320x240.webm"); |
482 InitializeDemuxer(); | 482 InitializeDemuxer(); |
483 | 483 |
484 // Attempt a read from the video stream and run the message loop until done. | 484 // Attempt a read from the video stream and run the message loop until done. |
485 DemuxerStream* video = GetStream(DemuxerStream::VIDEO); | 485 DemuxerStream* video = GetStream(DemuxerStream::VIDEO); |
486 | 486 |
487 video->Read(NewReadCB(FROM_HERE, 22084, 0, true)); | 487 video->Read(NewReadCB(FROM_HERE, 22084, 0, true)); |
488 base::RunLoop().Run(); | 488 base::RunLoop().Run(); |
489 | 489 |
490 video->Read(NewReadCB(FROM_HERE, 1057, 33000, false)); | 490 video->Read(NewReadCB(FROM_HERE, 1057, 33000, false)); |
491 base::RunLoop().Run(); | 491 base::RunLoop().Run(); |
492 | 492 |
493 EXPECT_EQ(148778, demuxer_->GetMemoryUsage()); | 493 EXPECT_EQ(323, demuxer_->GetMemoryUsage()); |
494 } | 494 } |
495 | 495 |
496 TEST_F(FFmpegDemuxerTest, Read_Text) { | 496 TEST_F(FFmpegDemuxerTest, Read_Text) { |
497 // We test that on a successful text packet read. | 497 // We test that on a successful text packet read. |
498 CreateDemuxer("bear-vp8-webvtt.webm"); | 498 CreateDemuxer("bear-vp8-webvtt.webm"); |
499 DemuxerStream* text_stream = NULL; | 499 DemuxerStream* text_stream = NULL; |
500 EXPECT_CALL(host_, AddTextStream(_, _)) | 500 EXPECT_CALL(host_, AddTextStream(_, _)) |
501 .WillOnce(SaveArg<0>(&text_stream)); | 501 .WillOnce(SaveArg<0>(&text_stream)); |
502 InitializeDemuxerWithText(); | 502 InitializeDemuxerWithText(); |
503 ASSERT_TRUE(text_stream); | 503 ASSERT_TRUE(text_stream); |
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1518 EXPECT_EQ(astream, preferred_seeking_stream(base::TimeDelta())); | 1518 EXPECT_EQ(astream, preferred_seeking_stream(base::TimeDelta())); |
1519 | 1519 |
1520 // Now pretend that audio stream got disabled. | 1520 // Now pretend that audio stream got disabled. |
1521 astream->set_enabled(false, base::TimeDelta()); | 1521 astream->set_enabled(false, base::TimeDelta()); |
1522 // Since there's no other enabled streams, the preferred seeking stream should | 1522 // Since there's no other enabled streams, the preferred seeking stream should |
1523 // still be the audio stream. | 1523 // still be the audio stream. |
1524 EXPECT_EQ(astream, preferred_seeking_stream(base::TimeDelta())); | 1524 EXPECT_EQ(astream, preferred_seeking_stream(base::TimeDelta())); |
1525 } | 1525 } |
1526 | 1526 |
1527 } // namespace media | 1527 } // namespace media |
OLD | NEW |