Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: media/test/pipeline_integration_test.cc

Issue 2543623003: media: Allow config change between clear and encrypted streams (Closed)
Patch Set: media: Allow config change between clear and encrypted streams Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // The key ID for all encrypted files. 120 // The key ID for all encrypted files.
121 const uint8_t kKeyId[] = {0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 121 const uint8_t kKeyId[] = {0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
122 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35}; 122 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35};
123 123
124 const size_t kAppendWholeFile = std::numeric_limits<size_t>::max(); 124 const size_t kAppendWholeFile = std::numeric_limits<size_t>::max();
125 125
126 // Constants for the Media Source config change tests. 126 // Constants for the Media Source config change tests.
127 const int kAppendTimeSec = 1; 127 const int kAppendTimeSec = 1;
128 const int kAppendTimeMs = kAppendTimeSec * 1000; 128 const int kAppendTimeMs = kAppendTimeSec * 1000;
129 const int k320WebMFileDurationMs = 2736; 129 const int k320WebMFileDurationMs = 2736;
130 const int k320EncWebMFileDurationMs = 2737;
131 const int k640WebMFileDurationMs = 2749; 130 const int k640WebMFileDurationMs = 2749;
132 const int kOpusEndTrimmingWebMFileDurationMs = 2741; 131 const int kOpusEndTrimmingWebMFileDurationMs = 2741;
133 const int kVP9WebMFileDurationMs = 2736; 132 const int kVP9WebMFileDurationMs = 2736;
134 const int kVP8AWebMFileDurationMs = 2734; 133 const int kVP8AWebMFileDurationMs = 2734;
135 134
136 #if !defined(MOJO_RENDERER) 135 #if !defined(MOJO_RENDERER)
137 #if defined(OPUS_FIXED_POINT) 136 #if defined(OPUS_FIXED_POINT)
138 static const char kOpusEndTrimmingHash_1[] = 137 static const char kOpusEndTrimmingHash_1[] =
139 "-4.57,-5.66,-6.52,-6.30,-4.37,-3.61,"; 138 "-4.57,-5.66,-6.52,-6.30,-4.37,-3.61,";
140 static const char kOpusEndTrimmingHash_2[] = 139 static const char kOpusEndTrimmingHash_2[] =
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 1448
1450 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1449 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1451 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1450 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1452 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, 1451 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs,
1453 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1452 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1454 1453
1455 source.Shutdown(); 1454 source.Shutdown();
1456 Stop(); 1455 Stop();
1457 } 1456 }
1458 1457
1459 // Config changes from encrypted to clear are not currently supported. 1458 // TODO(xhwang): Config change from clear to encrypted is allowed by the
1459 // demuxer, but is not currently supported by the Renderer. See
1460 // http://crbug.com/597443
1460 TEST_F(PipelineIntegrationTest, 1461 TEST_F(PipelineIntegrationTest,
1461 MAYBE_EME(MediaSource_ConfigChange_ClearThenEncrypted_WebM)) { 1462 MAYBE_EME(MediaSource_ConfigChange_ClearThenEncrypted_WebM)) {
1462 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, 1463 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM,
1463 kAppendWholeFile); 1464 kAppendWholeFile);
1464 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1465 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1465 EXPECT_EQ(PIPELINE_OK, 1466 EXPECT_EQ(PIPELINE_OK,
1466 StartPipelineWithEncryptedMedia(&source, &encrypted_media)); 1467 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
1467 1468
1468 scoped_refptr<DecoderBuffer> second_file = 1469 scoped_refptr<DecoderBuffer> second_file =
1469 ReadTestDataFile("bear-640x360-av_enc-av.webm"); 1470 ReadTestDataFile("bear-640x360-av_enc-av.webm");
1470 1471
1471 ASSERT_FALSE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), 1472 ASSERT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1472 second_file->data(), 1473 second_file->data(),
1473 second_file->data_size())); 1474 second_file->data_size()));
1474
1475 source.EndOfStream(); 1475 source.EndOfStream();
1476 1476
1477 base::RunLoop().Run(); 1477 Play();
1478 EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, pipeline_status_); 1478
1479 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError());
ddorwin 2016/12/05 23:53:04 This seems bad. Authors do not like the decode err
xhwang 2016/12/16 20:12:29 Agreed. But I feel this is the problem with decode
1479 1480
1480 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1481 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1481 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1482 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1482 // The second video was not added, so its time has not been added. 1483 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs,
1483 EXPECT_EQ(k320WebMFileDurationMs,
1484 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1484 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1485 1485
1486 Play();
1487
1488 EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, WaitUntilEndedOrError());
1489 source.Shutdown(); 1486 source.Shutdown();
1490 } 1487 }
1491 1488
1492 // Config changes from clear to encrypted are not currently supported. 1489 // Config change from encrypted to clear is allowed by the demuxer, and is
1490 // supported by the Renderer.
1493 TEST_F(PipelineIntegrationTest, 1491 TEST_F(PipelineIntegrationTest,
1494 MAYBE_EME(MediaSource_ConfigChange_EncryptedThenClear_WebM)) { 1492 MAYBE_EME(MediaSource_ConfigChange_EncryptedThenClear_WebM)) {
1495 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM, 1493 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM,
1496 kAppendWholeFile); 1494 kAppendWholeFile);
1497 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1495 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1498 EXPECT_EQ(PIPELINE_OK, 1496 EXPECT_EQ(PIPELINE_OK,
1499 StartPipelineWithEncryptedMedia(&source, &encrypted_media)); 1497 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
1500 1498
1499 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(640, 360))).Times(1);
1501 scoped_refptr<DecoderBuffer> second_file = 1500 scoped_refptr<DecoderBuffer> second_file =
1502 ReadTestDataFile("bear-640x360.webm"); 1501 ReadTestDataFile("bear-640x360.webm");
1503 1502
1504 ASSERT_FALSE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), 1503 ASSERT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1505 second_file->data(), 1504 second_file->data(),
1506 second_file->data_size())); 1505 second_file->data_size()));
1506 source.EndOfStream();
1507 1507
1508 source.EndOfStream(); 1508 Play();
1509 ASSERT_TRUE(WaitUntilOnEnded());
1509 1510
1510 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1511 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1511 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1512 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1512 // The second video was not added, so its time has not been added. 1513 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs,
1513 EXPECT_EQ(k320EncWebMFileDurationMs,
1514 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1514 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1515 1515
1516 Play();
1517
1518 EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, WaitUntilEndedOrError());
1519 source.Shutdown(); 1516 source.Shutdown();
1517 Stop();
1520 } 1518 }
1521 1519
1522 #if defined(ARCH_CPU_X86_FAMILY) && !defined(OS_ANDROID) 1520 #if defined(ARCH_CPU_X86_FAMILY) && !defined(OS_ANDROID)
1523 TEST_F(PipelineIntegrationTest, BasicPlaybackHi10PVP9) { 1521 TEST_F(PipelineIntegrationTest, BasicPlaybackHi10PVP9) {
1524 ASSERT_EQ(PIPELINE_OK, Start("bear-320x180-hi10p-vp9.webm", kClockless)); 1522 ASSERT_EQ(PIPELINE_OK, Start("bear-320x180-hi10p-vp9.webm", kClockless));
1525 1523
1526 Play(); 1524 Play();
1527 1525
1528 ASSERT_TRUE(WaitUntilOnEnded()); 1526 ASSERT_TRUE(WaitUntilOnEnded());
1529 } 1527 }
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
2508 2506
2509 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { 2507 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) {
2510 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); 2508 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm"));
2511 Play(); 2509 Play();
2512 ASSERT_TRUE(WaitUntilOnEnded()); 2510 ASSERT_TRUE(WaitUntilOnEnded());
2513 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), 2511 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000),
2514 demuxer_->GetStartTime()); 2512 demuxer_->GetStartTime());
2515 } 2513 }
2516 2514
2517 } // namespace media 2515 } // namespace media
OLDNEW
« media/filters/decrypting_video_decoder.cc ('K') | « media/filters/source_buffer_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698