Chromium Code Reviews| 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/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1556 ->audio_decoder_config() | 1556 ->audio_decoder_config() |
| 1557 .samples_per_second()); | 1557 .samples_per_second()); |
| 1558 } | 1558 } |
| 1559 | 1559 |
| 1560 // Ensures audio-only playback with missing or negative timestamps works. Tests | 1560 // Ensures audio-only playback with missing or negative timestamps works. Tests |
| 1561 // the common live-streaming case for chained ogg. See http://crbug.com/396864. | 1561 // the common live-streaming case for chained ogg. See http://crbug.com/396864. |
| 1562 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOgg) { | 1562 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOgg) { |
| 1563 ASSERT_TRUE(Start(GetTestDataFilePath("double-sfx.ogg"), PIPELINE_OK)); | 1563 ASSERT_TRUE(Start(GetTestDataFilePath("double-sfx.ogg"), PIPELINE_OK)); |
| 1564 Play(); | 1564 Play(); |
| 1565 ASSERT_TRUE(WaitUntilOnEnded()); | 1565 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1566 ASSERT_EQ(base::TimeDelta(), demuxer_->GetStartTime()); | |
| 1566 } | 1567 } |
| 1567 | 1568 |
| 1568 // Ensures audio-video playback with missing or negative timestamps fails softly | 1569 // Ensures audio-video playback with missing or negative timestamps fails softly |
| 1569 // instead of crashing. See http://crbug.com/396864. | 1570 // instead of crashing. See http://crbug.com/396864. |
| 1570 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOggVideo) { | 1571 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOggVideo) { |
| 1571 ASSERT_TRUE(Start(GetTestDataFilePath("double-bear.ogv"), PIPELINE_OK)); | 1572 ASSERT_TRUE(Start(GetTestDataFilePath("double-bear.ogv"), PIPELINE_OK)); |
| 1572 Play(); | 1573 Play(); |
| 1573 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); | 1574 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); |
| 1575 ASSERT_EQ(base::TimeDelta(), demuxer_->GetStartTime()); | |
| 1574 } | 1576 } |
| 1575 | 1577 |
| 1576 // Tests that we signal ended even when audio runs longer than video track. | 1578 // Tests that we signal ended even when audio runs longer than video track. |
| 1577 TEST_F(PipelineIntegrationTest, BasicPlaybackAudioLongerThanVideo) { | 1579 TEST_F(PipelineIntegrationTest, BasicPlaybackAudioLongerThanVideo) { |
| 1578 ASSERT_TRUE(Start(GetTestDataFilePath("bear_audio_longer_than_video.ogv"), | 1580 ASSERT_TRUE(Start(GetTestDataFilePath("bear_audio_longer_than_video.ogv"), |
| 1579 PIPELINE_OK)); | 1581 PIPELINE_OK)); |
| 1580 // Audio track is 2000ms. Video track is 1001ms. Duration should be higher | 1582 // Audio track is 2000ms. Video track is 1001ms. Duration should be higher |
| 1581 // of the two. | 1583 // of the two. |
| 1582 EXPECT_EQ(2000, pipeline_->GetMediaDuration().InMilliseconds()); | 1584 EXPECT_EQ(2000, pipeline_->GetMediaDuration().InMilliseconds()); |
| 1583 Play(); | 1585 Play(); |
| 1584 ASSERT_TRUE(WaitUntilOnEnded()); | 1586 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1585 } | 1587 } |
| 1586 | 1588 |
| 1587 // Tests that we signal ended even when audio runs shorter than video track. | 1589 // Tests that we signal ended even when audio runs shorter than video track. |
| 1588 TEST_F(PipelineIntegrationTest, BasicPlaybackAudioShorterThanVideo) { | 1590 TEST_F(PipelineIntegrationTest, BasicPlaybackAudioShorterThanVideo) { |
| 1589 ASSERT_TRUE(Start(GetTestDataFilePath("bear_audio_shorter_than_video.ogv"), | 1591 ASSERT_TRUE(Start(GetTestDataFilePath("bear_audio_shorter_than_video.ogv"), |
| 1590 PIPELINE_OK)); | 1592 PIPELINE_OK)); |
| 1591 // Audio track is 500ms. Video track is 1001ms. Duration should be higher of | 1593 // Audio track is 500ms. Video track is 1001ms. Duration should be higher of |
| 1592 // the two. | 1594 // the two. |
| 1593 EXPECT_EQ(1001, pipeline_->GetMediaDuration().InMilliseconds()); | 1595 EXPECT_EQ(1001, pipeline_->GetMediaDuration().InMilliseconds()); |
| 1594 Play(); | 1596 Play(); |
| 1595 ASSERT_TRUE(WaitUntilOnEnded()); | 1597 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1596 } | 1598 } |
| 1597 | 1599 |
| 1600 // Tests that we signal ended even when audio runs shorter than video track. | |
|
scherkus (not reviewing)
2014/09/16 18:55:41
comment doesn't apply
DaleCurtis
2014/09/16 20:03:03
Done.
| |
| 1601 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { | |
| 1602 ASSERT_TRUE( | |
| 1603 Start(GetTestDataFilePath("nonzero-start-time.webm"), PIPELINE_OK)); | |
| 1604 Play(); | |
| 1605 ASSERT_TRUE(WaitUntilOnEnded()); | |
| 1606 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), | |
| 1607 demuxer_->GetStartTime()); | |
| 1608 } | |
| 1609 | |
| 1598 } // namespace media | 1610 } // namespace media |
| OLD | NEW |