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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 const char kMP3[] = "audio/mpeg"; | 112 const char kMP3[] = "audio/mpeg"; |
| 113 const char kMP2AudioSBR[] = "video/mp2t; codecs=\"avc1.4D4041,mp4a.40.5\""; | 113 const char kMP2AudioSBR[] = "video/mp2t; codecs=\"avc1.4D4041,mp4a.40.5\""; |
| 114 #endif // defined(USE_PROPRIETARY_CODECS) | 114 #endif // defined(USE_PROPRIETARY_CODECS) |
| 115 | 115 |
| 116 const size_t kAppendWholeFile = std::numeric_limits<size_t>::max(); | 116 const size_t kAppendWholeFile = std::numeric_limits<size_t>::max(); |
| 117 | 117 |
| 118 // Constants for the Media Source config change tests. | 118 // Constants for the Media Source config change tests. |
| 119 const int kAppendTimeSec = 1; | 119 const int kAppendTimeSec = 1; |
| 120 const int kAppendTimeMs = kAppendTimeSec * 1000; | 120 const int kAppendTimeMs = kAppendTimeSec * 1000; |
| 121 const int k320WebMFileDurationMs = 2736; | 121 const int k320WebMFileDurationMs = 2736; |
| 122 const int k320EncWebMFileDurationMs = 2737; | |
| 123 const int k640WebMFileDurationMs = 2749; | 122 const int k640WebMFileDurationMs = 2749; |
| 124 const int kOpusEndTrimmingWebMFileDurationMs = 2741; | 123 const int kOpusEndTrimmingWebMFileDurationMs = 2741; |
| 125 const int kVP9WebMFileDurationMs = 2736; | 124 const int kVP9WebMFileDurationMs = 2736; |
| 126 const int kVP8AWebMFileDurationMs = 2734; | 125 const int kVP8AWebMFileDurationMs = 2734; |
| 127 | 126 |
| 128 #if !defined(MOJO_RENDERER) | 127 #if !defined(MOJO_RENDERER) |
| 129 #if defined(OPUS_FIXED_POINT) | 128 #if defined(OPUS_FIXED_POINT) |
| 130 // NOTE: Hashes are specific to ARM devices. x86 will not match. | 129 // NOTE: Hashes are specific to ARM devices. x86 will not match. |
| 131 static const char kOpusEndTrimmingHash_1[] = | 130 static const char kOpusEndTrimmingHash_1[] = |
| 132 "-4.57,-5.66,-6.52,-6.30,-4.37,-3.61,"; | 131 "-4.57,-5.66,-6.52,-6.30,-4.37,-3.61,"; |
| (...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1523 | 1522 |
| 1524 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 1523 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
| 1525 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 1524 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
| 1526 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, | 1525 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, |
| 1527 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 1526 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| 1528 | 1527 |
| 1529 source.Shutdown(); | 1528 source.Shutdown(); |
| 1530 Stop(); | 1529 Stop(); |
| 1531 } | 1530 } |
| 1532 | 1531 |
| 1533 // Config changes from encrypted to clear are not currently supported. | 1532 // TODO(xhwang): Config change from clear to encrypted is allowed by the |
| 1533 // demuxer, but is not currently supported by the Renderer. See | |
| 1534 // http://crbug.com/597443 | |
| 1534 TEST_F(PipelineIntegrationTest, | 1535 TEST_F(PipelineIntegrationTest, |
| 1535 MAYBE_EME(MediaSource_ConfigChange_ClearThenEncrypted_WebM)) { | 1536 MAYBE_EME(MediaSource_ConfigChange_ClearThenEncrypted_WebM)) { |
| 1536 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, | 1537 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, |
| 1537 kAppendWholeFile); | 1538 kAppendWholeFile); |
| 1538 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); | 1539 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
| 1539 EXPECT_EQ(PIPELINE_OK, | 1540 EXPECT_EQ(PIPELINE_OK, |
| 1540 StartPipelineWithEncryptedMedia(&source, &encrypted_media)); | 1541 StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
| 1541 | 1542 |
| 1542 scoped_refptr<DecoderBuffer> second_file = | 1543 scoped_refptr<DecoderBuffer> second_file = |
| 1543 ReadTestDataFile("bear-640x360-av_enc-av.webm"); | 1544 ReadTestDataFile("bear-640x360-av_enc-av.webm"); |
| 1544 | 1545 |
| 1545 ASSERT_FALSE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 1546 ASSERT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
|
ddorwin
2017/02/12 04:28:53
EXPECT_?
xhwang
2017/02/14 23:59:33
Done.
| |
| 1546 second_file->data(), | 1547 second_file->data(), |
| 1547 second_file->data_size())); | 1548 second_file->data_size())); |
| 1548 | |
| 1549 source.EndOfStream(); | 1549 source.EndOfStream(); |
| 1550 | 1550 |
| 1551 base::RunLoop().Run(); | 1551 Play(); |
| 1552 EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, pipeline_status_); | 1552 |
| 1553 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); | |
| 1553 | 1554 |
| 1554 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 1555 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
| 1555 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 1556 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
| 1556 // The second video was not added, so its time has not been added. | 1557 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, |
| 1557 EXPECT_EQ(k320WebMFileDurationMs, | |
| 1558 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 1558 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| 1559 | 1559 |
| 1560 Play(); | |
| 1561 | |
| 1562 EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, WaitUntilEndedOrError()); | |
| 1563 source.Shutdown(); | 1560 source.Shutdown(); |
| 1564 } | 1561 } |
| 1565 | 1562 |
| 1566 // Config changes from clear to encrypted are not currently supported. | 1563 // Config change from encrypted to clear is allowed by the demuxer, and is |
| 1564 // supported by the Renderer. | |
| 1567 TEST_F(PipelineIntegrationTest, | 1565 TEST_F(PipelineIntegrationTest, |
| 1568 MAYBE_EME(MediaSource_ConfigChange_EncryptedThenClear_WebM)) { | 1566 MAYBE_EME(MediaSource_ConfigChange_EncryptedThenClear_WebM)) { |
| 1569 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM, | 1567 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM, |
| 1570 kAppendWholeFile); | 1568 kAppendWholeFile); |
| 1571 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); | 1569 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
| 1572 EXPECT_EQ(PIPELINE_OK, | 1570 EXPECT_EQ(PIPELINE_OK, |
| 1573 StartPipelineWithEncryptedMedia(&source, &encrypted_media)); | 1571 StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
| 1574 | 1572 |
| 1573 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(640, 360))).Times(1); | |
| 1575 scoped_refptr<DecoderBuffer> second_file = | 1574 scoped_refptr<DecoderBuffer> second_file = |
| 1576 ReadTestDataFile("bear-640x360.webm"); | 1575 ReadTestDataFile("bear-640x360.webm"); |
| 1577 | 1576 |
| 1578 ASSERT_FALSE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 1577 ASSERT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
| 1579 second_file->data(), | 1578 second_file->data(), |
| 1580 second_file->data_size())); | 1579 second_file->data_size())); |
| 1580 source.EndOfStream(); | |
| 1581 | 1581 |
| 1582 source.EndOfStream(); | 1582 Play(); |
| 1583 ASSERT_TRUE(WaitUntilOnEnded()); | |
| 1583 | 1584 |
| 1584 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 1585 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
| 1585 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 1586 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
| 1586 // The second video was not added, so its time has not been added. | 1587 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, |
| 1587 EXPECT_EQ(k320EncWebMFileDurationMs, | |
| 1588 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 1588 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| 1589 | 1589 |
| 1590 Play(); | |
| 1591 | |
| 1592 EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, WaitUntilEndedOrError()); | |
| 1593 source.Shutdown(); | 1590 source.Shutdown(); |
| 1591 Stop(); | |
| 1594 } | 1592 } |
| 1595 | 1593 |
| 1596 #if defined(ARCH_CPU_X86_FAMILY) && !defined(OS_ANDROID) | 1594 #if defined(ARCH_CPU_X86_FAMILY) && !defined(OS_ANDROID) |
| 1597 TEST_F(PipelineIntegrationTest, BasicPlaybackHi10PVP9) { | 1595 TEST_F(PipelineIntegrationTest, BasicPlaybackHi10PVP9) { |
| 1598 ASSERT_EQ(PIPELINE_OK, Start("bear-320x180-hi10p-vp9.webm", kClockless)); | 1596 ASSERT_EQ(PIPELINE_OK, Start("bear-320x180-hi10p-vp9.webm", kClockless)); |
| 1599 | 1597 |
| 1600 Play(); | 1598 Play(); |
| 1601 | 1599 |
| 1602 ASSERT_TRUE(WaitUntilOnEnded()); | 1600 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1603 } | 1601 } |
| (...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2582 | 2580 |
| 2583 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { | 2581 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { |
| 2584 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); | 2582 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); |
| 2585 Play(); | 2583 Play(); |
| 2586 ASSERT_TRUE(WaitUntilOnEnded()); | 2584 ASSERT_TRUE(WaitUntilOnEnded()); |
| 2587 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), | 2585 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), |
| 2588 demuxer_->GetStartTime()); | 2586 demuxer_->GetStartTime()); |
| 2589 } | 2587 } |
| 2590 | 2588 |
| 2591 } // namespace media | 2589 } // namespace media |
| OLD | NEW |