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

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

Issue 2692593002: Media Remoting: End to end integration tests. (Closed)
Patch Set: Created 3 years, 10 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
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #define DISABLE_EME_TESTS 1 56 #define DISABLE_EME_TESTS 1
57 57
58 // TODO(xhwang,dalecurtis): Text tracks are not currently supported by the mojo 58 // TODO(xhwang,dalecurtis): Text tracks are not currently supported by the mojo
59 // renderer. 59 // renderer.
60 #define DISABLE_TEXT_TRACK_TESTS 1 60 #define DISABLE_TEXT_TRACK_TESTS 1
61 61
62 // TODO(jrummell, dalecurtis): Clockless playback does not currently work with 62 // TODO(jrummell, dalecurtis): Clockless playback does not currently work with
63 // mojo, so the tests take too long to run. 63 // mojo, so the tests take too long to run.
64 #define DISABLE_CLOCKLESS_TESTS 1 64 #define DISABLE_CLOCKLESS_TESTS 1
65 #else 65 #else
66 #if BUILDFLAG(ENABLE_MEDIA_REMOTING)
miu 2017/03/29 01:39:15 Why is this dependent on !defined(MOJO_RENDERER)?
xjz 2017/03/30 23:21:31 Done. It should be ok to remove !defined(MOJO_REND
67 #include "media/remoting/end2end_test_renderer.h" // nogncheck
68 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING)
66 #define EXPECT_HASH_EQ(a, b) EXPECT_EQ(a, b) 69 #define EXPECT_HASH_EQ(a, b) EXPECT_EQ(a, b)
67 #define EXPECT_VIDEO_FORMAT_EQ(a, b) EXPECT_EQ(a, b) 70 #define EXPECT_VIDEO_FORMAT_EQ(a, b) EXPECT_EQ(a, b)
68 #define EXPECT_COLOR_SPACE_EQ(a, b) EXPECT_EQ(a, b) 71 #define EXPECT_COLOR_SPACE_EQ(a, b) EXPECT_EQ(a, b)
69 #endif // defined(MOJO_RENDERER) 72 #endif // defined(MOJO_RENDERER)
70 73
71 #if defined(DISABLE_EME_TESTS) 74 #if defined(DISABLE_EME_TESTS)
72 #define MAYBE_EME(test) DISABLED_##test 75 #define MAYBE_EME(test) DISABLED_##test
73 #else 76 #else
74 #define MAYBE_EME(test) test 77 #define MAYBE_EME(test) test
75 #endif 78 #endif
76 79
77 #if defined(DISABLE_TEXT_TRACK_TESTS) 80 #if defined(DISABLE_TEXT_TRACK_TESTS)
78 #define MAYBE_TEXT(test) DISABLED_##test 81 #define MAYBE_TEXT(test) DISABLED_##test
79 #else 82 #else
80 #define MAYBE_TEXT(test) test 83 #define MAYBE_TEXT(test) test
81 #endif 84 #endif
82 85
83 #if defined(DISABLE_CLOCKLESS_TESTS)
84 #define MAYBE_CLOCKLESS(test) DISABLED_##test
85 #else
86 #define MAYBE_CLOCKLESS(test) test
87 #endif
88
89 using testing::_; 86 using testing::_;
90 using testing::AnyNumber; 87 using testing::AnyNumber;
91 using testing::AtLeast; 88 using testing::AtLeast;
92 using testing::AtMost; 89 using testing::AtMost;
93 using testing::SaveArg; 90 using testing::SaveArg;
94 91
95 namespace media { 92 namespace media {
96 93
94 namespace {
95
97 const char kSourceId[] = "SourceId"; 96 const char kSourceId[] = "SourceId";
98 97
99 const char kWebM[] = "video/webm; codecs=\"vp8,vorbis\""; 98 const char kWebM[] = "video/webm; codecs=\"vp8,vorbis\"";
100 const char kWebMVP9[] = "video/webm; codecs=\"vp9\""; 99 const char kWebMVP9[] = "video/webm; codecs=\"vp9\"";
101 const char kAudioOnlyWebM[] = "video/webm; codecs=\"vorbis\""; 100 const char kAudioOnlyWebM[] = "video/webm; codecs=\"vorbis\"";
102 const char kOpusAudioOnlyWebM[] = "video/webm; codecs=\"opus\""; 101 const char kOpusAudioOnlyWebM[] = "video/webm; codecs=\"opus\"";
103 const char kVideoOnlyWebM[] = "video/webm; codecs=\"vp8\""; 102 const char kVideoOnlyWebM[] = "video/webm; codecs=\"vp8\"";
104 #if BUILDFLAG(USE_PROPRIETARY_CODECS) 103 #if BUILDFLAG(USE_PROPRIETARY_CODECS)
105 const char kADTS[] = "audio/aac"; 104 const char kADTS[] = "audio/aac";
106 const char kMP4[] = "video/mp4; codecs=\"avc1.4D4041,mp4a.40.2\""; 105 const char kMP4[] = "video/mp4; codecs=\"avc1.4D4041,mp4a.40.2\"";
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 } 658 }
660 void Decode(const scoped_refptr<DecoderBuffer>& buffer, 659 void Decode(const scoped_refptr<DecoderBuffer>& buffer,
661 const DecodeCB& decode_cb) override { 660 const DecodeCB& decode_cb) override {
662 base::ThreadTaskRunnerHandle::Get()->PostTask( 661 base::ThreadTaskRunnerHandle::Get()->PostTask(
663 FROM_HERE, base::Bind(decode_cb, DecodeStatus::DECODE_ERROR)); 662 FROM_HERE, base::Bind(decode_cb, DecodeStatus::DECODE_ERROR));
664 } 663 }
665 void Reset(const base::Closure& closure) override { closure.Run(); } 664 void Reset(const base::Closure& closure) override { closure.Run(); }
666 bool NeedsBitstreamConversion() const override { return true; } 665 bool NeedsBitstreamConversion() const override { return true; }
667 }; 666 };
668 667
668 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER)
miu 2017/03/29 01:39:15 Along the lines of my earlier comment, can we just
xjz 2017/03/30 23:21:31 Done. Now removed this class to base.
669 class RemotingTestRendererFactory final : public PipelineTestRendererFactory {
670 public:
671 explicit RemotingTestRendererFactory(
672 std::unique_ptr<PipelineTestRendererFactory> renderer_factory)
673 : default_renderer_factory_(std::move(renderer_factory)) {}
674 ~RemotingTestRendererFactory() override {}
675
676 // PipelineTestRendererFactory implementation.
677 std::unique_ptr<Renderer> CreateRenderer(
678 ScopedVector<VideoDecoder> prepend_video_decoders =
679 ScopedVector<VideoDecoder>(),
680 ScopedVector<AudioDecoder> prepend_audio_decoders =
681 ScopedVector<AudioDecoder>()) override {
682 std::unique_ptr<Renderer> renderer_impl =
683 default_renderer_factory_->CreateRenderer(
684 std::move(prepend_video_decoders),
685 std::move(prepend_audio_decoders));
686 return base::MakeUnique<remoting::End2EndTestRenderer>(
687 std::move(renderer_impl));
688 }
689
690 private:
691 std::unique_ptr<PipelineTestRendererFactory> default_renderer_factory_;
692
693 DISALLOW_COPY_AND_ASSIGN(RemotingTestRendererFactory);
694 };
695 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER)
696
697 } // namespace
698
669 // TODO(xhwang): These tests have been disabled for some time as apptests and no 699 // TODO(xhwang): These tests have been disabled for some time as apptests and no
670 // longer pass. They need to be reconstituted as shell tests. 700 // longer pass. They need to be reconstituted as shell tests.
671 // Currently there are compile issues which must be resolved, 701 // Currently there are compile issues which must be resolved,
672 // preferably by eliminating multiple inheritance here which is 702 // preferably by eliminating multiple inheritance here which is
673 // banned by Google C++ style. 703 // banned by Google C++ style.
674 #if defined(MOJO_RENDERER) && defined(ENABLE_MOJO_PIPELINE_INTEGRATION_TEST) 704 #if defined(MOJO_RENDERER) && defined(ENABLE_MOJO_PIPELINE_INTEGRATION_TEST)
675 class PipelineIntegrationTestHost : public service_manager::test::ServiceTest, 705 class PipelineIntegrationTestHost : public service_manager::test::ServiceTest,
676 public PipelineIntegrationTestBase { 706 public PipelineIntegrationTestBase {
677 public: 707 public:
678 PipelineIntegrationTestHost() 708 PipelineIntegrationTestHost()
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 // never called. 780 // never called.
751 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0); 781 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0);
752 pipeline_->SetCdm(encrypted_media->GetCdmContext(), 782 pipeline_->SetCdm(encrypted_media->GetCdmContext(),
753 base::Bind(&PipelineIntegrationTest::DecryptorAttached, 783 base::Bind(&PipelineIntegrationTest::DecryptorAttached,
754 base::Unretained(this))); 784 base::Unretained(this)));
755 } else { 785 } else {
756 // Encrypted content not used, so this is never called. 786 // Encrypted content not used, so this is never called.
757 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0); 787 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0);
758 } 788 }
759 789
760 pipeline_->Start(demuxer_.get(), CreateRenderer(), this, 790 pipeline_->Start(demuxer_.get(), renderer_factory_->CreateRenderer(), this,
761 base::Bind(&PipelineIntegrationTest::OnStatusCallback, 791 base::Bind(&PipelineIntegrationTest::OnStatusCallback,
762 base::Unretained(this))); 792 base::Unretained(this)));
763 793
764 if (encrypted_media) { 794 if (encrypted_media) {
765 source->set_encrypted_media_init_data_cb( 795 source->set_encrypted_media_init_data_cb(
766 base::Bind(&FakeEncryptedMedia::OnEncryptedMediaInitData, 796 base::Bind(&FakeEncryptedMedia::OnEncryptedMediaInitData,
767 base::Unretained(encrypted_media))); 797 base::Unretained(encrypted_media)));
768 } 798 }
769 base::RunLoop().Run(); 799 base::RunLoop().Run();
770 return pipeline_status_; 800 return pipeline_status_;
(...skipping 23 matching lines...) Expand all
794 return false; 824 return false;
795 825
796 source.EndOfStream(); 826 source.EndOfStream();
797 827
798 source.Shutdown(); 828 source.Shutdown();
799 Stop(); 829 Stop();
800 return true; 830 return true;
801 } 831 }
802 }; 832 };
803 833
834 enum PipelineType {
835 Media, // Test the general media pipeline.
836 MediaRemoting, // Test Media Remoting pipeline.
837 };
838
804 struct PlaybackTestData { 839 struct PlaybackTestData {
840 const PipelineType type;
805 const std::string filename; 841 const std::string filename;
806 const uint32_t start_time_ms; 842 const uint32_t start_time_ms;
807 const uint32_t duration_ms; 843 const uint32_t duration_ms;
808 }; 844 };
809 845
810 struct MSEPlaybackTestData { 846 struct MSEPlaybackTestData {
847 const PipelineType type;
811 const std::string filename; 848 const std::string filename;
812 const std::string mimetype; 849 const std::string mimetype;
813 const size_t append_bytes; 850 const size_t append_bytes;
814 const uint32_t duration_ms; 851 const uint32_t duration_ms;
815 }; 852 };
816 853
817 // Tells gtest how to print our PlaybackTestData structure. 854 // Tells gtest how to print our PlaybackTestData structure.
818 std::ostream& operator<<(std::ostream& os, const PlaybackTestData& data) { 855 std::ostream& operator<<(std::ostream& os, const PlaybackTestData& data) {
819 return os << data.filename; 856 return os << data.filename;
820 } 857 }
821 858
822 std::ostream& operator<<(std::ostream& os, const MSEPlaybackTestData& data) { 859 std::ostream& operator<<(std::ostream& os, const MSEPlaybackTestData& data) {
823 return os << data.filename; 860 return os << data.filename;
824 } 861 }
825 862
826 class BasicPlaybackTest : public PipelineIntegrationTest, 863 class BasicPlaybackTest : public PipelineIntegrationTest,
827 public testing::WithParamInterface<PlaybackTestData> { 864 public testing::WithParamInterface<PlaybackTestData> {
828 }; 865 };
829 866
830 class BasicMSEPlaybackTest 867 class BasicMSEPlaybackTest
831 : public ::testing::WithParamInterface<MSEPlaybackTestData>, 868 : public ::testing::WithParamInterface<MSEPlaybackTestData>,
832 public PipelineIntegrationTest {}; 869 public PipelineIntegrationTest {};
833 870
834 TEST_P(BasicPlaybackTest, PlayToEnd) { 871 TEST_P(BasicPlaybackTest, PlayToEnd) {
835 PlaybackTestData data = GetParam(); 872 PlaybackTestData data = GetParam();
836 873
874 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER)
miu 2017/03/29 01:39:14 Instead of duplicating this code for each test fix
xjz 2017/03/30 23:21:31 Done.
875 if (data.type == PipelineType::MediaRemoting) {
876 std::unique_ptr<PipelineTestRendererFactory> factory =
877 std::move(renderer_factory_);
878 renderer_factory_.reset(
879 new RemotingTestRendererFactory(std::move(factory)));
880 }
881 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER)
882
837 ASSERT_EQ(PIPELINE_OK, 883 ASSERT_EQ(PIPELINE_OK,
838 Start(data.filename, kClockless | kUnreliableDuration)); 884 Start(data.filename, kClockless | kUnreliableDuration));
839 EXPECT_EQ(data.start_time_ms, demuxer_->GetStartTime().InMilliseconds()); 885 EXPECT_EQ(data.start_time_ms, demuxer_->GetStartTime().InMilliseconds());
840 EXPECT_EQ(data.duration_ms, pipeline_->GetMediaDuration().InMilliseconds()); 886 EXPECT_EQ(data.duration_ms, pipeline_->GetMediaDuration().InMilliseconds());
841 887
842 Play(); 888 Play();
843 ASSERT_TRUE(WaitUntilOnEnded()); 889 ASSERT_TRUE(WaitUntilOnEnded());
844 } 890 }
845 891
846 TEST_P(BasicMSEPlaybackTest, PlayToEnd) { 892 TEST_P(BasicMSEPlaybackTest, PlayToEnd) {
847 MSEPlaybackTestData data = GetParam(); 893 MSEPlaybackTestData data = GetParam();
848 894
895 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER)
896 if (data.type == PipelineType::MediaRemoting) {
897 std::unique_ptr<PipelineTestRendererFactory> factory =
898 std::move(renderer_factory_);
899 renderer_factory_.reset(
900 new RemotingTestRendererFactory(std::move(factory)));
901 }
902 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER)
903
849 MockMediaSource source(data.filename, data.mimetype, data.append_bytes); 904 MockMediaSource source(data.filename, data.mimetype, data.append_bytes);
850 // TODO -- ADD uint8_t test_type to StartWithMSE and pass clockless flags 905 // TODO -- ADD uint8_t test_type to StartWithMSE and pass clockless flags
851 ASSERT_EQ(PIPELINE_OK, 906 ASSERT_EQ(PIPELINE_OK,
852 StartPipelineWithMediaSource(&source, kClockless, nullptr)); 907 StartPipelineWithMediaSource(&source, kClockless, nullptr));
853 source.EndOfStream(); 908 source.EndOfStream();
854 909
855 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 910 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
856 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 911 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
857 EXPECT_EQ(data.duration_ms, 912 EXPECT_EQ(data.duration_ms,
858 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 913 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
859 914
860 Play(); 915 Play();
861 916
862 ASSERT_TRUE(WaitUntilOnEnded()); 917 ASSERT_TRUE(WaitUntilOnEnded());
863 918
864 EXPECT_TRUE(demuxer_->GetTimelineOffset().is_null()); 919 EXPECT_TRUE(demuxer_->GetTimelineOffset().is_null());
865 source.Shutdown(); 920 source.Shutdown();
866 Stop(); 921 Stop();
867 } 922 }
868 923
869 #if BUILDFLAG(USE_PROPRIETARY_CODECS) 924 #if BUILDFLAG(USE_PROPRIETARY_CODECS)
870 925
871 const PlaybackTestData kADTSTests[] = { 926 const PlaybackTestData kADTSTests[] = {
872 {"bear-audio-main-aac.aac", 0, 2724}, 927 {PipelineType::Media, "bear-audio-main-aac.aac", 0, 2724},
873 {"bear-audio-lc-aac.aac", 0, 2858}, 928 {PipelineType::Media, "bear-audio-lc-aac.aac", 0, 2858},
874 {"bear-audio-implicit-he-aac-v1.aac", 0, 2812}, 929 {PipelineType::Media, "bear-audio-implicit-he-aac-v1.aac", 0, 2812},
875 {"bear-audio-implicit-he-aac-v2.aac", 0, 3047}, 930 {PipelineType::Media, "bear-audio-implicit-he-aac-v2.aac", 0, 3047},
876 }; 931 };
877 932
878 // TODO(chcunningham): Migrate other basic playback tests to TEST_P. 933 // TODO(chcunningham): Migrate other basic playback tests to TEST_P.
879 INSTANTIATE_TEST_CASE_P(ProprietaryCodecs, 934 INSTANTIATE_TEST_CASE_P(ProprietaryCodecs,
880 BasicPlaybackTest, 935 BasicPlaybackTest,
881 testing::ValuesIn(kADTSTests)); 936 testing::ValuesIn(kADTSTests));
882 937
938 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER)
939 const PlaybackTestData kADTSRemotingTests[] = {
miu 2017/03/29 01:39:15 Let's just have one definition with the remoting e
xjz 2017/03/30 23:21:31 Done.
940 {PipelineType::MediaRemoting, "bear-audio-main-aac.aac", 0, 2724},
941 {PipelineType::MediaRemoting, "bear-audio-lc-aac.aac", 0, 2858},
942 {PipelineType::MediaRemoting, "bear-audio-implicit-he-aac-v1.aac", 0, 2812},
943 {PipelineType::MediaRemoting, "bear-audio-implicit-he-aac-v2.aac", 0, 3047},
944 };
945
946 INSTANTIATE_TEST_CASE_P(ProprietaryCodecs_Remoting,
947 BasicPlaybackTest,
948 testing::ValuesIn(kADTSRemotingTests));
949 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER)
950
883 const MSEPlaybackTestData kMediaSourceADTSTests[] = { 951 const MSEPlaybackTestData kMediaSourceADTSTests[] = {
884 {"bear-audio-main-aac.aac", kADTS, kAppendWholeFile, 2773}, 952 {PipelineType::Media, "bear-audio-main-aac.aac", kADTS, kAppendWholeFile,
885 {"bear-audio-lc-aac.aac", kADTS, kAppendWholeFile, 2794}, 953 2773},
886 {"bear-audio-implicit-he-aac-v1.aac", kADTS, kAppendWholeFile, 2858}, 954 {PipelineType::Media, "bear-audio-lc-aac.aac", kADTS, kAppendWholeFile,
887 {"bear-audio-implicit-he-aac-v2.aac", kADTS, kAppendWholeFile, 2901}, 955 2794},
956 {PipelineType::Media, "bear-audio-implicit-he-aac-v1.aac", kADTS,
957 kAppendWholeFile, 2858},
958 {PipelineType::Media, "bear-audio-implicit-he-aac-v2.aac", kADTS,
959 kAppendWholeFile, 2901},
888 }; 960 };
889 961
890 // TODO(chcunningham): Migrate other basic MSE playback tests to TEST_P. 962 // TODO(chcunningham): Migrate other basic MSE playback tests to TEST_P.
891 INSTANTIATE_TEST_CASE_P(ProprietaryCodecs, 963 INSTANTIATE_TEST_CASE_P(ProprietaryCodecs,
892 BasicMSEPlaybackTest, 964 BasicMSEPlaybackTest,
893 testing::ValuesIn(kMediaSourceADTSTests)); 965 testing::ValuesIn(kMediaSourceADTSTests));
894 966
967 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER)
968 const MSEPlaybackTestData kMediaSourceADTSRemotingTests[] = {
miu 2017/03/29 01:39:15 ditto: Merge into one parameter array.
xjz 2017/03/30 23:21:31 Done.
969 {PipelineType::MediaRemoting, "bear-audio-main-aac.aac", kADTS,
970 kAppendWholeFile, 2773},
971 {PipelineType::MediaRemoting, "bear-audio-lc-aac.aac", kADTS,
972 kAppendWholeFile, 2794},
973 {PipelineType::MediaRemoting, "bear-audio-implicit-he-aac-v1.aac", kADTS,
974 kAppendWholeFile, 2858},
975 {PipelineType::MediaRemoting, "bear-audio-implicit-he-aac-v2.aac", kADTS,
976 kAppendWholeFile, 2901},
977 };
978
979 INSTANTIATE_TEST_CASE_P(ProprietaryCodecs_Remoting,
980 BasicMSEPlaybackTest,
981 testing::ValuesIn(kMediaSourceADTSRemotingTests));
982 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER)
983
895 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) 984 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
896 985
897 TEST_F(PipelineIntegrationTest, BasicPlayback) { 986 struct IntegrationTestData {
987 const PipelineType type;
988 };
989
990 // Tells gtest how to print our PlaybackTestData structure.
991 std::ostream& operator<<(std::ostream& os, const IntegrationTestData& data) {
992 return os << (data.type == PipelineType::Media ? "Media" : "MediaRemoting");
993 }
994
995 // These tests are used to test both media pipeline and media remoting pipeline.
996 class CommonPipelineIntegrationTest
997 : public PipelineIntegrationTest,
998 public testing::WithParamInterface<IntegrationTestData> {
999 public:
1000 CommonPipelineIntegrationTest() {
1001 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER)
1002 IntegrationTestData data = GetParam();
1003 if (data.type == PipelineType::MediaRemoting) {
1004 std::unique_ptr<PipelineTestRendererFactory> factory =
1005 std::move(renderer_factory_);
1006 renderer_factory_.reset(
1007 new RemotingTestRendererFactory(std::move(factory)));
1008 }
1009 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER)
1010 }
1011 };
1012
1013 TEST_P(CommonPipelineIntegrationTest, BasicPlayback) {
898 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); 1014 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm"));
899 1015
900 Play(); 1016 Play();
901 1017
902 ASSERT_TRUE(WaitUntilOnEnded()); 1018 ASSERT_TRUE(WaitUntilOnEnded());
903 } 1019 }
904 1020
905 TEST_F(PipelineIntegrationTest, BasicPlaybackOpusOgg) { 1021 TEST_P(CommonPipelineIntegrationTest, BasicPlaybackOpusOgg) {
906 ASSERT_EQ(PIPELINE_OK, Start("bear-opus.ogg")); 1022 ASSERT_EQ(PIPELINE_OK, Start("bear-opus.ogg"));
907 1023
908 Play(); 1024 Play();
909 1025
910 ASSERT_TRUE(WaitUntilOnEnded()); 1026 ASSERT_TRUE(WaitUntilOnEnded());
911 } 1027 }
912 1028
913 TEST_F(PipelineIntegrationTest, BasicPlaybackHashed) { 1029 TEST_P(CommonPipelineIntegrationTest, BasicPlaybackHashed) {
914 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm", kHashed)); 1030 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm", kHashed));
915 1031
916 Play(); 1032 Play();
917 1033
918 ASSERT_TRUE(WaitUntilOnEnded()); 1034 ASSERT_TRUE(WaitUntilOnEnded());
919 1035
920 EXPECT_HASH_EQ("f0be120a90a811506777c99a2cdf7cc1", GetVideoHash()); 1036 EXPECT_HASH_EQ("f0be120a90a811506777c99a2cdf7cc1", GetVideoHash());
921 EXPECT_HASH_EQ("-3.59,-2.06,-0.43,2.15,0.77,-0.95,", GetAudioHash()); 1037 EXPECT_HASH_EQ("-3.59,-2.06,-0.43,2.15,0.77,-0.95,", GetAudioHash());
922 EXPECT_TRUE(demuxer_->GetTimelineOffset().is_null()); 1038 EXPECT_TRUE(demuxer_->GetTimelineOffset().is_null());
923 } 1039 }
924 1040
925 base::TimeDelta TimestampMs(int milliseconds) { 1041 base::TimeDelta TimestampMs(int milliseconds) {
926 return base::TimeDelta::FromMilliseconds(milliseconds); 1042 return base::TimeDelta::FromMilliseconds(milliseconds);
927 } 1043 }
928 1044
929 TEST_F(PipelineIntegrationTest, PlaybackWithAudioTrackDisabledThenEnabled) { 1045 TEST_P(CommonPipelineIntegrationTest,
1046 PlaybackWithAudioTrackDisabledThenEnabled) {
930 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm", kHashed)); 1047 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm", kHashed));
931 1048
932 // Disable audio. 1049 // Disable audio.
933 std::vector<MediaTrack::Id> empty; 1050 std::vector<MediaTrack::Id> empty;
934 pipeline_->OnEnabledAudioTracksChanged(empty); 1051 pipeline_->OnEnabledAudioTracksChanged(empty);
935 base::RunLoop().RunUntilIdle(); 1052 base::RunLoop().RunUntilIdle();
936 1053
937 // Seek to flush the pipeline and ensure there's no prerolled audio data. 1054 // Seek to flush the pipeline and ensure there's no prerolled audio data.
938 ASSERT_TRUE(Seek(base::TimeDelta())); 1055 ASSERT_TRUE(Seek(base::TimeDelta()));
939 1056
(...skipping 13 matching lines...) Expand all
953 1070
954 // Restart playback from 500ms position. 1071 // Restart playback from 500ms position.
955 ASSERT_TRUE(Seek(k500ms)); 1072 ASSERT_TRUE(Seek(k500ms));
956 Play(); 1073 Play();
957 ASSERT_TRUE(WaitUntilOnEnded()); 1074 ASSERT_TRUE(WaitUntilOnEnded());
958 1075
959 // Verify that audio has been playing after being enabled. 1076 // Verify that audio has been playing after being enabled.
960 EXPECT_HASH_EQ("-1.53,0.21,1.23,1.56,-0.34,-0.94,", GetAudioHash()); 1077 EXPECT_HASH_EQ("-1.53,0.21,1.23,1.56,-0.34,-0.94,", GetAudioHash());
961 } 1078 }
962 1079
963 TEST_F(PipelineIntegrationTest, PlaybackWithVideoTrackDisabledThenEnabled) { 1080 TEST_P(CommonPipelineIntegrationTest,
1081 PlaybackWithVideoTrackDisabledThenEnabled) {
964 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm", kHashed)); 1082 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm", kHashed));
965 1083
966 // Disable video. 1084 // Disable video.
967 std::vector<MediaTrack::Id> empty; 1085 std::vector<MediaTrack::Id> empty;
968 pipeline_->OnSelectedVideoTrackChanged(empty); 1086 pipeline_->OnSelectedVideoTrackChanged(empty);
969 base::RunLoop().RunUntilIdle(); 1087 base::RunLoop().RunUntilIdle();
970 1088
971 // Seek to flush the pipeline and ensure there's no prerolled video data. 1089 // Seek to flush the pipeline and ensure there's no prerolled video data.
972 ASSERT_TRUE(Seek(base::TimeDelta())); 1090 ASSERT_TRUE(Seek(base::TimeDelta()));
973 1091
(...skipping 22 matching lines...) Expand all
996 1114
997 // Restart playback from 500ms position. 1115 // Restart playback from 500ms position.
998 ASSERT_TRUE(Seek(k500ms)); 1116 ASSERT_TRUE(Seek(k500ms));
999 Play(); 1117 Play();
1000 ASSERT_TRUE(WaitUntilOnEnded()); 1118 ASSERT_TRUE(WaitUntilOnEnded());
1001 1119
1002 // Verify that video has been rendered after being enabled. 1120 // Verify that video has been rendered after being enabled.
1003 EXPECT_HASH_EQ("fd59357dfd9c144ab4fb8181b2de32c3", GetVideoHash()); 1121 EXPECT_HASH_EQ("fd59357dfd9c144ab4fb8181b2de32c3", GetVideoHash());
1004 } 1122 }
1005 1123
1006 TEST_F(PipelineIntegrationTest, TrackStatusChangesBeforePipelineStarted) { 1124 TEST_P(CommonPipelineIntegrationTest, TrackStatusChangesBeforePipelineStarted) {
1007 std::vector<MediaTrack::Id> empty_track_ids; 1125 std::vector<MediaTrack::Id> empty_track_ids;
1008 pipeline_->OnEnabledAudioTracksChanged(empty_track_ids); 1126 pipeline_->OnEnabledAudioTracksChanged(empty_track_ids);
1009 pipeline_->OnSelectedVideoTrackChanged(empty_track_ids); 1127 pipeline_->OnSelectedVideoTrackChanged(empty_track_ids);
1010 } 1128 }
1011 1129
1012 TEST_F(PipelineIntegrationTest, TrackStatusChangesAfterPipelineEnded) { 1130 TEST_P(CommonPipelineIntegrationTest, TrackStatusChangesAfterPipelineEnded) {
1013 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm", kHashed)); 1131 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm", kHashed));
1014 Play(); 1132 Play();
1015 ASSERT_TRUE(WaitUntilOnEnded()); 1133 ASSERT_TRUE(WaitUntilOnEnded());
1016 std::vector<MediaTrack::Id> track_ids; 1134 std::vector<MediaTrack::Id> track_ids;
1017 // Disable audio track. 1135 // Disable audio track.
1018 pipeline_->OnEnabledAudioTracksChanged(track_ids); 1136 pipeline_->OnEnabledAudioTracksChanged(track_ids);
1019 // Re-enable audio track. 1137 // Re-enable audio track.
1020 track_ids.push_back("2"); 1138 track_ids.push_back("2");
1021 pipeline_->OnEnabledAudioTracksChanged(track_ids); 1139 pipeline_->OnEnabledAudioTracksChanged(track_ids);
1022 // Disable video track. 1140 // Disable video track.
1023 track_ids.clear(); 1141 track_ids.clear();
1024 pipeline_->OnSelectedVideoTrackChanged(track_ids); 1142 pipeline_->OnSelectedVideoTrackChanged(track_ids);
1025 // Re-enable video track. 1143 // Re-enable video track.
1026 track_ids.push_back("1"); 1144 track_ids.push_back("1");
1027 pipeline_->OnSelectedVideoTrackChanged(track_ids); 1145 pipeline_->OnSelectedVideoTrackChanged(track_ids);
1028 } 1146 }
1029 1147
1030 TEST_F(PipelineIntegrationTest, TrackStatusChangesWhileSuspended) { 1148 TEST_P(CommonPipelineIntegrationTest, TrackStatusChangesWhileSuspended) {
1031 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm", kHashed)); 1149 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm", kHashed));
1032 Play(); 1150 Play();
1033 1151
1034 ASSERT_TRUE(Suspend()); 1152 ASSERT_TRUE(Suspend());
1035 1153
1036 // These get triggered every time playback is resumed. 1154 // These get triggered every time playback is resumed.
1037 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(320, 240))) 1155 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(320, 240)))
1038 .Times(AnyNumber()); 1156 .Times(AnyNumber());
1039 EXPECT_CALL(*this, OnVideoOpacityChange(true)).Times(AnyNumber()); 1157 EXPECT_CALL(*this, OnVideoOpacityChange(true)).Times(AnyNumber());
1040 1158
(...skipping 19 matching lines...) Expand all
1060 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(TimestampMs(400))); 1178 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(TimestampMs(400)));
1061 ASSERT_TRUE(Suspend()); 1179 ASSERT_TRUE(Suspend());
1062 1180
1063 // Re-enable video track. 1181 // Re-enable video track.
1064 track_ids.push_back("1"); 1182 track_ids.push_back("1");
1065 pipeline_->OnSelectedVideoTrackChanged(track_ids); 1183 pipeline_->OnSelectedVideoTrackChanged(track_ids);
1066 ASSERT_TRUE(Resume(TimestampMs(400))); 1184 ASSERT_TRUE(Resume(TimestampMs(400)));
1067 ASSERT_TRUE(WaitUntilOnEnded()); 1185 ASSERT_TRUE(WaitUntilOnEnded());
1068 } 1186 }
1069 1187
1070 TEST_F(PipelineIntegrationTest, PipelineStoppedWhileAudioRestartPending) { 1188 TEST_P(CommonPipelineIntegrationTest, PipelineStoppedWhileAudioRestartPending) {
1071 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); 1189 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm"));
1072 Play(); 1190 Play();
1073 1191
1074 // Disable audio track first, to re-enable it later and stop the pipeline 1192 // Disable audio track first, to re-enable it later and stop the pipeline
1075 // (which destroys the media renderer) while audio restart is pending. 1193 // (which destroys the media renderer) while audio restart is pending.
1076 std::vector<MediaTrack::Id> track_ids; 1194 std::vector<MediaTrack::Id> track_ids;
1077 pipeline_->OnEnabledAudioTracksChanged(track_ids); 1195 pipeline_->OnEnabledAudioTracksChanged(track_ids);
1078 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(TimestampMs(200))); 1196 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(TimestampMs(200)));
1079 1197
1080 track_ids.push_back("2"); 1198 track_ids.push_back("2");
1081 pipeline_->OnEnabledAudioTracksChanged(track_ids); 1199 pipeline_->OnEnabledAudioTracksChanged(track_ids);
1082 Stop(); 1200 Stop();
1083 } 1201 }
1084 1202
1085 TEST_F(PipelineIntegrationTest, PipelineStoppedWhileVideoRestartPending) { 1203 TEST_P(CommonPipelineIntegrationTest, PipelineStoppedWhileVideoRestartPending) {
1086 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); 1204 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm"));
1087 Play(); 1205 Play();
1088 1206
1089 // Disable video track first, to re-enable it later and stop the pipeline 1207 // Disable video track first, to re-enable it later and stop the pipeline
1090 // (which destroys the media renderer) while video restart is pending. 1208 // (which destroys the media renderer) while video restart is pending.
1091 std::vector<MediaTrack::Id> track_ids; 1209 std::vector<MediaTrack::Id> track_ids;
1092 pipeline_->OnSelectedVideoTrackChanged(track_ids); 1210 pipeline_->OnSelectedVideoTrackChanged(track_ids);
1093 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(TimestampMs(200))); 1211 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(TimestampMs(200)));
1094 1212
1095 track_ids.push_back("1"); 1213 track_ids.push_back("1");
1096 pipeline_->OnSelectedVideoTrackChanged(track_ids); 1214 pipeline_->OnSelectedVideoTrackChanged(track_ids);
1097 Stop(); 1215 Stop();
1098 } 1216 }
1099 1217
1100 TEST_F(PipelineIntegrationTest, 1218 TEST_P(CommonPipelineIntegrationTest, BasicPlaybackOpusOggTrimmingHashed) {
1101 MAYBE_CLOCKLESS(BasicPlaybackOpusOggTrimmingHashed)) { 1219 #if defined(DISABLE_CLOCKLESS_TESTS)
1220 return;
1221 #endif // defined(DISABLE_CLOCKLESS_TESTS)
1222
1102 ASSERT_EQ(PIPELINE_OK, 1223 ASSERT_EQ(PIPELINE_OK,
1103 Start("opus-trimming-test.webm", kHashed | kClockless)); 1224 Start("opus-trimming-test.webm", kHashed | kClockless));
1104 1225
1105 Play(); 1226 Play();
1106 1227
1107 ASSERT_TRUE(WaitUntilOnEnded()); 1228 ASSERT_TRUE(WaitUntilOnEnded());
1108 EXPECT_HASH_EQ(kOpusEndTrimmingHash_1, GetAudioHash()); 1229 EXPECT_HASH_EQ(kOpusEndTrimmingHash_1, GetAudioHash());
1109 1230
1110 // Seek within the pre-skip section, this should not cause a beep. 1231 // Seek within the pre-skip section, this should not cause a beep.
1111 ASSERT_TRUE(Seek(base::TimeDelta::FromSeconds(1))); 1232 ASSERT_TRUE(Seek(base::TimeDelta::FromSeconds(1)));
1112 Play(); 1233 Play();
1113 ASSERT_TRUE(WaitUntilOnEnded()); 1234 ASSERT_TRUE(WaitUntilOnEnded());
1114 EXPECT_HASH_EQ(kOpusEndTrimmingHash_2, GetAudioHash()); 1235 EXPECT_HASH_EQ(kOpusEndTrimmingHash_2, GetAudioHash());
1115 1236
1116 // Seek somewhere outside of the pre-skip / end-trim section, demxuer should 1237 // Seek somewhere outside of the pre-skip / end-trim section, demxuer should
1117 // correctly preroll enough to accurately decode this segment. 1238 // correctly preroll enough to accurately decode this segment.
1118 ASSERT_TRUE(Seek(base::TimeDelta::FromMilliseconds(6360))); 1239 ASSERT_TRUE(Seek(base::TimeDelta::FromMilliseconds(6360)));
1119 Play(); 1240 Play();
1120 ASSERT_TRUE(WaitUntilOnEnded()); 1241 ASSERT_TRUE(WaitUntilOnEnded());
1121 EXPECT_HASH_EQ(kOpusEndTrimmingHash_3, GetAudioHash()); 1242 EXPECT_HASH_EQ(kOpusEndTrimmingHash_3, GetAudioHash());
1122 } 1243 }
1123 1244
1124 TEST_F(PipelineIntegrationTest, 1245 TEST_P(CommonPipelineIntegrationTest, BasicPlaybackOpusWebmTrimmingHashed) {
1125 MAYBE_CLOCKLESS(BasicPlaybackOpusWebmTrimmingHashed)) { 1246 #if defined(DISABLE_CLOCKLESS_TESTS)
1247 return;
1248 #endif // defined(DISABLE_CLOCKLESS_TESTS)
1249
1126 ASSERT_EQ(PIPELINE_OK, 1250 ASSERT_EQ(PIPELINE_OK,
1127 Start("opus-trimming-test.webm", kHashed | kClockless)); 1251 Start("opus-trimming-test.webm", kHashed | kClockless));
1128 1252
1129 Play(); 1253 Play();
1130 1254
1131 ASSERT_TRUE(WaitUntilOnEnded()); 1255 ASSERT_TRUE(WaitUntilOnEnded());
1132 EXPECT_HASH_EQ(kOpusEndTrimmingHash_1, GetAudioHash()); 1256 EXPECT_HASH_EQ(kOpusEndTrimmingHash_1, GetAudioHash());
1133 1257
1134 // Seek within the pre-skip section, this should not cause a beep. 1258 // Seek within the pre-skip section, this should not cause a beep.
1135 ASSERT_TRUE(Seek(base::TimeDelta::FromSeconds(1))); 1259 ASSERT_TRUE(Seek(base::TimeDelta::FromSeconds(1)));
1136 Play(); 1260 Play();
1137 ASSERT_TRUE(WaitUntilOnEnded()); 1261 ASSERT_TRUE(WaitUntilOnEnded());
1138 EXPECT_HASH_EQ(kOpusEndTrimmingHash_2, GetAudioHash()); 1262 EXPECT_HASH_EQ(kOpusEndTrimmingHash_2, GetAudioHash());
1139 1263
1140 // Seek somewhere outside of the pre-skip / end-trim section, demxuer should 1264 // Seek somewhere outside of the pre-skip / end-trim section, demxuer should
1141 // correctly preroll enough to accurately decode this segment. 1265 // correctly preroll enough to accurately decode this segment.
1142 ASSERT_TRUE(Seek(base::TimeDelta::FromMilliseconds(6360))); 1266 ASSERT_TRUE(Seek(base::TimeDelta::FromMilliseconds(6360)));
1143 Play(); 1267 Play();
1144 ASSERT_TRUE(WaitUntilOnEnded()); 1268 ASSERT_TRUE(WaitUntilOnEnded());
1145 EXPECT_HASH_EQ(kOpusEndTrimmingHash_3, GetAudioHash()); 1269 EXPECT_HASH_EQ(kOpusEndTrimmingHash_3, GetAudioHash());
1146 } 1270 }
1147 1271
1148 TEST_F(PipelineIntegrationTest, 1272 TEST_P(CommonPipelineIntegrationTest,
1149 MAYBE_CLOCKLESS(BasicPlaybackOpusWebmTrimmingHashed_MediaSource)) { 1273 BasicPlaybackOpusWebmTrimmingHashed_MediaSource) {
1274 #if defined(DISABLE_CLOCKLESS_TESTS)
1275 return;
1276 #endif // defined(DISABLE_CLOCKLESS_TESTS)
1277
1150 MockMediaSource source("opus-trimming-test.webm", kOpusAudioOnlyWebM, 1278 MockMediaSource source("opus-trimming-test.webm", kOpusAudioOnlyWebM,
1151 kAppendWholeFile); 1279 kAppendWholeFile);
1152 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource( 1280 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(
1153 &source, kClockless | kHashed, nullptr)); 1281 &source, kClockless | kHashed, nullptr));
1154 source.EndOfStream(); 1282 source.EndOfStream();
1155 1283
1156 Play(); 1284 Play();
1157 1285
1158 ASSERT_TRUE(WaitUntilOnEnded()); 1286 ASSERT_TRUE(WaitUntilOnEnded());
1159 EXPECT_HASH_EQ(kOpusEndTrimmingHash_1, GetAudioHash()); 1287 EXPECT_HASH_EQ(kOpusEndTrimmingHash_1, GetAudioHash());
1160 1288
1161 // Seek within the pre-skip section, this should not cause a beep. 1289 // Seek within the pre-skip section, this should not cause a beep.
1162 base::TimeDelta seek_time = base::TimeDelta::FromSeconds(1); 1290 base::TimeDelta seek_time = base::TimeDelta::FromSeconds(1);
1163 source.Seek(seek_time); 1291 source.Seek(seek_time);
1164 ASSERT_TRUE(Seek(seek_time)); 1292 ASSERT_TRUE(Seek(seek_time));
1165 Play(); 1293 Play();
1166 ASSERT_TRUE(WaitUntilOnEnded()); 1294 ASSERT_TRUE(WaitUntilOnEnded());
1167 EXPECT_HASH_EQ(kOpusEndTrimmingHash_2, GetAudioHash()); 1295 EXPECT_HASH_EQ(kOpusEndTrimmingHash_2, GetAudioHash());
1168 1296
1169 // Seek somewhere outside of the pre-skip / end-trim section, demuxer should 1297 // Seek somewhere outside of the pre-skip / end-trim section, demuxer should
1170 // correctly preroll enough to accurately decode this segment. 1298 // correctly preroll enough to accurately decode this segment.
1171 seek_time = base::TimeDelta::FromMilliseconds(6360); 1299 seek_time = base::TimeDelta::FromMilliseconds(6360);
1172 source.Seek(seek_time); 1300 source.Seek(seek_time);
1173 ASSERT_TRUE(Seek(seek_time)); 1301 ASSERT_TRUE(Seek(seek_time));
1174 Play(); 1302 Play();
1175 ASSERT_TRUE(WaitUntilOnEnded()); 1303 ASSERT_TRUE(WaitUntilOnEnded());
1176 EXPECT_HASH_EQ(kOpusEndTrimmingHash_3, GetAudioHash()); 1304 EXPECT_HASH_EQ(kOpusEndTrimmingHash_3, GetAudioHash());
1177 } 1305 }
1178 1306
1179 TEST_F(PipelineIntegrationTest, 1307 TEST_P(CommonPipelineIntegrationTest,
1180 MAYBE_CLOCKLESS(BasicPlaybackOpusPrerollExceedsCodecDelay)) { 1308 BasicPlaybackOpusPrerollExceedsCodecDelay) {
1309 #if defined(DISABLE_CLOCKLESS_TESTS)
1310 return;
1311 #endif // defined(DISABLE_CLOCKLESS_TESTS)
1312
1181 ASSERT_EQ(PIPELINE_OK, Start("bear-opus.webm", kHashed | kClockless)); 1313 ASSERT_EQ(PIPELINE_OK, Start("bear-opus.webm", kHashed | kClockless));
1182 1314
1183 AudioDecoderConfig config = 1315 AudioDecoderConfig config =
1184 demuxer_->GetStream(DemuxerStream::AUDIO)->audio_decoder_config(); 1316 demuxer_->GetStream(DemuxerStream::AUDIO)->audio_decoder_config();
1185 1317
1186 // Verify that this file's preroll is not eclipsed by the codec delay so we 1318 // Verify that this file's preroll is not eclipsed by the codec delay so we
1187 // can detect when preroll is not properly performed. 1319 // can detect when preroll is not properly performed.
1188 base::TimeDelta codec_delay = base::TimeDelta::FromSecondsD( 1320 base::TimeDelta codec_delay = base::TimeDelta::FromSecondsD(
1189 static_cast<double>(config.codec_delay()) / config.samples_per_second()); 1321 static_cast<double>(config.codec_delay()) / config.samples_per_second());
1190 ASSERT_GT(config.seek_preroll(), codec_delay); 1322 ASSERT_GT(config.seek_preroll(), codec_delay);
1191 1323
1192 Play(); 1324 Play();
1193 ASSERT_TRUE(WaitUntilOnEnded()); 1325 ASSERT_TRUE(WaitUntilOnEnded());
1194 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_1, GetAudioHash()); 1326 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_1, GetAudioHash());
1195 1327
1196 // Seek halfway through the file to invoke seek preroll. 1328 // Seek halfway through the file to invoke seek preroll.
1197 ASSERT_TRUE(Seek(base::TimeDelta::FromSecondsD(1.414))); 1329 ASSERT_TRUE(Seek(base::TimeDelta::FromSecondsD(1.414)));
1198 Play(); 1330 Play();
1199 ASSERT_TRUE(WaitUntilOnEnded()); 1331 ASSERT_TRUE(WaitUntilOnEnded());
1200 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_2, GetAudioHash()); 1332 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_2, GetAudioHash());
1201 } 1333 }
1202 1334
1203 TEST_F(PipelineIntegrationTest, 1335 TEST_P(CommonPipelineIntegrationTest,
1204 MAYBE_CLOCKLESS(BasicPlaybackOpusPrerollExceedsCodecDelay_MediaSource)) { 1336 BasicPlaybackOpusPrerollExceedsCodecDelay_MediaSource) {
1337 #if defined(DISABLE_CLOCKLESS_TESTS)
1338 return;
1339 #endif // defined(DISABLE_CLOCKLESS_TESTS)
1340
1205 MockMediaSource source("bear-opus.webm", kOpusAudioOnlyWebM, 1341 MockMediaSource source("bear-opus.webm", kOpusAudioOnlyWebM,
1206 kAppendWholeFile); 1342 kAppendWholeFile);
1207 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource( 1343 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(
1208 &source, kClockless | kHashed, nullptr)); 1344 &source, kClockless | kHashed, nullptr));
1209 source.EndOfStream(); 1345 source.EndOfStream();
1210 1346
1211 AudioDecoderConfig config = 1347 AudioDecoderConfig config =
1212 demuxer_->GetStream(DemuxerStream::AUDIO)->audio_decoder_config(); 1348 demuxer_->GetStream(DemuxerStream::AUDIO)->audio_decoder_config();
1213 1349
1214 // Verify that this file's preroll is not eclipsed by the codec delay so we 1350 // Verify that this file's preroll is not eclipsed by the codec delay so we
1215 // can detect when preroll is not properly performed. 1351 // can detect when preroll is not properly performed.
1216 base::TimeDelta codec_delay = base::TimeDelta::FromSecondsD( 1352 base::TimeDelta codec_delay = base::TimeDelta::FromSecondsD(
1217 static_cast<double>(config.codec_delay()) / config.samples_per_second()); 1353 static_cast<double>(config.codec_delay()) / config.samples_per_second());
1218 ASSERT_GT(config.seek_preroll(), codec_delay); 1354 ASSERT_GT(config.seek_preroll(), codec_delay);
1219 1355
1220 Play(); 1356 Play();
1221 ASSERT_TRUE(WaitUntilOnEnded()); 1357 ASSERT_TRUE(WaitUntilOnEnded());
1222 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_1, GetAudioHash()); 1358 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_1, GetAudioHash());
1223 1359
1224 // Seek halfway through the file to invoke seek preroll. 1360 // Seek halfway through the file to invoke seek preroll.
1225 base::TimeDelta seek_time = base::TimeDelta::FromSecondsD(1.414); 1361 base::TimeDelta seek_time = base::TimeDelta::FromSecondsD(1.414);
1226 source.Seek(seek_time); 1362 source.Seek(seek_time);
1227 ASSERT_TRUE(Seek(seek_time)); 1363 ASSERT_TRUE(Seek(seek_time));
1228 Play(); 1364 Play();
1229 ASSERT_TRUE(WaitUntilOnEnded()); 1365 ASSERT_TRUE(WaitUntilOnEnded());
1230 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_2, GetAudioHash()); 1366 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_2, GetAudioHash());
1231 } 1367 }
1232 1368
1233 TEST_F(PipelineIntegrationTest, BasicPlaybackLive) { 1369 TEST_P(CommonPipelineIntegrationTest, BasicPlaybackLive) {
1234 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-live.webm", kHashed)); 1370 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-live.webm", kHashed));
1235 1371
1236 // Live stream does not have duration in the initialization segment. 1372 // Live stream does not have duration in the initialization segment.
1237 // It will be set after the entire file is available. 1373 // It will be set after the entire file is available.
1238 EXPECT_CALL(*this, OnDurationChange()).Times(1); 1374 EXPECT_CALL(*this, OnDurationChange()).Times(1);
1239 1375
1240 Play(); 1376 Play();
1241 1377
1242 ASSERT_TRUE(WaitUntilOnEnded()); 1378 ASSERT_TRUE(WaitUntilOnEnded());
1243 1379
1244 EXPECT_HASH_EQ("f0be120a90a811506777c99a2cdf7cc1", GetVideoHash()); 1380 EXPECT_HASH_EQ("f0be120a90a811506777c99a2cdf7cc1", GetVideoHash());
1245 EXPECT_HASH_EQ("-3.59,-2.06,-0.43,2.15,0.77,-0.95,", GetAudioHash()); 1381 EXPECT_HASH_EQ("-3.59,-2.06,-0.43,2.15,0.77,-0.95,", GetAudioHash());
1246 EXPECT_EQ(kLiveTimelineOffset(), demuxer_->GetTimelineOffset()); 1382 EXPECT_EQ(kLiveTimelineOffset(), demuxer_->GetTimelineOffset());
1247 } 1383 }
1248 1384
1249 TEST_F(PipelineIntegrationTest, S32PlaybackHashed) { 1385 TEST_P(CommonPipelineIntegrationTest, S32PlaybackHashed) {
1250 ASSERT_EQ(PIPELINE_OK, Start("sfx_s32le.wav", kHashed)); 1386 ASSERT_EQ(PIPELINE_OK, Start("sfx_s32le.wav", kHashed));
1251 Play(); 1387 Play();
1252 ASSERT_TRUE(WaitUntilOnEnded()); 1388 ASSERT_TRUE(WaitUntilOnEnded());
1253 EXPECT_HASH_EQ(std::string(kNullVideoHash), GetVideoHash()); 1389 EXPECT_HASH_EQ(std::string(kNullVideoHash), GetVideoHash());
1254 EXPECT_HASH_EQ("3.03,2.86,2.99,3.31,3.57,4.06,", GetAudioHash()); 1390 EXPECT_HASH_EQ("3.03,2.86,2.99,3.31,3.57,4.06,", GetAudioHash());
1255 } 1391 }
1256 1392
1257 TEST_F(PipelineIntegrationTest, F32PlaybackHashed) { 1393 TEST_P(CommonPipelineIntegrationTest, F32PlaybackHashed) {
1258 ASSERT_EQ(PIPELINE_OK, Start("sfx_f32le.wav", kHashed)); 1394 ASSERT_EQ(PIPELINE_OK, Start("sfx_f32le.wav", kHashed));
1259 Play(); 1395 Play();
1260 ASSERT_TRUE(WaitUntilOnEnded()); 1396 ASSERT_TRUE(WaitUntilOnEnded());
1261 EXPECT_HASH_EQ(std::string(kNullVideoHash), GetVideoHash()); 1397 EXPECT_HASH_EQ(std::string(kNullVideoHash), GetVideoHash());
1262 EXPECT_HASH_EQ("3.03,2.86,2.99,3.31,3.57,4.06,", GetAudioHash()); 1398 EXPECT_HASH_EQ("3.03,2.86,2.99,3.31,3.57,4.06,", GetAudioHash());
1263 } 1399 }
1264 1400
1265 TEST_F(PipelineIntegrationTest, MAYBE_EME(BasicPlaybackEncrypted)) { 1401 TEST_P(CommonPipelineIntegrationTest, FlacPlaybackHashed) {
1266 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1267 set_encrypted_media_init_data_cb(
1268 base::Bind(&FakeEncryptedMedia::OnEncryptedMediaInitData,
1269 base::Unretained(&encrypted_media)));
1270
1271 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-av_enc-av.webm",
1272 encrypted_media.GetCdmContext()));
1273
1274 Play();
1275
1276 ASSERT_TRUE(WaitUntilOnEnded());
1277 Stop();
1278 }
1279
1280 TEST_F(PipelineIntegrationTest, FlacPlaybackHashed) {
1281 ASSERT_EQ(PIPELINE_OK, Start("sfx.flac", kHashed)); 1402 ASSERT_EQ(PIPELINE_OK, Start("sfx.flac", kHashed));
1282 Play(); 1403 Play();
1283 ASSERT_TRUE(WaitUntilOnEnded()); 1404 ASSERT_TRUE(WaitUntilOnEnded());
1284 EXPECT_HASH_EQ(std::string(kNullVideoHash), GetVideoHash()); 1405 EXPECT_HASH_EQ(std::string(kNullVideoHash), GetVideoHash());
1285 EXPECT_HASH_EQ("3.03,2.86,2.99,3.31,3.57,4.06,", GetAudioHash()); 1406 EXPECT_HASH_EQ("3.03,2.86,2.99,3.31,3.57,4.06,", GetAudioHash());
1286 } 1407 }
1287 1408
1288 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource) { 1409 TEST_P(CommonPipelineIntegrationTest, BasicPlayback_MediaSource) {
1289 MockMediaSource source("bear-320x240.webm", kWebM, 219229); 1410 MockMediaSource source("bear-320x240.webm", kWebM, 219229);
1290 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); 1411 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
1291 source.EndOfStream(); 1412 source.EndOfStream();
1292 1413
1293 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1414 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1294 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1415 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1295 EXPECT_EQ(k320WebMFileDurationMs, 1416 EXPECT_EQ(k320WebMFileDurationMs,
1296 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1417 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1297 1418
1298 Play(); 1419 Play();
1299 1420
1300 ASSERT_TRUE(WaitUntilOnEnded()); 1421 ASSERT_TRUE(WaitUntilOnEnded());
1301 1422
1302 EXPECT_TRUE(demuxer_->GetTimelineOffset().is_null()); 1423 EXPECT_TRUE(demuxer_->GetTimelineOffset().is_null());
1303 source.Shutdown(); 1424 source.Shutdown();
1304 Stop(); 1425 Stop();
1305 } 1426 }
1306 1427
1307 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Live) { 1428 TEST_P(CommonPipelineIntegrationTest, BasicPlayback_MediaSource_Live) {
1308 MockMediaSource source("bear-320x240-live.webm", kWebM, 219221); 1429 MockMediaSource source("bear-320x240-live.webm", kWebM, 219221);
1309 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); 1430 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
1310 source.EndOfStream(); 1431 source.EndOfStream();
1311 1432
1312 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1433 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1313 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1434 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1314 EXPECT_EQ(k320WebMFileDurationMs, 1435 EXPECT_EQ(k320WebMFileDurationMs,
1315 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1436 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1316 1437
1317 Play(); 1438 Play();
1318 1439
1319 ASSERT_TRUE(WaitUntilOnEnded()); 1440 ASSERT_TRUE(WaitUntilOnEnded());
1320 1441
1321 EXPECT_EQ(kLiveTimelineOffset(), demuxer_->GetTimelineOffset()); 1442 EXPECT_EQ(kLiveTimelineOffset(), demuxer_->GetTimelineOffset());
1322 source.Shutdown(); 1443 source.Shutdown();
1323 Stop(); 1444 Stop();
1324 } 1445 }
1325 1446
1326 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VP9_WebM) { 1447 TEST_P(CommonPipelineIntegrationTest, BasicPlayback_MediaSource_VP9_WebM) {
1327 MockMediaSource source("bear-vp9.webm", kWebMVP9, 67504); 1448 MockMediaSource source("bear-vp9.webm", kWebMVP9, 67504);
1328 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); 1449 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
1329 source.EndOfStream(); 1450 source.EndOfStream();
1330 1451
1331 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1452 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1332 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1453 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1333 EXPECT_EQ(kVP9WebMFileDurationMs, 1454 EXPECT_EQ(kVP9WebMFileDurationMs,
1334 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1455 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1335 1456
1336 Play(); 1457 Play();
1337 1458
1338 ASSERT_TRUE(WaitUntilOnEnded()); 1459 ASSERT_TRUE(WaitUntilOnEnded());
1339 source.Shutdown(); 1460 source.Shutdown();
1340 Stop(); 1461 Stop();
1341 } 1462 }
1342 1463
1343 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VP9_BlockGroup_WebM) { 1464 TEST_P(CommonPipelineIntegrationTest,
1465 BasicPlayback_MediaSource_VP9_BlockGroup_WebM) {
1344 MockMediaSource source("bear-vp9-blockgroup.webm", kWebMVP9, 67871); 1466 MockMediaSource source("bear-vp9-blockgroup.webm", kWebMVP9, 67871);
1345 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); 1467 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
1346 source.EndOfStream(); 1468 source.EndOfStream();
1347 1469
1348 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1470 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1349 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1471 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1350 EXPECT_EQ(kVP9WebMFileDurationMs, 1472 EXPECT_EQ(kVP9WebMFileDurationMs,
1351 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1473 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1352 1474
1353 Play(); 1475 Play();
1354 1476
1355 ASSERT_TRUE(WaitUntilOnEnded()); 1477 ASSERT_TRUE(WaitUntilOnEnded());
1356 source.Shutdown(); 1478 source.Shutdown();
1357 Stop(); 1479 Stop();
1358 } 1480 }
1359 1481
1360 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VP8A_WebM) { 1482 TEST_P(CommonPipelineIntegrationTest, BasicPlayback_MediaSource_VP8A_WebM) {
1361 MockMediaSource source("bear-vp8a.webm", kVideoOnlyWebM, kAppendWholeFile); 1483 MockMediaSource source("bear-vp8a.webm", kVideoOnlyWebM, kAppendWholeFile);
1362 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); 1484 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
1363 source.EndOfStream(); 1485 source.EndOfStream();
1364 1486
1365 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1487 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1366 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1488 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1367 EXPECT_EQ(kVP8AWebMFileDurationMs, 1489 EXPECT_EQ(kVP8AWebMFileDurationMs,
1368 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1490 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1369 1491
1370 Play(); 1492 Play();
1371 1493
1372 ASSERT_TRUE(WaitUntilOnEnded()); 1494 ASSERT_TRUE(WaitUntilOnEnded());
1373 source.Shutdown(); 1495 source.Shutdown();
1374 Stop(); 1496 Stop();
1375 } 1497 }
1376 1498
1377 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus_WebM) { 1499 TEST_P(CommonPipelineIntegrationTest, BasicPlayback_MediaSource_Opus_WebM) {
1378 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, 1500 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM,
1379 kAppendWholeFile); 1501 kAppendWholeFile);
1380 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); 1502 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
1381 source.EndOfStream(); 1503 source.EndOfStream();
1382 1504
1383 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1505 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1384 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1506 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1385 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs, 1507 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs,
1386 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1508 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1387 Play(); 1509 Play();
1388 1510
1389 ASSERT_TRUE(WaitUntilOnEnded()); 1511 ASSERT_TRUE(WaitUntilOnEnded());
1390 source.Shutdown(); 1512 source.Shutdown();
1391 Stop(); 1513 Stop();
1392 } 1514 }
1393 1515
1394 // Flaky. http://crbug.com/304776 1516 // Flaky. http://crbug.com/304776
1395 TEST_F(PipelineIntegrationTest, DISABLED_MediaSource_Opus_Seeking_WebM) { 1517 TEST_P(CommonPipelineIntegrationTest, DISABLED_MediaSource_Opus_Seeking_WebM) {
1396 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, 1518 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM,
1397 kAppendWholeFile); 1519 kAppendWholeFile);
1398 EXPECT_EQ(PIPELINE_OK, 1520 EXPECT_EQ(PIPELINE_OK,
1399 StartPipelineWithMediaSource(&source, kHashed, nullptr)); 1521 StartPipelineWithMediaSource(&source, kHashed, nullptr));
1400 1522
1401 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1523 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1402 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1524 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1403 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs, 1525 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs,
1404 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1526 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1405 1527
1406 base::TimeDelta start_seek_time = base::TimeDelta::FromMilliseconds(1000); 1528 base::TimeDelta start_seek_time = base::TimeDelta::FromMilliseconds(1000);
1407 base::TimeDelta seek_time = base::TimeDelta::FromMilliseconds(2000); 1529 base::TimeDelta seek_time = base::TimeDelta::FromMilliseconds(2000);
1408 1530
1409 Play(); 1531 Play();
1410 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); 1532 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time));
1411 source.Seek(seek_time, 0x1D5, 34017); 1533 source.Seek(seek_time, 0x1D5, 34017);
1412 source.EndOfStream(); 1534 source.EndOfStream();
1413 ASSERT_TRUE(Seek(seek_time)); 1535 ASSERT_TRUE(Seek(seek_time));
1414 1536
1415 ASSERT_TRUE(WaitUntilOnEnded()); 1537 ASSERT_TRUE(WaitUntilOnEnded());
1416 1538
1417 EXPECT_HASH_EQ("0.76,0.20,-0.82,-0.58,-1.29,-0.29,", GetAudioHash()); 1539 EXPECT_HASH_EQ("0.76,0.20,-0.82,-0.58,-1.29,-0.29,", GetAudioHash());
1418 1540
1419 source.Shutdown(); 1541 source.Shutdown();
1420 Stop(); 1542 Stop();
1421 } 1543 }
1422 1544
1423 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) { 1545 TEST_P(CommonPipelineIntegrationTest, MediaSource_ConfigChange_WebM) {
1424 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, 1546 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM,
1425 kAppendWholeFile); 1547 kAppendWholeFile);
1426 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); 1548 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
1427 1549
1428 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(640, 360))).Times(1); 1550 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(640, 360))).Times(1);
1429 scoped_refptr<DecoderBuffer> second_file = 1551 scoped_refptr<DecoderBuffer> second_file =
1430 ReadTestDataFile("bear-640x360.webm"); 1552 ReadTestDataFile("bear-640x360.webm");
1431 ASSERT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), 1553 ASSERT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1432 second_file->data(), 1554 second_file->data(),
1433 second_file->data_size())); 1555 second_file->data_size()));
1434 source.EndOfStream(); 1556 source.EndOfStream();
1435 1557
1436 Play(); 1558 Play();
1437 EXPECT_TRUE(WaitUntilOnEnded()); 1559 EXPECT_TRUE(WaitUntilOnEnded());
1438 1560
1439 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1561 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1440 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1562 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1441 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, 1563 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs,
1442 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1564 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1443 1565
1444 source.Shutdown(); 1566 source.Shutdown();
1445 Stop(); 1567 Stop();
1446 } 1568 }
1447 1569
1448 TEST_F(PipelineIntegrationTest, MediaSource_Remove_Updates_BufferedRanges) { 1570 TEST_P(CommonPipelineIntegrationTest,
1571 MediaSource_Remove_Updates_BufferedRanges) {
1449 const char* input_filename = "bear-320x240.webm"; 1572 const char* input_filename = "bear-320x240.webm";
1450 MockMediaSource source(input_filename, kWebM, kAppendWholeFile); 1573 MockMediaSource source(input_filename, kWebM, kAppendWholeFile);
1451 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); 1574 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
1452 1575
1453 auto buffered_ranges = pipeline_->GetBufferedTimeRanges(); 1576 auto buffered_ranges = pipeline_->GetBufferedTimeRanges();
1454 EXPECT_EQ(1u, buffered_ranges.size()); 1577 EXPECT_EQ(1u, buffered_ranges.size());
1455 EXPECT_EQ(0, buffered_ranges.start(0).InMilliseconds()); 1578 EXPECT_EQ(0, buffered_ranges.start(0).InMilliseconds());
1456 EXPECT_EQ(k320WebMFileDurationMs, buffered_ranges.end(0).InMilliseconds()); 1579 EXPECT_EQ(k320WebMFileDurationMs, buffered_ranges.end(0).InMilliseconds());
1457 1580
1458 source.RemoveRange(base::TimeDelta::FromMilliseconds(1000), 1581 source.RemoveRange(base::TimeDelta::FromMilliseconds(1000),
1459 base::TimeDelta::FromMilliseconds(k320WebMFileDurationMs)); 1582 base::TimeDelta::FromMilliseconds(k320WebMFileDurationMs));
1460 base::RunLoop().RunUntilIdle(); 1583 base::RunLoop().RunUntilIdle();
1461 1584
1462 buffered_ranges = pipeline_->GetBufferedTimeRanges(); 1585 buffered_ranges = pipeline_->GetBufferedTimeRanges();
1463 EXPECT_EQ(1u, buffered_ranges.size()); 1586 EXPECT_EQ(1u, buffered_ranges.size());
1464 EXPECT_EQ(0, buffered_ranges.start(0).InMilliseconds()); 1587 EXPECT_EQ(0, buffered_ranges.start(0).InMilliseconds());
1465 EXPECT_EQ(1001, buffered_ranges.end(0).InMilliseconds()); 1588 EXPECT_EQ(1001, buffered_ranges.end(0).InMilliseconds());
1466 1589
1467 source.Shutdown(); 1590 source.Shutdown();
1468 Stop(); 1591 Stop();
1469 } 1592 }
1470 1593
1471 // This test case imitates media playback with advancing media_time and 1594 // This test case imitates media playback with advancing media_time and
1472 // continuously adding new data. At some point we should reach the buffering 1595 // continuously adding new data. At some point we should reach the buffering
1473 // limit, after that MediaSource should evict some buffered data and that 1596 // limit, after that MediaSource should evict some buffered data and that
1474 // evicted data shold be reflected in the change of media::Pipeline buffered 1597 // evicted data shold be reflected in the change of media::Pipeline buffered
1475 // ranges (returned by GetBufferedTimeRanges). At that point the buffered ranges 1598 // ranges (returned by GetBufferedTimeRanges). At that point the buffered ranges
1476 // will no longer start at 0. 1599 // will no longer start at 0.
1477 TEST_F(PipelineIntegrationTest, MediaSource_FillUp_Buffer) { 1600 TEST_P(CommonPipelineIntegrationTest, MediaSource_FillUp_Buffer) {
1478 const char* input_filename = "bear-320x240.webm"; 1601 const char* input_filename = "bear-320x240.webm";
1479 MockMediaSource source(input_filename, kWebM, kAppendWholeFile); 1602 MockMediaSource source(input_filename, kWebM, kAppendWholeFile);
1480 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); 1603 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
1481 source.SetMemoryLimits(1048576); 1604 source.SetMemoryLimits(1048576);
1482 1605
1483 scoped_refptr<DecoderBuffer> file = ReadTestDataFile(input_filename); 1606 scoped_refptr<DecoderBuffer> file = ReadTestDataFile(input_filename);
1484 1607
1485 auto buffered_ranges = pipeline_->GetBufferedTimeRanges(); 1608 auto buffered_ranges = pipeline_->GetBufferedTimeRanges();
1486 EXPECT_EQ(1u, buffered_ranges.size()); 1609 EXPECT_EQ(1u, buffered_ranges.size());
1487 do { 1610 do {
1488 // Advance media_time to the end of the currently buffered data 1611 // Advance media_time to the end of the currently buffered data
1489 base::TimeDelta media_time = buffered_ranges.end(0); 1612 base::TimeDelta media_time = buffered_ranges.end(0);
1490 source.Seek(media_time); 1613 source.Seek(media_time);
1491 // Ask MediaSource to evict buffered data if buffering limit has been 1614 // Ask MediaSource to evict buffered data if buffering limit has been
1492 // reached (the data will be evicted from the front of the buffered range). 1615 // reached (the data will be evicted from the front of the buffered range).
1493 source.EvictCodedFrames(media_time, file->data_size()); 1616 source.EvictCodedFrames(media_time, file->data_size());
1494 ASSERT_TRUE( 1617 ASSERT_TRUE(
1495 source.AppendAtTime(media_time, file->data(), file->data_size())); 1618 source.AppendAtTime(media_time, file->data(), file->data_size()));
1496 base::RunLoop().RunUntilIdle(); 1619 base::RunLoop().RunUntilIdle();
1497 1620
1498 buffered_ranges = pipeline_->GetBufferedTimeRanges(); 1621 buffered_ranges = pipeline_->GetBufferedTimeRanges();
1499 } while (buffered_ranges.size() == 1 && 1622 } while (buffered_ranges.size() == 1 &&
1500 buffered_ranges.start(0) == base::TimeDelta::FromSeconds(0)); 1623 buffered_ranges.start(0) == base::TimeDelta::FromSeconds(0));
1501 1624
1502 EXPECT_EQ(1u, buffered_ranges.size()); 1625 EXPECT_EQ(1u, buffered_ranges.size());
1503 source.Shutdown(); 1626 source.Shutdown();
1504 Stop(); 1627 Stop();
1505 } 1628 }
1506 1629
1507 TEST_F(PipelineIntegrationTest,
1508 MAYBE_EME(MediaSource_ConfigChange_Encrypted_WebM)) {
1509 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM,
1510 kAppendWholeFile);
1511 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1512 EXPECT_EQ(PIPELINE_OK,
1513 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
1514
1515 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(640, 360))).Times(1);
1516 scoped_refptr<DecoderBuffer> second_file =
1517 ReadTestDataFile("bear-640x360-av_enc-av.webm");
1518 ASSERT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1519 second_file->data(),
1520 second_file->data_size()));
1521 source.EndOfStream();
1522
1523 Play();
1524 EXPECT_TRUE(WaitUntilOnEnded());
1525
1526 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1527 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1528 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs,
1529 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1530
1531 source.Shutdown();
1532 Stop();
1533 }
1534
1535 // Config changes from encrypted to clear are not currently supported.
1536 TEST_F(PipelineIntegrationTest,
1537 MAYBE_EME(MediaSource_ConfigChange_ClearThenEncrypted_WebM)) {
1538 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM,
1539 kAppendWholeFile);
1540 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1541 EXPECT_EQ(PIPELINE_OK,
1542 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
1543
1544 scoped_refptr<DecoderBuffer> second_file =
1545 ReadTestDataFile("bear-640x360-av_enc-av.webm");
1546
1547 ASSERT_FALSE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1548 second_file->data(),
1549 second_file->data_size()));
1550
1551 source.EndOfStream();
1552
1553 base::RunLoop().Run();
1554 EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, pipeline_status_);
1555
1556 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1557 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1558 // The second video was not added, so its time has not been added.
1559 EXPECT_EQ(k320WebMFileDurationMs,
1560 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1561
1562 Play();
1563
1564 EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, WaitUntilEndedOrError());
1565 source.Shutdown();
1566 }
1567
1568 // Config changes from clear to encrypted are not currently supported.
1569 TEST_F(PipelineIntegrationTest,
1570 MAYBE_EME(MediaSource_ConfigChange_EncryptedThenClear_WebM)) {
1571 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM,
1572 kAppendWholeFile);
1573 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1574 EXPECT_EQ(PIPELINE_OK,
1575 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
1576
1577 scoped_refptr<DecoderBuffer> second_file =
1578 ReadTestDataFile("bear-640x360.webm");
1579
1580 ASSERT_FALSE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1581 second_file->data(),
1582 second_file->data_size()));
1583
1584 source.EndOfStream();
1585
1586 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1587 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1588 // The second video was not added, so its time has not been added.
1589 EXPECT_EQ(k320EncWebMFileDurationMs,
1590 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1591
1592 Play();
1593
1594 EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, WaitUntilEndedOrError());
1595 source.Shutdown();
1596 }
1597
1598 #if defined(ARCH_CPU_X86_FAMILY) && !defined(OS_ANDROID) 1630 #if defined(ARCH_CPU_X86_FAMILY) && !defined(OS_ANDROID)
1599 TEST_F(PipelineIntegrationTest, BasicPlaybackHi10PVP9) { 1631 TEST_P(CommonPipelineIntegrationTest, BasicPlaybackHi10PVP9) {
1600 ASSERT_EQ(PIPELINE_OK, Start("bear-320x180-hi10p-vp9.webm", kClockless)); 1632 ASSERT_EQ(PIPELINE_OK, Start("bear-320x180-hi10p-vp9.webm", kClockless));
1601 1633
1602 Play(); 1634 Play();
1603 1635
1604 ASSERT_TRUE(WaitUntilOnEnded()); 1636 ASSERT_TRUE(WaitUntilOnEnded());
1605 } 1637 }
1606 1638
1607 TEST_F(PipelineIntegrationTest, BasicPlaybackHi12PVP9) { 1639 TEST_P(CommonPipelineIntegrationTest, BasicPlaybackHi12PVP9) {
1608 ASSERT_EQ(PIPELINE_OK, Start("bear-320x180-hi12p-vp9.webm", kClockless)); 1640 ASSERT_EQ(PIPELINE_OK, Start("bear-320x180-hi12p-vp9.webm", kClockless));
1609 1641
1610 Play(); 1642 Play();
1611 1643
1612 ASSERT_TRUE(WaitUntilOnEnded()); 1644 ASSERT_TRUE(WaitUntilOnEnded());
1613 } 1645 }
1614 #endif 1646 #endif
1615 1647
1616 #if BUILDFLAG(USE_PROPRIETARY_CODECS) 1648 #if BUILDFLAG(USE_PROPRIETARY_CODECS)
1617 1649
1618 TEST_F(PipelineIntegrationTest, BasicPlaybackHi10P) { 1650 TEST_P(CommonPipelineIntegrationTest, BasicPlaybackHi10P) {
1619 ASSERT_EQ(PIPELINE_OK, Start("bear-320x180-hi10p.mp4", kClockless)); 1651 ASSERT_EQ(PIPELINE_OK, Start("bear-320x180-hi10p.mp4", kClockless));
1620 1652
1621 Play(); 1653 Play();
1622 1654
1623 ASSERT_TRUE(WaitUntilOnEnded()); 1655 ASSERT_TRUE(WaitUntilOnEnded());
1624 } 1656 }
1625 1657
1626 TEST_F(PipelineIntegrationTest, BasicFallback) { 1658 TEST_P(CommonPipelineIntegrationTest, BasicFallback) {
1627 ScopedVector<VideoDecoder> failing_video_decoder; 1659 ScopedVector<VideoDecoder> failing_video_decoder;
1628 failing_video_decoder.push_back(new FailingVideoDecoder()); 1660 failing_video_decoder.push_back(new FailingVideoDecoder());
1629 1661
1630 ASSERT_EQ(PIPELINE_OK, 1662 ASSERT_EQ(PIPELINE_OK,
1631 Start("bear.mp4", kClockless, std::move(failing_video_decoder))); 1663 Start("bear.mp4", kClockless, std::move(failing_video_decoder)));
1632 1664
1633 Play(); 1665 Play();
1634 1666
1635 ASSERT_TRUE(WaitUntilOnEnded()); 1667 ASSERT_TRUE(WaitUntilOnEnded());
1636 }; 1668 };
1637 1669
1638 TEST_F(PipelineIntegrationTest, MediaSource_ADTS) { 1670 TEST_P(CommonPipelineIntegrationTest, MediaSource_ADTS) {
1639 MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile); 1671 MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile);
1640 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); 1672 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
1641 source.EndOfStream(); 1673 source.EndOfStream();
1642 1674
1643 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1675 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1644 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1676 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1645 EXPECT_EQ(325, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1677 EXPECT_EQ(325, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1646 1678
1647 Play(); 1679 Play();
1648 1680
1649 EXPECT_TRUE(WaitUntilOnEnded()); 1681 EXPECT_TRUE(WaitUntilOnEnded());
1650 } 1682 }
1651 1683
1652 TEST_F(PipelineIntegrationTest, MediaSource_ADTS_TimestampOffset) { 1684 TEST_P(CommonPipelineIntegrationTest, MediaSource_ADTS_TimestampOffset) {
1653 MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile); 1685 MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile);
1654 EXPECT_EQ(PIPELINE_OK, 1686 EXPECT_EQ(PIPELINE_OK,
1655 StartPipelineWithMediaSource(&source, kHashed, nullptr)); 1687 StartPipelineWithMediaSource(&source, kHashed, nullptr));
1656 EXPECT_EQ(325, source.last_timestamp_offset().InMilliseconds()); 1688 EXPECT_EQ(325, source.last_timestamp_offset().InMilliseconds());
1657 1689
1658 // Trim off multiple frames off the beginning of the segment which will cause 1690 // Trim off multiple frames off the beginning of the segment which will cause
1659 // the first decoded frame to be incorrect if preroll isn't implemented. 1691 // the first decoded frame to be incorrect if preroll isn't implemented.
1660 const base::TimeDelta adts_preroll_duration = 1692 const base::TimeDelta adts_preroll_duration =
1661 base::TimeDelta::FromSecondsD(2.5 * 1024 / 44100); 1693 base::TimeDelta::FromSecondsD(2.5 * 1024 / 44100);
1662 const base::TimeDelta append_time = 1694 const base::TimeDelta append_time =
(...skipping 10 matching lines...) Expand all
1673 1705
1674 EXPECT_EQ(592, source.last_timestamp_offset().InMilliseconds()); 1706 EXPECT_EQ(592, source.last_timestamp_offset().InMilliseconds());
1675 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1707 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1676 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1708 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1677 EXPECT_EQ(592, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1709 EXPECT_EQ(592, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1678 1710
1679 // Verify preroll is stripped. 1711 // Verify preroll is stripped.
1680 EXPECT_HASH_EQ("-0.25,0.67,0.04,0.14,-0.49,-0.41,", GetAudioHash()); 1712 EXPECT_HASH_EQ("-0.25,0.67,0.04,0.14,-0.49,-0.41,", GetAudioHash());
1681 } 1713 }
1682 1714
1683 TEST_F(PipelineIntegrationTest, BasicPlaybackHashed_MP3) { 1715 TEST_P(CommonPipelineIntegrationTest, BasicPlaybackHashed_MP3) {
1684 ASSERT_EQ(PIPELINE_OK, Start("sfx.mp3", kHashed)); 1716 ASSERT_EQ(PIPELINE_OK, Start("sfx.mp3", kHashed));
1685 1717
1686 Play(); 1718 Play();
1687 1719
1688 ASSERT_TRUE(WaitUntilOnEnded()); 1720 ASSERT_TRUE(WaitUntilOnEnded());
1689 1721
1690 // Verify codec delay and preroll are stripped. 1722 // Verify codec delay and preroll are stripped.
1691 EXPECT_HASH_EQ("1.30,2.72,4.56,5.08,3.74,2.03,", GetAudioHash()); 1723 EXPECT_HASH_EQ("1.30,2.72,4.56,5.08,3.74,2.03,", GetAudioHash());
1692 } 1724 }
1693 1725
1694 #if !defined(DISABLE_CLOCKLESS_TESTS) 1726 TEST_P(CommonPipelineIntegrationTest, MediaSource_MP3) {
1695 class Mp3FastSeekParams {
1696 public:
1697 Mp3FastSeekParams(const char* filename, const char* hash)
1698 : filename(filename), hash(hash) {}
1699 const char* filename;
1700 const char* hash;
1701 };
1702
1703 class Mp3FastSeekIntegrationTest
1704 : public PipelineIntegrationTest,
1705 public testing::WithParamInterface<Mp3FastSeekParams> {};
1706
1707 TEST_P(Mp3FastSeekIntegrationTest, FastSeekAccuracy_MP3) {
1708 Mp3FastSeekParams config = GetParam();
1709 ASSERT_EQ(PIPELINE_OK, Start(config.filename, kHashed));
1710
1711 // The XING TOC is inaccurate. We don't use it for CBR, we tolerate it for VBR
1712 // (best option for fast seeking; see Mp3SeekFFmpegDemuxerTest). The chosen
1713 // seek time exposes inaccuracy in TOC such that the hash will change if seek
1714 // logic is regressed. See https://crbug.com/545914.
1715 //
1716 // Quick TOC design (not pretty!):
1717 // - All MP3 TOCs are 100 bytes
1718 // - Each byte is read as a uint8_t; value between 0 - 255.
1719 // - The index into this array is the numerator in the ratio: index / 100.
1720 // This fraction represents a playback time as a percentage of duration.
1721 // - The value at the given index is the numerator in the ratio: value / 256.
1722 // This fraction represents a byte offset as a percentage of the file size.
1723 //
1724 // For CBR files, each frame is the same size, so the offset for time of
1725 // (0.98 * duration) should be around (0.98 * file size). This is 250.88 / 256
1726 // but the numerator will be truncated in the TOC as 250, losing precision.
1727 base::TimeDelta seek_time(0.98 * pipeline_->GetMediaDuration());
1728
1729 ASSERT_TRUE(Seek(seek_time));
1730 Play();
1731 ASSERT_TRUE(WaitUntilOnEnded());
1732
1733 EXPECT_HASH_EQ(config.hash, GetAudioHash());
1734 }
1735
1736 // TODO(CHCUNNINGHAM): Re-enable for OSX once 1% flakiness is root caused.
1737 // See http://crbug.com/571898
1738 #if !defined(OS_MACOSX)
1739 // CBR seeks should always be fast and accurate.
1740 INSTANTIATE_TEST_CASE_P(
1741 CBRSeek_HasTOC,
1742 Mp3FastSeekIntegrationTest,
1743 ::testing::Values(Mp3FastSeekParams("bear-audio-10s-CBR-has-TOC.mp3",
1744 "-0.71,0.36,2.96,2.68,2.10,-1.08,")));
1745 #endif
1746
1747 INSTANTIATE_TEST_CASE_P(
1748 CBRSeeks_NoTOC,
1749 Mp3FastSeekIntegrationTest,
1750 ::testing::Values(Mp3FastSeekParams("bear-audio-10s-CBR-no-TOC.mp3",
1751 "0.95,0.56,1.34,0.47,1.77,0.84,")));
1752
1753 // VBR seeks can be fast *OR* accurate, but not both. We chose fast.
1754 INSTANTIATE_TEST_CASE_P(
1755 VBRSeeks_HasTOC,
1756 Mp3FastSeekIntegrationTest,
1757 ::testing::Values(Mp3FastSeekParams("bear-audio-10s-VBR-has-TOC.mp3",
1758 "-0.15,-0.83,0.54,1.00,1.94,0.93,")));
1759
1760 INSTANTIATE_TEST_CASE_P(
1761 VBRSeeks_NoTOC,
1762 Mp3FastSeekIntegrationTest,
1763 ::testing::Values(Mp3FastSeekParams("bear-audio-10s-VBR-no-TOC.mp3",
1764 "-0.22,0.80,1.19,0.73,-0.31,-1.12,")));
1765 #endif // !defined(DISABLE_CLOCKLESS_TESTS)
1766
1767 TEST_F(PipelineIntegrationTest, MediaSource_MP3) {
1768 MockMediaSource source("sfx.mp3", kMP3, kAppendWholeFile); 1727 MockMediaSource source("sfx.mp3", kMP3, kAppendWholeFile);
1769 EXPECT_EQ(PIPELINE_OK, 1728 EXPECT_EQ(PIPELINE_OK,
1770 StartPipelineWithMediaSource(&source, kHashed, nullptr)); 1729 StartPipelineWithMediaSource(&source, kHashed, nullptr));
1771 source.EndOfStream(); 1730 source.EndOfStream();
1772 1731
1773 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1732 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1774 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1733 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1775 EXPECT_EQ(313, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1734 EXPECT_EQ(313, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1776 1735
1777 Play(); 1736 Play();
1778 1737
1779 EXPECT_TRUE(WaitUntilOnEnded()); 1738 EXPECT_TRUE(WaitUntilOnEnded());
1780 1739
1781 // Verify that codec delay was stripped. 1740 // Verify that codec delay was stripped.
1782 EXPECT_HASH_EQ("1.01,2.71,4.18,4.32,3.04,1.12,", GetAudioHash()); 1741 EXPECT_HASH_EQ("1.01,2.71,4.18,4.32,3.04,1.12,", GetAudioHash());
1783 } 1742 }
1784 1743
1785 TEST_F(PipelineIntegrationTest, MediaSource_MP3_TimestampOffset) { 1744 TEST_P(CommonPipelineIntegrationTest, MediaSource_MP3_TimestampOffset) {
1786 MockMediaSource source("sfx.mp3", kMP3, kAppendWholeFile); 1745 MockMediaSource source("sfx.mp3", kMP3, kAppendWholeFile);
1787 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); 1746 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
1788 EXPECT_EQ(313, source.last_timestamp_offset().InMilliseconds()); 1747 EXPECT_EQ(313, source.last_timestamp_offset().InMilliseconds());
1789 1748
1790 // There are 576 silent frames at the start of this mp3. The second append 1749 // There are 576 silent frames at the start of this mp3. The second append
1791 // should trim them off. 1750 // should trim them off.
1792 const base::TimeDelta mp3_preroll_duration = 1751 const base::TimeDelta mp3_preroll_duration =
1793 base::TimeDelta::FromSecondsD(576.0 / 44100); 1752 base::TimeDelta::FromSecondsD(576.0 / 44100);
1794 const base::TimeDelta append_time = 1753 const base::TimeDelta append_time =
1795 source.last_timestamp_offset() - mp3_preroll_duration; 1754 source.last_timestamp_offset() - mp3_preroll_duration;
1796 1755
1797 scoped_refptr<DecoderBuffer> second_file = ReadTestDataFile("sfx.mp3"); 1756 scoped_refptr<DecoderBuffer> second_file = ReadTestDataFile("sfx.mp3");
1798 source.AppendAtTimeWithWindow(append_time, append_time + mp3_preroll_duration, 1757 source.AppendAtTimeWithWindow(append_time, append_time + mp3_preroll_duration,
1799 kInfiniteDuration, second_file->data(), 1758 kInfiniteDuration, second_file->data(),
1800 second_file->data_size()); 1759 second_file->data_size());
1801 source.EndOfStream(); 1760 source.EndOfStream();
1802 1761
1803 Play(); 1762 Play();
1804 EXPECT_TRUE(WaitUntilOnEnded()); 1763 EXPECT_TRUE(WaitUntilOnEnded());
1805 1764
1806 EXPECT_EQ(613, source.last_timestamp_offset().InMilliseconds()); 1765 EXPECT_EQ(613, source.last_timestamp_offset().InMilliseconds());
1807 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1766 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1808 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1767 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1809 EXPECT_EQ(613, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1768 EXPECT_EQ(613, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1810 } 1769 }
1811 1770
1812 TEST_F(PipelineIntegrationTest, MediaSource_MP3_Icecast) { 1771 TEST_P(CommonPipelineIntegrationTest, MediaSource_MP3_Icecast) {
1813 MockMediaSource source("icy_sfx.mp3", kMP3, kAppendWholeFile); 1772 MockMediaSource source("icy_sfx.mp3", kMP3, kAppendWholeFile);
1814 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); 1773 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
1815 source.EndOfStream(); 1774 source.EndOfStream();
1816 1775
1817 Play(); 1776 Play();
1818 1777
1819 EXPECT_TRUE(WaitUntilOnEnded()); 1778 EXPECT_TRUE(WaitUntilOnEnded());
1820 } 1779 }
1821 1780
1822 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_MP4) { 1781 TEST_P(CommonPipelineIntegrationTest, MediaSource_ConfigChange_MP4) {
1823 MockMediaSource source("bear-640x360-av_frag.mp4", kMP4, kAppendWholeFile); 1782 MockMediaSource source("bear-640x360-av_frag.mp4", kMP4, kAppendWholeFile);
1824 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); 1783 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
1825 1784
1826 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(1280, 720))).Times(1); 1785 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(1280, 720))).Times(1);
1827 scoped_refptr<DecoderBuffer> second_file = 1786 scoped_refptr<DecoderBuffer> second_file =
1828 ReadTestDataFile("bear-1280x720-av_frag.mp4"); 1787 ReadTestDataFile("bear-1280x720-av_frag.mp4");
1829 ASSERT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), 1788 ASSERT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1830 second_file->data(), 1789 second_file->data(),
1831 second_file->data_size())); 1790 second_file->data_size()));
1832 source.EndOfStream(); 1791 source.EndOfStream();
1833 1792
1834 Play(); 1793 Play();
1835 EXPECT_TRUE(WaitUntilOnEnded()); 1794 EXPECT_TRUE(WaitUntilOnEnded());
1836 1795
1837 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1796 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1838 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1797 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1839 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs, 1798 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs,
1840 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1799 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1841 1800
1842 source.Shutdown(); 1801 source.Shutdown();
1843 Stop(); 1802 Stop();
1844 } 1803 }
1845
1846 TEST_F(PipelineIntegrationTest,
1847 MAYBE_EME(MediaSource_ConfigChange_Encrypted_MP4_CENC_VideoOnly)) {
1848 MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video,
1849 kAppendWholeFile);
1850 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1851 EXPECT_EQ(PIPELINE_OK,
1852 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
1853
1854 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(1280, 720))).Times(1);
1855 scoped_refptr<DecoderBuffer> second_file =
1856 ReadTestDataFile("bear-1280x720-v_frag-cenc.mp4");
1857 ASSERT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1858 second_file->data(),
1859 second_file->data_size()));
1860 source.EndOfStream();
1861
1862 Play();
1863 EXPECT_TRUE(WaitUntilOnEnded());
1864
1865 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1866 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1867 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs,
1868 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1869
1870 source.Shutdown();
1871 Stop();
1872 }
1873
1874 TEST_F(PipelineIntegrationTest,
1875 MAYBE_EME(
1876 MediaSource_ConfigChange_Encrypted_MP4_CENC_KeyRotation_VideoOnly)) {
1877 MockMediaSource source("bear-640x360-v_frag-cenc-key_rotation.mp4", kMP4Video,
1878 kAppendWholeFile);
1879 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp());
1880 EXPECT_EQ(PIPELINE_OK,
1881 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
1882
1883 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(1280, 720))).Times(1);
1884 scoped_refptr<DecoderBuffer> second_file =
1885 ReadTestDataFile("bear-1280x720-v_frag-cenc-key_rotation.mp4");
1886 ASSERT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1887 second_file->data(),
1888 second_file->data_size()));
1889 source.EndOfStream();
1890
1891 Play();
1892 EXPECT_TRUE(WaitUntilOnEnded());
1893
1894 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1895 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1896 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs,
1897 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1898
1899 source.Shutdown();
1900 Stop();
1901 }
1902
1903 // Config changes from clear to encrypted are not currently supported.
1904 // TODO(ddorwin): Figure out why this CHECKs in AppendAtTime().
1905 TEST_F(PipelineIntegrationTest,
1906 DISABLED_MediaSource_ConfigChange_ClearThenEncrypted_MP4_CENC) {
1907 MockMediaSource source("bear-640x360-av_frag.mp4", kMP4Video,
1908 kAppendWholeFile);
1909 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1910 EXPECT_EQ(PIPELINE_OK,
1911 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
1912
1913 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(1280, 720))).Times(1);
1914 scoped_refptr<DecoderBuffer> second_file =
1915 ReadTestDataFile("bear-1280x720-v_frag-cenc.mp4");
1916 ASSERT_FALSE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1917 second_file->data(),
1918 second_file->data_size()));
1919
1920 source.EndOfStream();
1921
1922 base::RunLoop().Run();
1923 EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, pipeline_status_);
1924
1925 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1926 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1927 // The second video was not added, so its time has not been added.
1928 EXPECT_EQ(k640IsoFileDurationMs,
1929 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1930
1931 Play();
1932
1933 EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, WaitUntilEndedOrError());
1934 source.Shutdown();
1935 }
1936
1937 // Config changes from encrypted to clear are not currently supported.
1938 TEST_F(PipelineIntegrationTest,
1939 MAYBE_EME(MediaSource_ConfigChange_EncryptedThenClear_MP4_CENC)) {
1940 MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video,
1941 kAppendWholeFile);
1942 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1943 EXPECT_EQ(PIPELINE_OK,
1944 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
1945
1946 scoped_refptr<DecoderBuffer> second_file =
1947 ReadTestDataFile("bear-1280x720-av_frag.mp4");
1948
1949 ASSERT_FALSE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1950 second_file->data(),
1951 second_file->data_size()));
1952
1953 source.EndOfStream();
1954
1955 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1956 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1957 // The second video was not added, so its time has not been added.
1958 EXPECT_EQ(k640IsoCencFileDurationMs,
1959 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1960
1961 Play();
1962
1963 EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, WaitUntilEndedOrError());
1964 source.Shutdown();
1965 }
1966
1967 // Verify files which change configuration midstream fail gracefully.
1968 TEST_F(PipelineIntegrationTest, MidStreamConfigChangesFail) {
1969 ASSERT_EQ(PIPELINE_OK, Start("midstream_config_change.mp3"));
1970 Play();
1971 ASSERT_EQ(WaitUntilEndedOrError(), PIPELINE_ERROR_DECODE);
1972 }
1973 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) 1804 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
1974 1805
1975 TEST_F(PipelineIntegrationTest, BasicPlayback_16x9AspectRatio) { 1806 TEST_P(CommonPipelineIntegrationTest, BasicPlayback_16x9AspectRatio) {
1976 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-16x9-aspect.webm")); 1807 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-16x9-aspect.webm"));
1977 Play(); 1808 Play();
1978 ASSERT_TRUE(WaitUntilOnEnded()); 1809 ASSERT_TRUE(WaitUntilOnEnded());
1979 } 1810 }
1980 1811
1981 TEST_F(PipelineIntegrationTest, MAYBE_EME(EncryptedPlayback_WebM)) {
1982 MockMediaSource source("bear-320x240-av_enc-av.webm", kWebM, 219816);
1983 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1984 EXPECT_EQ(PIPELINE_OK,
1985 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
1986
1987 source.EndOfStream();
1988 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
1989
1990 Play();
1991
1992 ASSERT_TRUE(WaitUntilOnEnded());
1993 source.Shutdown();
1994 Stop();
1995 }
1996
1997 TEST_F(PipelineIntegrationTest, MAYBE_EME(EncryptedPlayback_ClearStart_WebM)) {
1998 MockMediaSource source("bear-320x240-av_enc-av_clear-1s.webm", kWebM,
1999 kAppendWholeFile);
2000 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
2001 EXPECT_EQ(PIPELINE_OK,
2002 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2003
2004 source.EndOfStream();
2005 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
2006
2007 Play();
2008
2009 ASSERT_TRUE(WaitUntilOnEnded());
2010 source.Shutdown();
2011 Stop();
2012 }
2013
2014 TEST_F(PipelineIntegrationTest,
2015 MAYBE_EME(EncryptedPlayback_NoEncryptedFrames_WebM)) {
2016 MockMediaSource source("bear-320x240-av_enc-av_clear-all.webm", kWebM,
2017 kAppendWholeFile);
2018 FakeEncryptedMedia encrypted_media(new NoResponseApp());
2019 EXPECT_EQ(PIPELINE_OK,
2020 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2021
2022 source.EndOfStream();
2023 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
2024
2025 Play();
2026
2027 ASSERT_TRUE(WaitUntilOnEnded());
2028 source.Shutdown();
2029 Stop();
2030 }
2031
2032 #if BUILDFLAG(USE_PROPRIETARY_CODECS) 1812 #if BUILDFLAG(USE_PROPRIETARY_CODECS)
2033 TEST_F(PipelineIntegrationTest, 1813 TEST_P(CommonPipelineIntegrationTest, Mp2ts_AAC_HE_SBR_Audio) {
2034 MAYBE_EME(EncryptedPlayback_MP4_CENC_VideoOnly)) {
2035 MockMediaSource source("bear-1280x720-v_frag-cenc.mp4", kMP4Video,
2036 kAppendWholeFile);
2037 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
2038 EXPECT_EQ(PIPELINE_OK,
2039 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2040
2041 source.EndOfStream();
2042 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
2043
2044 Play();
2045
2046 ASSERT_TRUE(WaitUntilOnEnded());
2047 source.Shutdown();
2048 Stop();
2049 }
2050
2051 TEST_F(PipelineIntegrationTest,
2052 MAYBE_EME(EncryptedPlayback_MP4_CENC_AudioOnly)) {
2053 MockMediaSource source("bear-1280x720-a_frag-cenc.mp4", kMP4Audio,
2054 kAppendWholeFile);
2055 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
2056 EXPECT_EQ(PIPELINE_OK,
2057 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2058
2059 source.EndOfStream();
2060 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
2061
2062 Play();
2063
2064 ASSERT_TRUE(WaitUntilOnEnded());
2065 source.Shutdown();
2066 Stop();
2067 }
2068
2069 TEST_F(PipelineIntegrationTest,
2070 MAYBE_EME(EncryptedPlayback_NoEncryptedFrames_MP4_CENC_VideoOnly)) {
2071 MockMediaSource source("bear-1280x720-v_frag-cenc_clear-all.mp4", kMP4Video,
2072 kAppendWholeFile);
2073 FakeEncryptedMedia encrypted_media(new NoResponseApp());
2074 EXPECT_EQ(PIPELINE_OK,
2075 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2076
2077 source.EndOfStream();
2078
2079 Play();
2080
2081 ASSERT_TRUE(WaitUntilOnEnded());
2082 source.Shutdown();
2083 Stop();
2084 }
2085
2086 TEST_F(PipelineIntegrationTest, Mp2ts_AAC_HE_SBR_Audio) {
2087 MockMediaSource source("bear-1280x720-aac_he.ts", kMP2AudioSBR, 1814 MockMediaSource source("bear-1280x720-aac_he.ts", kMP2AudioSBR,
2088 kAppendWholeFile); 1815 kAppendWholeFile);
2089 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) 1816 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER)
2090 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); 1817 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
2091 source.EndOfStream(); 1818 source.EndOfStream();
2092 ASSERT_EQ(PIPELINE_OK, pipeline_status_); 1819 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
2093 1820
2094 // Check that SBR is taken into account correctly by mpeg2ts parser. When an 1821 // Check that SBR is taken into account correctly by mpeg2ts parser. When an
2095 // SBR stream is parsed as non-SBR stream, then audio frame durations are 1822 // SBR stream is parsed as non-SBR stream, then audio frame durations are
2096 // calculated incorrectly and that leads to gaps in buffered ranges (so this 1823 // calculated incorrectly and that leads to gaps in buffered ranges (so this
2097 // check will fail) and eventually leads to stalled playback. 1824 // check will fail) and eventually leads to stalled playback.
2098 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1825 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
2099 #else 1826 #else
2100 EXPECT_EQ( 1827 EXPECT_EQ(
2101 DEMUXER_ERROR_COULD_NOT_OPEN, 1828 DEMUXER_ERROR_COULD_NOT_OPEN,
2102 StartPipelineWithMediaSource(&source, kExpectDemuxerFailure, nullptr)); 1829 StartPipelineWithMediaSource(&source, kExpectDemuxerFailure, nullptr));
2103 #endif 1830 #endif
2104 } 1831 }
2105 1832
2106 TEST_F(PipelineIntegrationTest, 1833 TEST_P(CommonPipelineIntegrationTest,
2107 MAYBE_EME(EncryptedPlayback_NoEncryptedFrames_MP4_CENC_AudioOnly)) { 1834 BasicPlayback_MediaSource_VideoOnly_MP4_AVC3) {
2108 MockMediaSource source("bear-1280x720-a_frag-cenc_clear-all.mp4", kMP4Audio, 1835 MockMediaSource source("bear-1280x720-v_frag-avc3.mp4", kMP4VideoAVC3,
2109 kAppendWholeFile); 1836 kAppendWholeFile);
2110 FakeEncryptedMedia encrypted_media(new NoResponseApp()); 1837 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
2111 EXPECT_EQ(PIPELINE_OK, 1838 source.EndOfStream();
2112 StartPipelineWithEncryptedMedia(&source, &encrypted_media)); 1839
2113 1840 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
2114 source.EndOfStream(); 1841 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
2115 1842 EXPECT_EQ(k1280IsoAVC3FileDurationMs,
2116 Play(); 1843 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
2117 1844
2118 ASSERT_TRUE(WaitUntilOnEnded()); 1845 Play();
2119 source.Shutdown(); 1846
2120 Stop(); 1847 ASSERT_TRUE(WaitUntilOnEnded());
2121 } 1848 source.Shutdown();
2122 1849 Stop();
2123 TEST_F(PipelineIntegrationTest, 1850 }
2124 MAYBE_EME(EncryptedPlayback_MP4_CENC_SENC_Video)) { 1851
2125 MockMediaSource source("bear-640x360-v_frag-cenc-senc.mp4", kMP4Video, 1852 TEST_P(CommonPipelineIntegrationTest,
2126 kAppendWholeFile); 1853 BasicPlayback_MediaSource_VideoOnly_MP4_VP9) {
2127 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1854 MockMediaSource source("bear-320x240-v_frag-vp9.mp4", kMP4VideoVP9,
2128 EXPECT_EQ(PIPELINE_OK,
2129 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2130
2131 source.EndOfStream();
2132
2133 Play();
2134
2135 ASSERT_TRUE(WaitUntilOnEnded());
2136 source.Shutdown();
2137 Stop();
2138 }
2139
2140 // 'SAIZ' and 'SAIO' boxes contain redundant information which is already
2141 // available in 'SENC' box. Although 'SAIZ' and 'SAIO' boxes are required per
2142 // CENC spec for backward compatibility reasons, but we do not use the two
2143 // boxes if 'SENC' box is present, so the code should work even if the two
2144 // boxes are not present.
2145 TEST_F(PipelineIntegrationTest,
2146 MAYBE_EME(EncryptedPlayback_MP4_CENC_SENC_NO_SAIZ_SAIO_Video)) {
2147 MockMediaSource source("bear-640x360-v_frag-cenc-senc-no-saiz-saio.mp4",
2148 kMP4Video, kAppendWholeFile);
2149 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
2150 EXPECT_EQ(PIPELINE_OK,
2151 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2152
2153 source.EndOfStream();
2154
2155 Play();
2156
2157 ASSERT_TRUE(WaitUntilOnEnded());
2158 source.Shutdown();
2159 Stop();
2160 }
2161
2162 TEST_F(PipelineIntegrationTest,
2163 MAYBE_EME(EncryptedPlayback_MP4_CENC_KeyRotation_Video)) {
2164 MockMediaSource source("bear-1280x720-v_frag-cenc-key_rotation.mp4",
2165 kMP4Video, kAppendWholeFile);
2166 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp());
2167 EXPECT_EQ(PIPELINE_OK,
2168 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2169
2170 source.EndOfStream();
2171
2172 Play();
2173
2174 ASSERT_TRUE(WaitUntilOnEnded());
2175 source.Shutdown();
2176 Stop();
2177 }
2178
2179 TEST_F(PipelineIntegrationTest,
2180 MAYBE_EME(EncryptedPlayback_MP4_CENC_KeyRotation_Audio)) {
2181 MockMediaSource source("bear-1280x720-a_frag-cenc-key_rotation.mp4",
2182 kMP4Audio, kAppendWholeFile);
2183 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp());
2184 EXPECT_EQ(PIPELINE_OK,
2185 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2186
2187 source.EndOfStream();
2188
2189 Play();
2190
2191 ASSERT_TRUE(WaitUntilOnEnded());
2192 source.Shutdown();
2193 Stop();
2194 }
2195
2196 TEST_F(PipelineIntegrationTest,
2197 MAYBE_EME(EncryptedPlayback_MP4_VP9_CENC_VideoOnly)) {
2198 MockMediaSource source("bear-320x240-v_frag-vp9-cenc.mp4", kMP4VideoVP9,
2199 kAppendWholeFile); 1855 kAppendWholeFile);
2200 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 1856 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
2201 switches::kEnableVp9InMp4)) { 1857 switches::kEnableVp9InMp4)) {
2202 ASSERT_EQ(ChunkDemuxer::kNotSupported, source.AddId()); 1858 ASSERT_EQ(ChunkDemuxer::kNotSupported, source.AddId());
2203 return; 1859 return;
2204 } 1860 }
2205 1861
2206 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
2207 EXPECT_EQ(PIPELINE_OK,
2208 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2209
2210 source.EndOfStream();
2211
2212 Play();
2213
2214 ASSERT_TRUE(WaitUntilOnEnded());
2215 source.Shutdown();
2216 Stop();
2217 }
2218
2219 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VideoOnly_MP4_AVC3) {
2220 MockMediaSource source("bear-1280x720-v_frag-avc3.mp4", kMP4VideoAVC3,
2221 kAppendWholeFile);
2222 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); 1862 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
2223 source.EndOfStream(); 1863 source.EndOfStream();
2224
2225 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
2226 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
2227 EXPECT_EQ(k1280IsoAVC3FileDurationMs,
2228 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
2229
2230 Play();
2231
2232 ASSERT_TRUE(WaitUntilOnEnded());
2233 source.Shutdown();
2234 Stop();
2235 }
2236
2237 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VideoOnly_MP4_VP9) {
2238 MockMediaSource source("bear-320x240-v_frag-vp9.mp4", kMP4VideoVP9,
2239 kAppendWholeFile);
2240 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
2241 switches::kEnableVp9InMp4)) {
2242 ASSERT_EQ(ChunkDemuxer::kNotSupported, source.AddId());
2243 return;
2244 }
2245
2246 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
2247 source.EndOfStream();
2248 ASSERT_EQ(PIPELINE_OK, pipeline_status_); 1864 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
2249 1865
2250 Play(); 1866 Play();
2251 1867
2252 ASSERT_TRUE(WaitUntilOnEnded()); 1868 ASSERT_TRUE(WaitUntilOnEnded());
2253 source.Shutdown(); 1869 source.Shutdown();
2254 Stop(); 1870 Stop();
2255 } 1871 }
2256 1872
2257 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VideoOnly_MP4_HEVC1) { 1873 TEST_P(CommonPipelineIntegrationTest,
1874 BasicPlayback_MediaSource_VideoOnly_MP4_HEVC1) {
2258 // HEVC demuxing might be enabled even on platforms that don't support HEVC 1875 // HEVC demuxing might be enabled even on platforms that don't support HEVC
2259 // decoding. For those cases we'll get DECODER_ERROR_NOT_SUPPORTED, which 1876 // decoding. For those cases we'll get DECODER_ERROR_NOT_SUPPORTED, which
2260 // indicates indicates that we did pass media mime type checks and attempted 1877 // indicates indicates that we did pass media mime type checks and attempted
2261 // to actually demux and decode the stream. On platforms that support both 1878 // to actually demux and decode the stream. On platforms that support both
2262 // demuxing and decoding we'll get PIPELINE_OK. 1879 // demuxing and decoding we'll get PIPELINE_OK.
2263 MockMediaSource source("bear-320x240-v_frag-hevc.mp4", kMP4VideoHEVC1, 1880 MockMediaSource source("bear-320x240-v_frag-hevc.mp4", kMP4VideoHEVC1,
2264 kAppendWholeFile); 1881 kAppendWholeFile);
2265 #if BUILDFLAG(ENABLE_HEVC_DEMUXING) 1882 #if BUILDFLAG(ENABLE_HEVC_DEMUXING)
2266 PipelineStatus status = StartPipelineWithMediaSource(&source); 1883 PipelineStatus status = StartPipelineWithMediaSource(&source);
2267 EXPECT_TRUE(status == PIPELINE_OK || status == DECODER_ERROR_NOT_SUPPORTED); 1884 EXPECT_TRUE(status == PIPELINE_OK || status == DECODER_ERROR_NOT_SUPPORTED);
2268 #else 1885 #else
2269 EXPECT_EQ( 1886 EXPECT_EQ(
2270 DEMUXER_ERROR_COULD_NOT_OPEN, 1887 DEMUXER_ERROR_COULD_NOT_OPEN,
2271 StartPipelineWithMediaSource(&source, kExpectDemuxerFailure, nullptr)); 1888 StartPipelineWithMediaSource(&source, kExpectDemuxerFailure, nullptr));
2272 #endif 1889 #endif
2273 } 1890 }
2274 1891
2275 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VideoOnly_MP4_HEVC2) { 1892 TEST_P(CommonPipelineIntegrationTest,
1893 BasicPlayback_MediaSource_VideoOnly_MP4_HEVC2) {
2276 // HEVC demuxing might be enabled even on platforms that don't support HEVC 1894 // HEVC demuxing might be enabled even on platforms that don't support HEVC
2277 // decoding. For those cases we'll get DECODER_ERROR_NOT_SUPPORTED, which 1895 // decoding. For those cases we'll get DECODER_ERROR_NOT_SUPPORTED, which
2278 // indicates indicates that we did pass media mime type checks and attempted 1896 // indicates indicates that we did pass media mime type checks and attempted
2279 // to actually demux and decode the stream. On platforms that support both 1897 // to actually demux and decode the stream. On platforms that support both
2280 // demuxing and decoding we'll get PIPELINE_OK. 1898 // demuxing and decoding we'll get PIPELINE_OK.
2281 MockMediaSource source("bear-320x240-v_frag-hevc.mp4", kMP4VideoHEVC2, 1899 MockMediaSource source("bear-320x240-v_frag-hevc.mp4", kMP4VideoHEVC2,
2282 kAppendWholeFile); 1900 kAppendWholeFile);
2283 #if BUILDFLAG(ENABLE_HEVC_DEMUXING) 1901 #if BUILDFLAG(ENABLE_HEVC_DEMUXING)
2284 PipelineStatus status = StartPipelineWithMediaSource(&source); 1902 PipelineStatus status = StartPipelineWithMediaSource(&source);
2285 EXPECT_TRUE(status == PIPELINE_OK || status == DECODER_ERROR_NOT_SUPPORTED); 1903 EXPECT_TRUE(status == PIPELINE_OK || status == DECODER_ERROR_NOT_SUPPORTED);
2286 #else 1904 #else
2287 EXPECT_EQ( 1905 EXPECT_EQ(
2288 DEMUXER_ERROR_COULD_NOT_OPEN, 1906 DEMUXER_ERROR_COULD_NOT_OPEN,
2289 StartPipelineWithMediaSource(&source, kExpectDemuxerFailure, nullptr)); 1907 StartPipelineWithMediaSource(&source, kExpectDemuxerFailure, nullptr));
2290 #endif 1908 #endif
2291 } 1909 }
2292 1910
2293 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) 1911 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
2294 1912
2295 TEST_F(PipelineIntegrationTest, SeekWhilePaused) { 1913 TEST_P(CommonPipelineIntegrationTest, SeekWhilePaused) {
2296 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); 1914 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm"));
2297 1915
2298 base::TimeDelta duration(pipeline_->GetMediaDuration()); 1916 base::TimeDelta duration(pipeline_->GetMediaDuration());
2299 base::TimeDelta start_seek_time(duration / 4); 1917 base::TimeDelta start_seek_time(duration / 4);
2300 base::TimeDelta seek_time(duration * 3 / 4); 1918 base::TimeDelta seek_time(duration * 3 / 4);
2301 1919
2302 Play(); 1920 Play();
2303 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); 1921 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time));
2304 Pause(); 1922 Pause();
2305 ASSERT_TRUE(Seek(seek_time)); 1923 ASSERT_TRUE(Seek(seek_time));
2306 EXPECT_EQ(seek_time, pipeline_->GetMediaTime()); 1924 EXPECT_EQ(seek_time, pipeline_->GetMediaTime());
2307 Play(); 1925 Play();
2308 ASSERT_TRUE(WaitUntilOnEnded()); 1926 ASSERT_TRUE(WaitUntilOnEnded());
2309 1927
2310 // Make sure seeking after reaching the end works as expected. 1928 // Make sure seeking after reaching the end works as expected.
2311 Pause(); 1929 Pause();
2312 ASSERT_TRUE(Seek(seek_time)); 1930 ASSERT_TRUE(Seek(seek_time));
2313 EXPECT_EQ(seek_time, pipeline_->GetMediaTime()); 1931 EXPECT_EQ(seek_time, pipeline_->GetMediaTime());
2314 Play(); 1932 Play();
2315 ASSERT_TRUE(WaitUntilOnEnded()); 1933 ASSERT_TRUE(WaitUntilOnEnded());
2316 } 1934 }
2317 1935
2318 TEST_F(PipelineIntegrationTest, SeekWhilePlaying) { 1936 TEST_P(CommonPipelineIntegrationTest, SeekWhilePlaying) {
2319 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); 1937 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm"));
2320 1938
2321 base::TimeDelta duration(pipeline_->GetMediaDuration()); 1939 base::TimeDelta duration(pipeline_->GetMediaDuration());
2322 base::TimeDelta start_seek_time(duration / 4); 1940 base::TimeDelta start_seek_time(duration / 4);
2323 base::TimeDelta seek_time(duration * 3 / 4); 1941 base::TimeDelta seek_time(duration * 3 / 4);
2324 1942
2325 Play(); 1943 Play();
2326 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); 1944 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time));
2327 ASSERT_TRUE(Seek(seek_time)); 1945 ASSERT_TRUE(Seek(seek_time));
2328 EXPECT_GE(pipeline_->GetMediaTime(), seek_time); 1946 EXPECT_GE(pipeline_->GetMediaTime(), seek_time);
2329 ASSERT_TRUE(WaitUntilOnEnded()); 1947 ASSERT_TRUE(WaitUntilOnEnded());
2330 1948
2331 // Make sure seeking after reaching the end works as expected. 1949 // Make sure seeking after reaching the end works as expected.
2332 ASSERT_TRUE(Seek(seek_time)); 1950 ASSERT_TRUE(Seek(seek_time));
2333 EXPECT_GE(pipeline_->GetMediaTime(), seek_time); 1951 EXPECT_GE(pipeline_->GetMediaTime(), seek_time);
2334 ASSERT_TRUE(WaitUntilOnEnded()); 1952 ASSERT_TRUE(WaitUntilOnEnded());
2335 } 1953 }
2336 1954
2337 TEST_F(PipelineIntegrationTest, SuspendWhilePaused) { 1955 TEST_P(CommonPipelineIntegrationTest, SuspendWhilePaused) {
2338 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); 1956 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm"));
2339 1957
2340 base::TimeDelta duration(pipeline_->GetMediaDuration()); 1958 base::TimeDelta duration(pipeline_->GetMediaDuration());
2341 base::TimeDelta start_seek_time(duration / 4); 1959 base::TimeDelta start_seek_time(duration / 4);
2342 base::TimeDelta seek_time(duration * 3 / 4); 1960 base::TimeDelta seek_time(duration * 3 / 4);
2343 1961
2344 Play(); 1962 Play();
2345 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); 1963 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time));
2346 Pause(); 1964 Pause();
2347 1965
2348 // Suspend while paused. 1966 // Suspend while paused.
2349 ASSERT_TRUE(Suspend()); 1967 ASSERT_TRUE(Suspend());
2350 1968
2351 // Resuming the pipeline will create a new Renderer, 1969 // Resuming the pipeline will create a new Renderer,
2352 // which in turn will trigger video size and opacity notifications. 1970 // which in turn will trigger video size and opacity notifications.
2353 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(320, 240))).Times(1); 1971 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(320, 240))).Times(1);
2354 EXPECT_CALL(*this, OnVideoOpacityChange(true)).Times(1); 1972 EXPECT_CALL(*this, OnVideoOpacityChange(true)).Times(1);
2355 1973
2356 ASSERT_TRUE(Resume(seek_time)); 1974 ASSERT_TRUE(Resume(seek_time));
2357 EXPECT_GE(pipeline_->GetMediaTime(), seek_time); 1975 EXPECT_GE(pipeline_->GetMediaTime(), seek_time);
2358 Play(); 1976 Play();
2359 ASSERT_TRUE(WaitUntilOnEnded()); 1977 ASSERT_TRUE(WaitUntilOnEnded());
2360 } 1978 }
2361 1979
2362 TEST_F(PipelineIntegrationTest, SuspendWhilePlaying) { 1980 TEST_P(CommonPipelineIntegrationTest, SuspendWhilePlaying) {
2363 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); 1981 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm"));
2364 1982
2365 base::TimeDelta duration(pipeline_->GetMediaDuration()); 1983 base::TimeDelta duration(pipeline_->GetMediaDuration());
2366 base::TimeDelta start_seek_time(duration / 4); 1984 base::TimeDelta start_seek_time(duration / 4);
2367 base::TimeDelta seek_time(duration * 3 / 4); 1985 base::TimeDelta seek_time(duration * 3 / 4);
2368 1986
2369 Play(); 1987 Play();
2370 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); 1988 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time));
2371 ASSERT_TRUE(Suspend()); 1989 ASSERT_TRUE(Suspend());
2372 1990
2373 // Resuming the pipeline will create a new Renderer, 1991 // Resuming the pipeline will create a new Renderer,
2374 // which in turn will trigger video size and opacity notifications. 1992 // which in turn will trigger video size and opacity notifications.
2375 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(320, 240))).Times(1); 1993 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(320, 240))).Times(1);
2376 EXPECT_CALL(*this, OnVideoOpacityChange(true)).Times(1); 1994 EXPECT_CALL(*this, OnVideoOpacityChange(true)).Times(1);
2377 1995
2378 ASSERT_TRUE(Resume(seek_time)); 1996 ASSERT_TRUE(Resume(seek_time));
2379 EXPECT_GE(pipeline_->GetMediaTime(), seek_time); 1997 EXPECT_GE(pipeline_->GetMediaTime(), seek_time);
2380 ASSERT_TRUE(WaitUntilOnEnded()); 1998 ASSERT_TRUE(WaitUntilOnEnded());
2381 } 1999 }
2382 2000
2383 #if BUILDFLAG(USE_PROPRIETARY_CODECS) 2001 #if BUILDFLAG(USE_PROPRIETARY_CODECS)
2384 TEST_F(PipelineIntegrationTest, Rotated_Metadata_0) { 2002 TEST_P(CommonPipelineIntegrationTest, Rotated_Metadata_0) {
2385 ASSERT_EQ(PIPELINE_OK, Start("bear_rotate_0.mp4")); 2003 ASSERT_EQ(PIPELINE_OK, Start("bear_rotate_0.mp4"));
2386 ASSERT_EQ(VIDEO_ROTATION_0, metadata_.video_rotation); 2004 ASSERT_EQ(VIDEO_ROTATION_0, metadata_.video_rotation);
2387 } 2005 }
2388 2006
2389 TEST_F(PipelineIntegrationTest, Rotated_Metadata_90) { 2007 TEST_P(CommonPipelineIntegrationTest, Rotated_Metadata_90) {
2390 ASSERT_EQ(PIPELINE_OK, Start("bear_rotate_90.mp4")); 2008 ASSERT_EQ(PIPELINE_OK, Start("bear_rotate_90.mp4"));
2391 ASSERT_EQ(VIDEO_ROTATION_90, metadata_.video_rotation); 2009 ASSERT_EQ(VIDEO_ROTATION_90, metadata_.video_rotation);
2392 } 2010 }
2393 2011
2394 TEST_F(PipelineIntegrationTest, Rotated_Metadata_180) { 2012 TEST_P(CommonPipelineIntegrationTest, Rotated_Metadata_180) {
2395 ASSERT_EQ(PIPELINE_OK, Start("bear_rotate_180.mp4")); 2013 ASSERT_EQ(PIPELINE_OK, Start("bear_rotate_180.mp4"));
2396 ASSERT_EQ(VIDEO_ROTATION_180, metadata_.video_rotation); 2014 ASSERT_EQ(VIDEO_ROTATION_180, metadata_.video_rotation);
2397 } 2015 }
2398 2016
2399 TEST_F(PipelineIntegrationTest, Rotated_Metadata_270) { 2017 TEST_P(CommonPipelineIntegrationTest, Rotated_Metadata_270) {
2400 ASSERT_EQ(PIPELINE_OK, Start("bear_rotate_270.mp4")); 2018 ASSERT_EQ(PIPELINE_OK, Start("bear_rotate_270.mp4"));
2401 ASSERT_EQ(VIDEO_ROTATION_270, metadata_.video_rotation); 2019 ASSERT_EQ(VIDEO_ROTATION_270, metadata_.video_rotation);
2402 } 2020 }
2403 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) 2021 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
2404 2022
2405 // Verify audio decoder & renderer can handle aborted demuxer reads. 2023 // Verify audio decoder & renderer can handle aborted demuxer reads.
2406 TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_AudioOnly) { 2024 TEST_P(CommonPipelineIntegrationTest, ChunkDemuxerAbortRead_AudioOnly) {
2407 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-audio-only.webm", kAudioOnlyWebM, 2025 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-audio-only.webm", kAudioOnlyWebM,
2408 16384, base::TimeDelta::FromMilliseconds(464), 2026 16384, base::TimeDelta::FromMilliseconds(464),
2409 base::TimeDelta::FromMilliseconds(617), 0x10CA, 2027 base::TimeDelta::FromMilliseconds(617), 0x10CA,
2410 19730)); 2028 19730));
2411 } 2029 }
2412 2030
2413 // Verify video decoder & renderer can handle aborted demuxer reads. 2031 // Verify video decoder & renderer can handle aborted demuxer reads.
2414 TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_VideoOnly) { 2032 TEST_P(CommonPipelineIntegrationTest, ChunkDemuxerAbortRead_VideoOnly) {
2415 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-video-only.webm", kVideoOnlyWebM, 2033 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-video-only.webm", kVideoOnlyWebM,
2416 32768, base::TimeDelta::FromMilliseconds(167), 2034 32768, base::TimeDelta::FromMilliseconds(167),
2417 base::TimeDelta::FromMilliseconds(1668), 2035 base::TimeDelta::FromMilliseconds(1668),
2418 0x1C896, 65536)); 2036 0x1C896, 65536));
2419 } 2037 }
2420 2038
2421 // Verify that Opus audio in WebM containers can be played back. 2039 // Verify that Opus audio in WebM containers can be played back.
2422 TEST_F(PipelineIntegrationTest, BasicPlayback_AudioOnly_Opus_WebM) { 2040 TEST_P(CommonPipelineIntegrationTest, BasicPlayback_AudioOnly_Opus_WebM) {
2423 ASSERT_EQ(PIPELINE_OK, Start("bear-opus-end-trimming.webm")); 2041 ASSERT_EQ(PIPELINE_OK, Start("bear-opus-end-trimming.webm"));
2424 Play(); 2042 Play();
2425 ASSERT_TRUE(WaitUntilOnEnded()); 2043 ASSERT_TRUE(WaitUntilOnEnded());
2426 } 2044 }
2427 2045
2428 // Verify that VP9 video in WebM containers can be played back. 2046 // Verify that VP9 video in WebM containers can be played back.
2429 TEST_F(PipelineIntegrationTest, BasicPlayback_VideoOnly_VP9_WebM) { 2047 TEST_P(CommonPipelineIntegrationTest, BasicPlayback_VideoOnly_VP9_WebM) {
2430 ASSERT_EQ(PIPELINE_OK, Start("bear-vp9.webm")); 2048 ASSERT_EQ(PIPELINE_OK, Start("bear-vp9.webm"));
2431 Play(); 2049 Play();
2432 ASSERT_TRUE(WaitUntilOnEnded()); 2050 ASSERT_TRUE(WaitUntilOnEnded());
2433 } 2051 }
2434 2052
2435 // Verify that VP9 video and Opus audio in the same WebM container can be played 2053 // Verify that VP9 video and Opus audio in the same WebM container can be played
2436 // back. 2054 // back.
2437 TEST_F(PipelineIntegrationTest, BasicPlayback_VP9_Opus_WebM) { 2055 TEST_P(CommonPipelineIntegrationTest, BasicPlayback_VP9_Opus_WebM) {
2438 ASSERT_EQ(PIPELINE_OK, Start("bear-vp9-opus.webm")); 2056 ASSERT_EQ(PIPELINE_OK, Start("bear-vp9-opus.webm"));
2439 Play(); 2057 Play();
2440 ASSERT_TRUE(WaitUntilOnEnded()); 2058 ASSERT_TRUE(WaitUntilOnEnded());
2441 } 2059 }
2442 2060
2443 // Verify that VP8 video with alpha channel can be played back. 2061 // Verify that VP8 video with alpha channel can be played back.
2444 TEST_F(PipelineIntegrationTest, BasicPlayback_VP8A_WebM) { 2062 TEST_P(CommonPipelineIntegrationTest, BasicPlayback_VP8A_WebM) {
2445 ASSERT_EQ(PIPELINE_OK, Start("bear-vp8a.webm")); 2063 ASSERT_EQ(PIPELINE_OK, Start("bear-vp8a.webm"));
2446 Play(); 2064 Play();
2447 ASSERT_TRUE(WaitUntilOnEnded()); 2065 ASSERT_TRUE(WaitUntilOnEnded());
2448 EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV12A); 2066 EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV12A);
2449 } 2067 }
2450 2068
2451 // Verify that VP8A video with odd width/height can be played back. 2069 // Verify that VP8A video with odd width/height can be played back.
2452 TEST_F(PipelineIntegrationTest, BasicPlayback_VP8A_Odd_WebM) { 2070 TEST_P(CommonPipelineIntegrationTest, BasicPlayback_VP8A_Odd_WebM) {
2453 ASSERT_EQ(PIPELINE_OK, Start("bear-vp8a-odd-dimensions.webm")); 2071 ASSERT_EQ(PIPELINE_OK, Start("bear-vp8a-odd-dimensions.webm"));
2454 Play(); 2072 Play();
2455 ASSERT_TRUE(WaitUntilOnEnded()); 2073 ASSERT_TRUE(WaitUntilOnEnded());
2456 EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV12A); 2074 EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV12A);
2457 } 2075 }
2458 2076
2459 // Verify that VP9 video with odd width/height can be played back. 2077 // Verify that VP9 video with odd width/height can be played back.
2460 TEST_F(PipelineIntegrationTest, BasicPlayback_VP9_Odd_WebM) { 2078 TEST_P(CommonPipelineIntegrationTest, BasicPlayback_VP9_Odd_WebM) {
2461 ASSERT_EQ(PIPELINE_OK, Start("bear-vp9-odd-dimensions.webm")); 2079 ASSERT_EQ(PIPELINE_OK, Start("bear-vp9-odd-dimensions.webm"));
2462 Play(); 2080 Play();
2463 ASSERT_TRUE(WaitUntilOnEnded()); 2081 ASSERT_TRUE(WaitUntilOnEnded());
2464 } 2082 }
2465 2083
2466 // Verify that VP9 video with alpha channel can be played back. 2084 // Verify that VP9 video with alpha channel can be played back.
2467 TEST_F(PipelineIntegrationTest, BasicPlayback_VP9A_WebM) { 2085 TEST_P(CommonPipelineIntegrationTest, BasicPlayback_VP9A_WebM) {
2468 ASSERT_EQ(PIPELINE_OK, Start("bear-vp9a.webm")); 2086 ASSERT_EQ(PIPELINE_OK, Start("bear-vp9a.webm"));
2469 Play(); 2087 Play();
2470 ASSERT_TRUE(WaitUntilOnEnded()); 2088 ASSERT_TRUE(WaitUntilOnEnded());
2471 EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV12A); 2089 EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV12A);
2472 } 2090 }
2473 2091
2474 // Verify that VP9A video with odd width/height can be played back. 2092 // Verify that VP9A video with odd width/height can be played back.
2475 TEST_F(PipelineIntegrationTest, BasicPlayback_VP9A_Odd_WebM) { 2093 TEST_P(CommonPipelineIntegrationTest, BasicPlayback_VP9A_Odd_WebM) {
2476 ASSERT_EQ(PIPELINE_OK, Start("bear-vp9a-odd-dimensions.webm")); 2094 ASSERT_EQ(PIPELINE_OK, Start("bear-vp9a-odd-dimensions.webm"));
2477 Play(); 2095 Play();
2478 ASSERT_TRUE(WaitUntilOnEnded()); 2096 ASSERT_TRUE(WaitUntilOnEnded());
2479 EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV12A); 2097 EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV12A);
2480 } 2098 }
2481 2099
2100 // Verify that VP9 video with 4:4:4 subsampling can be played back.
2101 TEST_P(CommonPipelineIntegrationTest, P444_VP9_WebM) {
2102 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-P444.webm"));
2103 Play();
2104 ASSERT_TRUE(WaitUntilOnEnded());
2105 EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV24);
2106 }
2107
2108 // Verify that frames of VP9 video in the BT.709 color space have the YV12HD
2109 // format.
2110 TEST_P(CommonPipelineIntegrationTest, BT709_VP9_WebM) {
2111 ASSERT_EQ(PIPELINE_OK, Start("bear-vp9-bt709.webm"));
2112 Play();
2113 ASSERT_TRUE(WaitUntilOnEnded());
2114 EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV12);
2115 EXPECT_COLOR_SPACE_EQ(last_video_frame_color_space_, COLOR_SPACE_HD_REC709);
2116 }
2117
2118 TEST_P(CommonPipelineIntegrationTest, HD_VP9_WebM) {
2119 ASSERT_EQ(PIPELINE_OK, Start("bear-1280x720.webm", kClockless));
2120 Play();
2121 ASSERT_TRUE(WaitUntilOnEnded());
2122 }
2123
2124 // Verify that videos with an odd frame size playback successfully.
2125 TEST_P(CommonPipelineIntegrationTest, BasicPlayback_OddVideoSize) {
2126 ASSERT_EQ(PIPELINE_OK, Start("butterfly-853x480.webm"));
2127 Play();
2128 ASSERT_TRUE(WaitUntilOnEnded());
2129 }
2130
2131 // Verify that OPUS audio in a webm which reports a 44.1kHz sample rate plays
2132 // correctly at 48kHz
2133 TEST_P(CommonPipelineIntegrationTest, BasicPlayback_Opus441kHz) {
2134 ASSERT_EQ(PIPELINE_OK, Start("sfx-opus-441.webm"));
2135 Play();
2136 ASSERT_TRUE(WaitUntilOnEnded());
2137 EXPECT_EQ(48000, demuxer_->GetStream(DemuxerStream::AUDIO)
2138 ->audio_decoder_config()
2139 .samples_per_second());
2140 }
2141
2142 // Same as above but using MediaSource.
2143 TEST_P(CommonPipelineIntegrationTest, BasicPlayback_MediaSource_Opus441kHz) {
2144 MockMediaSource source("sfx-opus-441.webm", kOpusAudioOnlyWebM,
2145 kAppendWholeFile);
2146 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
2147 source.EndOfStream();
2148 Play();
2149 ASSERT_TRUE(WaitUntilOnEnded());
2150 source.Shutdown();
2151 Stop();
2152 EXPECT_EQ(48000, demuxer_->GetStream(DemuxerStream::AUDIO)
2153 ->audio_decoder_config()
2154 .samples_per_second());
2155 }
2156
2157 // Ensures audio-only playback with missing or negative timestamps works. Tests
2158 // the common live-streaming case for chained ogg. See http://crbug.com/396864.
2159 TEST_P(CommonPipelineIntegrationTest, BasicPlaybackChainedOgg) {
2160 ASSERT_EQ(PIPELINE_OK, Start("double-sfx.ogg", kUnreliableDuration));
2161 Play();
2162 ASSERT_TRUE(WaitUntilOnEnded());
2163 ASSERT_EQ(base::TimeDelta(), demuxer_->GetStartTime());
2164 }
2165
2166 // Tests that we signal ended even when audio runs longer than video track.
2167 TEST_P(CommonPipelineIntegrationTest, BasicPlaybackAudioLongerThanVideo) {
2168 ASSERT_EQ(PIPELINE_OK, Start("bear_audio_longer_than_video.ogv"));
2169 // Audio track is 2000ms. Video track is 1001ms. Duration should be higher
2170 // of the two.
2171 EXPECT_EQ(2000, pipeline_->GetMediaDuration().InMilliseconds());
2172 Play();
2173 ASSERT_TRUE(WaitUntilOnEnded());
2174 }
2175
2176 // Tests that we signal ended even when audio runs shorter than video track.
2177 TEST_P(CommonPipelineIntegrationTest, BasicPlaybackAudioShorterThanVideo) {
2178 ASSERT_EQ(PIPELINE_OK, Start("bear_audio_shorter_than_video.ogv"));
2179 // Audio track is 500ms. Video track is 1001ms. Duration should be higher of
2180 // the two.
2181 EXPECT_EQ(1001, pipeline_->GetMediaDuration().InMilliseconds());
2182 Play();
2183 ASSERT_TRUE(WaitUntilOnEnded());
2184 }
2185
2186 TEST_P(CommonPipelineIntegrationTest, BasicPlaybackPositiveStartTime) {
2187 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm"));
2188 Play();
2189 ASSERT_TRUE(WaitUntilOnEnded());
2190 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000),
2191 demuxer_->GetStartTime());
2192 }
2193
2194 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER)
2195 const IntegrationTestData kIntegrationTests[] = {{PipelineType::Media},
2196 {PipelineType::MediaRemoting}};
2197 #else
2198 const IntegrationTestData kIntegrationTests[] = {{PipelineType::Media}};
miu 2017/03/29 01:39:14 const IntegrationTestData kIntegrationTests[] = {
xjz 2017/03/30 23:21:31 Done.
2199 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER)
2200
2201 INSTANTIATE_TEST_CASE_P(,
2202 CommonPipelineIntegrationTest,
2203 testing::ValuesIn(kIntegrationTests));
2204
2205 TEST_F(PipelineIntegrationTest, MAYBE_EME(BasicPlaybackEncrypted)) {
2206 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
2207 set_encrypted_media_init_data_cb(
2208 base::Bind(&FakeEncryptedMedia::OnEncryptedMediaInitData,
2209 base::Unretained(&encrypted_media)));
2210
2211 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-av_enc-av.webm",
2212 encrypted_media.GetCdmContext()));
2213
2214 Play();
2215
2216 ASSERT_TRUE(WaitUntilOnEnded());
2217 Stop();
2218 }
2219
2220 TEST_F(PipelineIntegrationTest,
2221 MAYBE_EME(MediaSource_ConfigChange_Encrypted_WebM)) {
2222 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM,
2223 kAppendWholeFile);
2224 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
2225 EXPECT_EQ(PIPELINE_OK,
2226 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2227
2228 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(640, 360))).Times(1);
2229 scoped_refptr<DecoderBuffer> second_file =
2230 ReadTestDataFile("bear-640x360-av_enc-av.webm");
2231 ASSERT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
2232 second_file->data(),
2233 second_file->data_size()));
2234 source.EndOfStream();
2235
2236 Play();
2237 EXPECT_TRUE(WaitUntilOnEnded());
2238
2239 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
2240 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
2241 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs,
2242 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
2243
2244 source.Shutdown();
2245 Stop();
2246 }
2247
2248 // Config changes from encrypted to clear are not currently supported.
2249 TEST_F(PipelineIntegrationTest,
2250 MAYBE_EME(MediaSource_ConfigChange_ClearThenEncrypted_WebM)) {
2251 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM,
2252 kAppendWholeFile);
2253 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
2254 EXPECT_EQ(PIPELINE_OK,
2255 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2256
2257 scoped_refptr<DecoderBuffer> second_file =
2258 ReadTestDataFile("bear-640x360-av_enc-av.webm");
2259
2260 ASSERT_FALSE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
2261 second_file->data(),
2262 second_file->data_size()));
2263
2264 source.EndOfStream();
2265
2266 base::RunLoop().Run();
2267 EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, pipeline_status_);
2268
2269 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
2270 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
2271 // The second video was not added, so its time has not been added.
2272 EXPECT_EQ(k320WebMFileDurationMs,
2273 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
2274
2275 Play();
2276
2277 EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, WaitUntilEndedOrError());
2278 source.Shutdown();
2279 }
2280
2281 // Config changes from clear to encrypted are not currently supported.
2282 TEST_F(PipelineIntegrationTest,
2283 MAYBE_EME(MediaSource_ConfigChange_EncryptedThenClear_WebM)) {
2284 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM,
2285 kAppendWholeFile);
2286 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
2287 EXPECT_EQ(PIPELINE_OK,
2288 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2289
2290 scoped_refptr<DecoderBuffer> second_file =
2291 ReadTestDataFile("bear-640x360.webm");
2292
2293 ASSERT_FALSE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
2294 second_file->data(),
2295 second_file->data_size()));
2296
2297 source.EndOfStream();
2298
2299 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
2300 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
2301 // The second video was not added, so its time has not been added.
2302 EXPECT_EQ(k320EncWebMFileDurationMs,
2303 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
2304
2305 Play();
2306
2307 EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, WaitUntilEndedOrError());
2308 source.Shutdown();
2309 }
2310
2311 #if BUILDFLAG(USE_PROPRIETARY_CODECS)
2312 #if !defined(DISABLE_CLOCKLESS_TESTS)
2313 class Mp3FastSeekParams {
2314 public:
2315 Mp3FastSeekParams(const char* filename, const char* hash)
2316 : filename(filename), hash(hash) {}
2317 const char* filename;
2318 const char* hash;
2319 };
2320
2321 class Mp3FastSeekIntegrationTest
2322 : public PipelineIntegrationTest,
2323 public testing::WithParamInterface<Mp3FastSeekParams> {};
2324
2325 TEST_P(Mp3FastSeekIntegrationTest, FastSeekAccuracy_MP3) {
2326 Mp3FastSeekParams config = GetParam();
2327 ASSERT_EQ(PIPELINE_OK, Start(config.filename, kHashed));
2328
2329 // The XING TOC is inaccurate. We don't use it for CBR, we tolerate it for VBR
2330 // (best option for fast seeking; see Mp3SeekFFmpegDemuxerTest). The chosen
2331 // seek time exposes inaccuracy in TOC such that the hash will change if seek
2332 // logic is regressed. See https://crbug.com/545914.
2333 //
2334 // Quick TOC design (not pretty!):
2335 // - All MP3 TOCs are 100 bytes
2336 // - Each byte is read as a uint8_t; value between 0 - 255.
2337 // - The index into this array is the numerator in the ratio: index / 100.
2338 // This fraction represents a playback time as a percentage of duration.
2339 // - The value at the given index is the numerator in the ratio: value / 256.
2340 // This fraction represents a byte offset as a percentage of the file size.
2341 //
2342 // For CBR files, each frame is the same size, so the offset for time of
2343 // (0.98 * duration) should be around (0.98 * file size). This is 250.88 / 256
2344 // but the numerator will be truncated in the TOC as 250, losing precision.
2345 base::TimeDelta seek_time(0.98 * pipeline_->GetMediaDuration());
2346
2347 ASSERT_TRUE(Seek(seek_time));
2348 Play();
2349 ASSERT_TRUE(WaitUntilOnEnded());
2350
2351 EXPECT_HASH_EQ(config.hash, GetAudioHash());
2352 }
2353
2354 // TODO(CHCUNNINGHAM): Re-enable for OSX once 1% flakiness is root caused.
2355 // See http://crbug.com/571898
2356 #if !defined(OS_MACOSX)
2357 // CBR seeks should always be fast and accurate.
2358 INSTANTIATE_TEST_CASE_P(
2359 CBRSeek_HasTOC,
2360 Mp3FastSeekIntegrationTest,
2361 ::testing::Values(Mp3FastSeekParams("bear-audio-10s-CBR-has-TOC.mp3",
2362 "-0.71,0.36,2.96,2.68,2.10,-1.08,")));
2363 #endif
2364
2365 INSTANTIATE_TEST_CASE_P(
2366 CBRSeeks_NoTOC,
2367 Mp3FastSeekIntegrationTest,
2368 ::testing::Values(Mp3FastSeekParams("bear-audio-10s-CBR-no-TOC.mp3",
2369 "0.95,0.56,1.34,0.47,1.77,0.84,")));
2370 // VBR seeks can be fast *OR* accurate, but not both. We chose fast.
2371 INSTANTIATE_TEST_CASE_P(
2372 VBRSeeks_HasTOC,
2373 Mp3FastSeekIntegrationTest,
2374 ::testing::Values(Mp3FastSeekParams("bear-audio-10s-VBR-has-TOC.mp3",
2375 "-0.15,-0.83,0.54,1.00,1.94,0.93,")));
2376 INSTANTIATE_TEST_CASE_P(
2377 VBRSeeks_NoTOC,
2378 Mp3FastSeekIntegrationTest,
2379 ::testing::Values(Mp3FastSeekParams("bear-audio-10s-VBR-no-TOC.mp3",
2380 "-0.22,0.80,1.19,0.73,-0.31,-1.12,")));
2381 #endif // !defined(DISABLE_CLOCKLESS_TESTS)
2382
2383 TEST_F(PipelineIntegrationTest,
2384 MAYBE_EME(MediaSource_ConfigChange_Encrypted_MP4_CENC_VideoOnly)) {
2385 MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video,
2386 kAppendWholeFile);
2387 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
2388 EXPECT_EQ(PIPELINE_OK,
2389 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2390
2391 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(1280, 720))).Times(1);
2392 scoped_refptr<DecoderBuffer> second_file =
2393 ReadTestDataFile("bear-1280x720-v_frag-cenc.mp4");
2394 ASSERT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
2395 second_file->data(),
2396 second_file->data_size()));
2397 source.EndOfStream();
2398
2399 Play();
2400 EXPECT_TRUE(WaitUntilOnEnded());
2401
2402 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
2403 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
2404 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs,
2405 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
2406
2407 source.Shutdown();
2408 Stop();
2409 }
2410
2411 TEST_F(PipelineIntegrationTest,
2412 MAYBE_EME(
2413 MediaSource_ConfigChange_Encrypted_MP4_CENC_KeyRotation_VideoOnly)) {
2414 MockMediaSource source("bear-640x360-v_frag-cenc-key_rotation.mp4", kMP4Video,
2415 kAppendWholeFile);
2416 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp());
2417 EXPECT_EQ(PIPELINE_OK,
2418 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2419
2420 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(1280, 720))).Times(1);
2421 scoped_refptr<DecoderBuffer> second_file =
2422 ReadTestDataFile("bear-1280x720-v_frag-cenc-key_rotation.mp4");
2423 ASSERT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
2424 second_file->data(),
2425 second_file->data_size()));
2426 source.EndOfStream();
2427
2428 Play();
2429 EXPECT_TRUE(WaitUntilOnEnded());
2430
2431 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
2432 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
2433 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs,
2434 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
2435
2436 source.Shutdown();
2437 Stop();
2438 }
2439
2440 // Config changes from clear to encrypted are not currently supported.
2441 // TODO(ddorwin): Figure out why this CHECKs in AppendAtTime().
2442 TEST_F(PipelineIntegrationTest,
2443 DISABLED_MediaSource_ConfigChange_ClearThenEncrypted_MP4_CENC) {
2444 MockMediaSource source("bear-640x360-av_frag.mp4", kMP4Video,
2445 kAppendWholeFile);
2446 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
2447 EXPECT_EQ(PIPELINE_OK,
2448 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2449
2450 EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(1280, 720))).Times(1);
2451 scoped_refptr<DecoderBuffer> second_file =
2452 ReadTestDataFile("bear-1280x720-v_frag-cenc.mp4");
2453 ASSERT_FALSE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
2454 second_file->data(),
2455 second_file->data_size()));
2456
2457 source.EndOfStream();
2458
2459 base::RunLoop().Run();
2460 EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, pipeline_status_);
2461
2462 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
2463 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
2464 // The second video was not added, so its time has not been added.
2465 EXPECT_EQ(k640IsoFileDurationMs,
2466 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
2467
2468 Play();
2469
2470 EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, WaitUntilEndedOrError());
2471 source.Shutdown();
2472 }
2473
2474 // Config changes from encrypted to clear are not currently supported.
2475 TEST_F(PipelineIntegrationTest,
2476 MAYBE_EME(MediaSource_ConfigChange_EncryptedThenClear_MP4_CENC)) {
2477 MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video,
2478 kAppendWholeFile);
2479 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
2480 EXPECT_EQ(PIPELINE_OK,
2481 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2482
2483 scoped_refptr<DecoderBuffer> second_file =
2484 ReadTestDataFile("bear-1280x720-av_frag.mp4");
2485
2486 ASSERT_FALSE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
2487 second_file->data(),
2488 second_file->data_size()));
2489
2490 source.EndOfStream();
2491
2492 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
2493 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
2494 // The second video was not added, so its time has not been added.
2495 EXPECT_EQ(k640IsoCencFileDurationMs,
2496 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
2497
2498 Play();
2499
2500 EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, WaitUntilEndedOrError());
2501 source.Shutdown();
2502 }
2503
2504 // Verify files which change configuration midstream fail gracefully.
2505 TEST_F(PipelineIntegrationTest, MidStreamConfigChangesFail) {
2506 ASSERT_EQ(PIPELINE_OK, Start("midstream_config_change.mp3"));
2507 Play();
2508 ASSERT_EQ(WaitUntilEndedOrError(), PIPELINE_ERROR_DECODE);
2509 }
2510 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
2511
2512 TEST_F(PipelineIntegrationTest, MAYBE_EME(EncryptedPlayback_WebM)) {
2513 MockMediaSource source("bear-320x240-av_enc-av.webm", kWebM, 219816);
2514 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
2515 EXPECT_EQ(PIPELINE_OK,
2516 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2517
2518 source.EndOfStream();
2519 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
2520
2521 Play();
2522
2523 ASSERT_TRUE(WaitUntilOnEnded());
2524 source.Shutdown();
2525 Stop();
2526 }
2527
2528 TEST_F(PipelineIntegrationTest, MAYBE_EME(EncryptedPlayback_ClearStart_WebM)) {
2529 MockMediaSource source("bear-320x240-av_enc-av_clear-1s.webm", kWebM,
2530 kAppendWholeFile);
2531 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
2532 EXPECT_EQ(PIPELINE_OK,
2533 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2534
2535 source.EndOfStream();
2536 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
2537
2538 Play();
2539
2540 ASSERT_TRUE(WaitUntilOnEnded());
2541 source.Shutdown();
2542 Stop();
2543 }
2544
2545 TEST_F(PipelineIntegrationTest,
2546 MAYBE_EME(EncryptedPlayback_NoEncryptedFrames_WebM)) {
2547 MockMediaSource source("bear-320x240-av_enc-av_clear-all.webm", kWebM,
2548 kAppendWholeFile);
2549 FakeEncryptedMedia encrypted_media(new NoResponseApp());
2550 EXPECT_EQ(PIPELINE_OK,
2551 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2552
2553 source.EndOfStream();
2554 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
2555
2556 Play();
2557
2558 ASSERT_TRUE(WaitUntilOnEnded());
2559 source.Shutdown();
2560 Stop();
2561 }
2562
2563 #if BUILDFLAG(USE_PROPRIETARY_CODECS)
2564 TEST_F(PipelineIntegrationTest,
2565 MAYBE_EME(EncryptedPlayback_MP4_CENC_VideoOnly)) {
2566 MockMediaSource source("bear-1280x720-v_frag-cenc.mp4", kMP4Video,
2567 kAppendWholeFile);
2568 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
2569 EXPECT_EQ(PIPELINE_OK,
2570 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2571
2572 source.EndOfStream();
2573 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
2574
2575 Play();
2576
2577 ASSERT_TRUE(WaitUntilOnEnded());
2578 source.Shutdown();
2579 Stop();
2580 }
2581
2582 TEST_F(PipelineIntegrationTest,
2583 MAYBE_EME(EncryptedPlayback_MP4_CENC_AudioOnly)) {
2584 MockMediaSource source("bear-1280x720-a_frag-cenc.mp4", kMP4Audio,
2585 kAppendWholeFile);
2586 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
2587 EXPECT_EQ(PIPELINE_OK,
2588 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2589
2590 source.EndOfStream();
2591 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
2592
2593 Play();
2594
2595 ASSERT_TRUE(WaitUntilOnEnded());
2596 source.Shutdown();
2597 Stop();
2598 }
2599
2600 TEST_F(PipelineIntegrationTest,
2601 MAYBE_EME(EncryptedPlayback_NoEncryptedFrames_MP4_CENC_VideoOnly)) {
2602 MockMediaSource source("bear-1280x720-v_frag-cenc_clear-all.mp4", kMP4Video,
2603 kAppendWholeFile);
2604 FakeEncryptedMedia encrypted_media(new NoResponseApp());
2605 EXPECT_EQ(PIPELINE_OK,
2606 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2607
2608 source.EndOfStream();
2609
2610 Play();
2611
2612 ASSERT_TRUE(WaitUntilOnEnded());
2613 source.Shutdown();
2614 Stop();
2615 }
2616
2617 TEST_F(PipelineIntegrationTest,
2618 MAYBE_EME(EncryptedPlayback_NoEncryptedFrames_MP4_CENC_AudioOnly)) {
2619 MockMediaSource source("bear-1280x720-a_frag-cenc_clear-all.mp4", kMP4Audio,
2620 kAppendWholeFile);
2621 FakeEncryptedMedia encrypted_media(new NoResponseApp());
2622 EXPECT_EQ(PIPELINE_OK,
2623 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2624
2625 source.EndOfStream();
2626
2627 Play();
2628
2629 ASSERT_TRUE(WaitUntilOnEnded());
2630 source.Shutdown();
2631 Stop();
2632 }
2633
2634 TEST_F(PipelineIntegrationTest,
2635 MAYBE_EME(EncryptedPlayback_MP4_CENC_SENC_Video)) {
2636 MockMediaSource source("bear-640x360-v_frag-cenc-senc.mp4", kMP4Video,
2637 kAppendWholeFile);
2638 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
2639 EXPECT_EQ(PIPELINE_OK,
2640 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2641
2642 source.EndOfStream();
2643
2644 Play();
2645
2646 ASSERT_TRUE(WaitUntilOnEnded());
2647 source.Shutdown();
2648 Stop();
2649 }
2650
2651 // 'SAIZ' and 'SAIO' boxes contain redundant information which is already
2652 // available in 'SENC' box. Although 'SAIZ' and 'SAIO' boxes are required per
2653 // CENC spec for backward compatibility reasons, but we do not use the two
2654 // boxes if 'SENC' box is present, so the code should work even if the two
2655 // boxes are not present.
2656 TEST_F(PipelineIntegrationTest,
2657 MAYBE_EME(EncryptedPlayback_MP4_CENC_SENC_NO_SAIZ_SAIO_Video)) {
2658 MockMediaSource source("bear-640x360-v_frag-cenc-senc-no-saiz-saio.mp4",
2659 kMP4Video, kAppendWholeFile);
2660 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
2661 EXPECT_EQ(PIPELINE_OK,
2662 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2663
2664 source.EndOfStream();
2665
2666 Play();
2667
2668 ASSERT_TRUE(WaitUntilOnEnded());
2669 source.Shutdown();
2670 Stop();
2671 }
2672
2673 TEST_F(PipelineIntegrationTest,
2674 MAYBE_EME(EncryptedPlayback_MP4_CENC_KeyRotation_Video)) {
2675 MockMediaSource source("bear-1280x720-v_frag-cenc-key_rotation.mp4",
2676 kMP4Video, kAppendWholeFile);
2677 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp());
2678 EXPECT_EQ(PIPELINE_OK,
2679 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2680
2681 source.EndOfStream();
2682
2683 Play();
2684
2685 ASSERT_TRUE(WaitUntilOnEnded());
2686 source.Shutdown();
2687 Stop();
2688 }
2689
2690 TEST_F(PipelineIntegrationTest,
2691 MAYBE_EME(EncryptedPlayback_MP4_CENC_KeyRotation_Audio)) {
2692 MockMediaSource source("bear-1280x720-a_frag-cenc-key_rotation.mp4",
2693 kMP4Audio, kAppendWholeFile);
2694 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp());
2695 EXPECT_EQ(PIPELINE_OK,
2696 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2697
2698 source.EndOfStream();
2699
2700 Play();
2701
2702 ASSERT_TRUE(WaitUntilOnEnded());
2703 source.Shutdown();
2704 Stop();
2705 }
2706
2707 TEST_F(PipelineIntegrationTest,
2708 MAYBE_EME(EncryptedPlayback_MP4_VP9_CENC_VideoOnly)) {
2709 MockMediaSource source("bear-320x240-v_frag-vp9-cenc.mp4", kMP4VideoVP9,
2710 kAppendWholeFile);
2711 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
2712 switches::kEnableVp9InMp4)) {
2713 ASSERT_EQ(ChunkDemuxer::kNotSupported, source.AddId());
2714 return;
2715 }
2716
2717 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
2718 EXPECT_EQ(PIPELINE_OK,
2719 StartPipelineWithEncryptedMedia(&source, &encrypted_media));
2720
2721 source.EndOfStream();
2722
2723 Play();
2724
2725 ASSERT_TRUE(WaitUntilOnEnded());
2726 source.Shutdown();
2727 Stop();
2728 }
2729
2730 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
2731
2482 // Verify that VP8 video with inband text track can be played back. 2732 // Verify that VP8 video with inband text track can be played back.
2483 TEST_F(PipelineIntegrationTest, MAYBE_TEXT(BasicPlayback_VP8_WebVTT_WebM)) { 2733 TEST_F(PipelineIntegrationTest, MAYBE_TEXT(BasicPlayback_VP8_WebVTT_WebM)) {
2484 EXPECT_CALL(*this, OnAddTextTrack(_, _)); 2734 EXPECT_CALL(*this, OnAddTextTrack(_, _));
2485 ASSERT_EQ(PIPELINE_OK, Start("bear-vp8-webvtt.webm")); 2735 ASSERT_EQ(PIPELINE_OK, Start("bear-vp8-webvtt.webm"));
2486 Play(); 2736 Play();
2487 ASSERT_TRUE(WaitUntilOnEnded()); 2737 ASSERT_TRUE(WaitUntilOnEnded());
2488 } 2738 }
2489 2739
2490 // Verify that VP9 video with 4:4:4 subsampling can be played back.
2491 TEST_F(PipelineIntegrationTest, P444_VP9_WebM) {
2492 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-P444.webm"));
2493 Play();
2494 ASSERT_TRUE(WaitUntilOnEnded());
2495 EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV24);
2496 }
2497
2498 // Verify that frames of VP9 video in the BT.709 color space have the YV12HD
2499 // format.
2500 TEST_F(PipelineIntegrationTest, BT709_VP9_WebM) {
2501 ASSERT_EQ(PIPELINE_OK, Start("bear-vp9-bt709.webm"));
2502 Play();
2503 ASSERT_TRUE(WaitUntilOnEnded());
2504 EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV12);
2505 EXPECT_COLOR_SPACE_EQ(last_video_frame_color_space_, COLOR_SPACE_HD_REC709);
2506 }
2507
2508 TEST_F(PipelineIntegrationTest, HD_VP9_WebM) {
2509 ASSERT_EQ(PIPELINE_OK, Start("bear-1280x720.webm", kClockless));
2510 Play();
2511 ASSERT_TRUE(WaitUntilOnEnded());
2512 }
2513
2514 // Verify that videos with an odd frame size playback successfully.
2515 TEST_F(PipelineIntegrationTest, BasicPlayback_OddVideoSize) {
2516 ASSERT_EQ(PIPELINE_OK, Start("butterfly-853x480.webm"));
2517 Play();
2518 ASSERT_TRUE(WaitUntilOnEnded());
2519 }
2520
2521 // Verify that OPUS audio in a webm which reports a 44.1kHz sample rate plays
2522 // correctly at 48kHz
2523 TEST_F(PipelineIntegrationTest, BasicPlayback_Opus441kHz) {
2524 ASSERT_EQ(PIPELINE_OK, Start("sfx-opus-441.webm"));
2525 Play();
2526 ASSERT_TRUE(WaitUntilOnEnded());
2527 EXPECT_EQ(48000, demuxer_->GetStream(DemuxerStream::AUDIO)
2528 ->audio_decoder_config()
2529 .samples_per_second());
2530 }
2531
2532 // Same as above but using MediaSource.
2533 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus441kHz) {
2534 MockMediaSource source("sfx-opus-441.webm", kOpusAudioOnlyWebM,
2535 kAppendWholeFile);
2536 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
2537 source.EndOfStream();
2538 Play();
2539 ASSERT_TRUE(WaitUntilOnEnded());
2540 source.Shutdown();
2541 Stop();
2542 EXPECT_EQ(48000, demuxer_->GetStream(DemuxerStream::AUDIO)
2543 ->audio_decoder_config()
2544 .samples_per_second());
2545 }
2546
2547 // Ensures audio-only playback with missing or negative timestamps works. Tests
2548 // the common live-streaming case for chained ogg. See http://crbug.com/396864.
2549 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOgg) {
2550 ASSERT_EQ(PIPELINE_OK, Start("double-sfx.ogg", kUnreliableDuration));
2551 Play();
2552 ASSERT_TRUE(WaitUntilOnEnded());
2553 ASSERT_EQ(base::TimeDelta(), demuxer_->GetStartTime());
2554 }
2555
2556 // Ensures audio-video playback with missing or negative timestamps fails softly 2740 // Ensures audio-video playback with missing or negative timestamps fails softly
2557 // instead of crashing. See http://crbug.com/396864. 2741 // instead of crashing. See http://crbug.com/396864.
2558 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOggVideo) { 2742 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOggVideo) {
2559 ASSERT_EQ(PIPELINE_OK, Start("double-bear.ogv", kUnreliableDuration)); 2743 ASSERT_EQ(PIPELINE_OK, Start("double-bear.ogv", kUnreliableDuration));
2560 Play(); 2744 Play();
2561 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); 2745 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError());
2562 ASSERT_EQ(base::TimeDelta(), demuxer_->GetStartTime()); 2746 ASSERT_EQ(base::TimeDelta(), demuxer_->GetStartTime());
2563 } 2747 }
2564 2748
2565 // Tests that we signal ended even when audio runs longer than video track.
2566 TEST_F(PipelineIntegrationTest, BasicPlaybackAudioLongerThanVideo) {
2567 ASSERT_EQ(PIPELINE_OK, Start("bear_audio_longer_than_video.ogv"));
2568 // Audio track is 2000ms. Video track is 1001ms. Duration should be higher
2569 // of the two.
2570 EXPECT_EQ(2000, pipeline_->GetMediaDuration().InMilliseconds());
2571 Play();
2572 ASSERT_TRUE(WaitUntilOnEnded());
2573 }
2574
2575 // Tests that we signal ended even when audio runs shorter than video track.
2576 TEST_F(PipelineIntegrationTest, BasicPlaybackAudioShorterThanVideo) {
2577 ASSERT_EQ(PIPELINE_OK, Start("bear_audio_shorter_than_video.ogv"));
2578 // Audio track is 500ms. Video track is 1001ms. Duration should be higher of
2579 // the two.
2580 EXPECT_EQ(1001, pipeline_->GetMediaDuration().InMilliseconds());
2581 Play();
2582 ASSERT_TRUE(WaitUntilOnEnded());
2583 }
2584
2585 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) {
2586 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm"));
2587 Play();
2588 ASSERT_TRUE(WaitUntilOnEnded());
2589 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000),
2590 demuxer_->GetStartTime());
2591 }
2592
2593 } // namespace media 2749 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698