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

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

Issue 2701203003: media: Prefer decrypting pipeline when CDM is attached (Closed)
Patch Set: comments addressed Created 3 years, 9 months 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
« no previous file with comments | « media/filters/video_frame_stream_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 EXPECT_CALL(*this, OnMetadata(_)) 730 EXPECT_CALL(*this, OnMetadata(_))
731 .Times(AtMost(1)) 731 .Times(AtMost(1))
732 .WillRepeatedly(SaveArg<0>(&metadata_)); 732 .WillRepeatedly(SaveArg<0>(&metadata_));
733 EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH)) 733 EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH))
734 .Times(AnyNumber()); 734 .Times(AnyNumber());
735 EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_NOTHING)) 735 EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_NOTHING))
736 .Times(AnyNumber()); 736 .Times(AnyNumber());
737 EXPECT_CALL(*this, OnDurationChange()).Times(AnyNumber()); 737 EXPECT_CALL(*this, OnDurationChange()).Times(AnyNumber());
738 EXPECT_CALL(*this, OnVideoNaturalSizeChange(_)).Times(AtMost(1)); 738 EXPECT_CALL(*this, OnVideoNaturalSizeChange(_)).Times(AtMost(1));
739 EXPECT_CALL(*this, OnVideoOpacityChange(_)).Times(AtMost(1)); 739 EXPECT_CALL(*this, OnVideoOpacityChange(_)).Times(AtMost(1));
740 EXPECT_CALL(*this, OnVideoAverageKeyframeDistanceUpdate())
741 .Times(AnyNumber());
740 742
741 source->set_demuxer_failure_cb(base::Bind( 743 source->set_demuxer_failure_cb(base::Bind(
742 &PipelineIntegrationTest::OnStatusCallback, base::Unretained(this))); 744 &PipelineIntegrationTest::OnStatusCallback, base::Unretained(this)));
743 demuxer_ = source->GetDemuxer(); 745 demuxer_ = source->GetDemuxer();
744 746
745 if (encrypted_media) { 747 if (encrypted_media) {
746 EXPECT_CALL(*this, DecryptorAttached(true)); 748 EXPECT_CALL(*this, DecryptorAttached(true));
747 749
748 // Encrypted content used but keys provided in advance, so this is 750 // Encrypted content used but keys provided in advance, so this is
749 // never called. 751 // never called.
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 MAYBE_EME(MediaSource_ConfigChange_Encrypted_WebM)) { 1509 MAYBE_EME(MediaSource_ConfigChange_Encrypted_WebM)) {
1508 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM, 1510 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM,
1509 kAppendWholeFile); 1511 kAppendWholeFile);
1510 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1512 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1511 EXPECT_EQ(PIPELINE_OK, 1513 EXPECT_EQ(PIPELINE_OK,
1512 StartPipelineWithEncryptedMedia(&source, &encrypted_media)); 1514 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
1513 1515
1514 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(640, 360))).Times(1); 1516 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(640, 360))).Times(1);
1515 scoped_refptr<DecoderBuffer> second_file = 1517 scoped_refptr<DecoderBuffer> second_file =
1516 ReadTestDataFile("bear-640x360-av_enc-av.webm"); 1518 ReadTestDataFile("bear-640x360-av_enc-av.webm");
1519
1517 ASSERT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), 1520 ASSERT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1518 second_file->data(), 1521 second_file->data(),
1519 second_file->data_size())); 1522 second_file->data_size()));
1520 source.EndOfStream(); 1523 source.EndOfStream();
1521 1524
1522 Play(); 1525 Play();
1523 EXPECT_TRUE(WaitUntilOnEnded()); 1526 EXPECT_TRUE(WaitUntilOnEnded());
1524 1527
1525 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1528 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1526 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1529 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1527 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, 1530 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs,
1528 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1531 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1529 1532
1530 source.Shutdown(); 1533 source.Shutdown();
1531 Stop(); 1534 Stop();
1532 } 1535 }
1533 1536
1534 // TODO(xhwang): Config change from clear to encrypted is allowed by the
1535 // demuxer, but is not currently supported by the Renderer. See
1536 // http://crbug.com/597443
1537 TEST_F(PipelineIntegrationTest, 1537 TEST_F(PipelineIntegrationTest,
1538 MAYBE_EME(MediaSource_ConfigChange_ClearThenEncrypted_WebM)) { 1538 MAYBE_EME(MediaSource_ConfigChange_ClearThenEncrypted_WebM)) {
1539 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, 1539 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM,
1540 kAppendWholeFile); 1540 kAppendWholeFile);
1541 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1541 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1542 EXPECT_EQ(PIPELINE_OK, 1542 EXPECT_EQ(PIPELINE_OK,
1543 StartPipelineWithEncryptedMedia(&source, &encrypted_media)); 1543 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
1544 1544
1545 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(640, 360))).Times(1);
1545 scoped_refptr<DecoderBuffer> second_file = 1546 scoped_refptr<DecoderBuffer> second_file =
1546 ReadTestDataFile("bear-640x360-av_enc-av.webm"); 1547 ReadTestDataFile("bear-640x360-av_enc-av.webm");
1547 1548
1548 EXPECT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), 1549 EXPECT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1549 second_file->data(), 1550 second_file->data(),
1550 second_file->data_size())); 1551 second_file->data_size()));
1551 source.EndOfStream(); 1552 source.EndOfStream();
1552 1553
1553 Play(); 1554 Play();
1554 1555 EXPECT_TRUE(WaitUntilOnEnded());
1555 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError());
1556 1556
1557 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1557 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1558 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1558 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1559 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, 1559 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs,
1560 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1560 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1561 1561
1562 source.Shutdown(); 1562 source.Shutdown();
1563 Stop();
1563 } 1564 }
1564 1565
1565 // Config change from encrypted to clear is allowed by the demuxer, and is 1566 // Config change from encrypted to clear is allowed by the demuxer, and is
1566 // supported by the Renderer. 1567 // supported by the Renderer.
1567 TEST_F(PipelineIntegrationTest, 1568 TEST_F(PipelineIntegrationTest,
1568 MAYBE_EME(MediaSource_ConfigChange_EncryptedThenClear_WebM)) { 1569 MAYBE_EME(MediaSource_ConfigChange_EncryptedThenClear_WebM)) {
1569 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM, 1570 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM,
1570 kAppendWholeFile); 1571 kAppendWholeFile);
1571 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1572 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1572 EXPECT_EQ(PIPELINE_OK, 1573 EXPECT_EQ(PIPELINE_OK,
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
2582 2583
2583 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { 2584 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) {
2584 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); 2585 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm"));
2585 Play(); 2586 Play();
2586 ASSERT_TRUE(WaitUntilOnEnded()); 2587 ASSERT_TRUE(WaitUntilOnEnded());
2587 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), 2588 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000),
2588 demuxer_->GetStartTime()); 2589 demuxer_->GetStartTime());
2589 } 2590 }
2590 2591
2591 } // namespace media 2592 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/video_frame_stream_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698