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

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

Issue 1909313002: Support HEVC through EME (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 const char kAudioOnlyWebM[] = "video/webm; codecs=\"vorbis\""; 99 const char kAudioOnlyWebM[] = "video/webm; codecs=\"vorbis\"";
100 const char kOpusAudioOnlyWebM[] = "video/webm; codecs=\"opus\""; 100 const char kOpusAudioOnlyWebM[] = "video/webm; codecs=\"opus\"";
101 const char kVideoOnlyWebM[] = "video/webm; codecs=\"vp8\""; 101 const char kVideoOnlyWebM[] = "video/webm; codecs=\"vp8\"";
102 #if defined(USE_PROPRIETARY_CODECS) 102 #if defined(USE_PROPRIETARY_CODECS)
103 const char kADTS[] = "audio/aac"; 103 const char kADTS[] = "audio/aac";
104 const char kMP4[] = "video/mp4; codecs=\"avc1.4D4041,mp4a.40.2\""; 104 const char kMP4[] = "video/mp4; codecs=\"avc1.4D4041,mp4a.40.2\"";
105 const char kMP4VideoAVC3[] = "video/mp4; codecs=\"avc3.64001f\""; 105 const char kMP4VideoAVC3[] = "video/mp4; codecs=\"avc3.64001f\"";
106 #if BUILDFLAG(ENABLE_MP4_VP9_DEMUXING) 106 #if BUILDFLAG(ENABLE_MP4_VP9_DEMUXING)
107 const char kMP4VideoVP9[] = "video/mp4; codecs=\"vp09.00.00.08.01.01.00.00\""; 107 const char kMP4VideoVP9[] = "video/mp4; codecs=\"vp09.00.00.08.01.01.00.00\"";
108 #endif 108 #endif
109 #if BUILDFLAG(ENABLE_HEVC_DEMUXING)
110 const char kMP4VideoHEVC1[] = "video/mp4; codecs=\"hvc1.1.6.L93.B0\"";
111 const char kMP4VideoHEVC2[] = "video/mp4; codecs=\"hev1.1.6.L93.B0\"";
112 #endif
109 const char kMP4Video[] = "video/mp4; codecs=\"avc1.4D4041\""; 113 const char kMP4Video[] = "video/mp4; codecs=\"avc1.4D4041\"";
110 const char kMP4Audio[] = "audio/mp4; codecs=\"mp4a.40.2\""; 114 const char kMP4Audio[] = "audio/mp4; codecs=\"mp4a.40.2\"";
111 const char kMP3[] = "audio/mpeg"; 115 const char kMP3[] = "audio/mpeg";
112 #endif // defined(USE_PROPRIETARY_CODECS) 116 #endif // defined(USE_PROPRIETARY_CODECS)
113 117
114 // Key used to encrypt test files. 118 // Key used to encrypt test files.
115 const uint8_t kSecretKey[] = {0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b, 119 const uint8_t kSecretKey[] = {0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b,
116 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c}; 120 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c};
117 121
118 // The key ID for all encrypted files. 122 // The key ID for all encrypted files.
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 .Times(AnyNumber()); 722 .Times(AnyNumber());
719 723
720 // Encrypted content not used, so this is never called. 724 // Encrypted content not used, so this is never called.
721 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0); 725 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0);
722 726
723 demuxer_ = source->GetDemuxer(); 727 demuxer_ = source->GetDemuxer();
724 pipeline_->Start(demuxer_.get(), CreateRenderer(), this, 728 pipeline_->Start(demuxer_.get(), CreateRenderer(), this,
725 base::Bind(&PipelineIntegrationTest::OnStatusCallback, 729 base::Bind(&PipelineIntegrationTest::OnStatusCallback,
726 base::Unretained(this))); 730 base::Unretained(this)));
727 message_loop_.Run(); 731 message_loop_.Run();
728 EXPECT_EQ(PIPELINE_OK, pipeline_status_); 732 EXPECT_EQ(pipeline_status_, expected_pipeline_status_);
ddorwin 2016/05/18 19:51:13 Expected comes first in GTest.
servolk 2016/05/19 00:43:43 Done.
729 return pipeline_status_; 733 return pipeline_status_;
730 } 734 }
731 735
732 void StartPipelineWithEncryptedMedia(MockMediaSource* source, 736 void StartPipelineWithEncryptedMedia(MockMediaSource* source,
733 FakeEncryptedMedia* encrypted_media) { 737 FakeEncryptedMedia* encrypted_media) {
734 EXPECT_CALL(*source, InitSegmentReceived(_)).Times(AtLeast(1)); 738 EXPECT_CALL(*source, InitSegmentReceived(_)).Times(AtLeast(1));
735 EXPECT_CALL(*this, OnMetadata(_)) 739 EXPECT_CALL(*this, OnMetadata(_))
736 .Times(AtMost(1)) 740 .Times(AtMost(1))
737 .WillRepeatedly(SaveArg<0>(&metadata_)); 741 .WillRepeatedly(SaveArg<0>(&metadata_));
738 EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH)) 742 EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH))
(...skipping 14 matching lines...) Expand all
753 757
754 pipeline_->Start(demuxer_.get(), CreateRenderer(), this, 758 pipeline_->Start(demuxer_.get(), CreateRenderer(), this,
755 base::Bind(&PipelineIntegrationTest::OnStatusCallback, 759 base::Bind(&PipelineIntegrationTest::OnStatusCallback,
756 base::Unretained(this))); 760 base::Unretained(this)));
757 761
758 source->set_encrypted_media_init_data_cb( 762 source->set_encrypted_media_init_data_cb(
759 base::Bind(&FakeEncryptedMedia::OnEncryptedMediaInitData, 763 base::Bind(&FakeEncryptedMedia::OnEncryptedMediaInitData,
760 base::Unretained(encrypted_media))); 764 base::Unretained(encrypted_media)));
761 765
762 message_loop_.Run(); 766 message_loop_.Run();
763 EXPECT_EQ(PIPELINE_OK, pipeline_status_); 767 EXPECT_EQ(pipeline_status_, expected_pipeline_status_);
ddorwin 2016/05/18 19:51:14 ditto
servolk 2016/05/19 00:43:43 Done.
764 } 768 }
765 769
766 // Verifies that seeking works properly for ChunkDemuxer when the 770 // Verifies that seeking works properly for ChunkDemuxer when the
767 // seek happens while there is a pending read on the ChunkDemuxer 771 // seek happens while there is a pending read on the ChunkDemuxer
768 // and no data is available. 772 // and no data is available.
769 bool TestSeekDuringRead(const std::string& filename, 773 bool TestSeekDuringRead(const std::string& filename,
770 const std::string& mimetype, 774 const std::string& mimetype,
771 int initial_append_size, 775 int initial_append_size,
772 base::TimeDelta start_seek_time, 776 base::TimeDelta start_seek_time,
773 base::TimeDelta seek_time, 777 base::TimeDelta seek_time,
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1902 ASSERT_EQ(PIPELINE_OK, pipeline_status_); 1906 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
1903 1907
1904 Play(); 1908 Play();
1905 1909
1906 ASSERT_TRUE(WaitUntilOnEnded()); 1910 ASSERT_TRUE(WaitUntilOnEnded());
1907 source.Shutdown(); 1911 source.Shutdown();
1908 Stop(); 1912 Stop();
1909 } 1913 }
1910 #endif // #if BUILDFLAG(ENABLE_MP4_VP9_DEMUXING) 1914 #endif // #if BUILDFLAG(ENABLE_MP4_VP9_DEMUXING)
1911 1915
1916 #if BUILDFLAG(ENABLE_HEVC_DEMUXING)
1917 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VideoOnly_MP4_HEVC1) {
1918 // Chromium supports HEVC demuxing, but not decoding, so we expect the decoder
1919 // error to be reported here. It indicates that we did pass media mime type
1920 // checks and attempted to actually demux and decode the stream.
1921 expected_pipeline_status_ = DECODER_ERROR_NOT_SUPPORTED;
ddorwin 2016/05/18 19:51:14 Adding a member variable to the base class is over
servolk 2016/05/19 00:43:43 I've decided to go a little further and introduce
1922 MockMediaSource source("bear-320x240-v_frag-hevc.mp4", kMP4VideoHEVC1,
1923 kAppendWholeFile);
1924 StartPipelineWithMediaSource(&source);
1925 }
halliwell 2016/05/13 01:53:20 Where will these tests get run in practice? Is it
servolk 2016/05/13 18:33:02 Yes, these tests will run on cast_shell* trybots,
servolk 2016/05/13 18:42:51 Btw, note that these tests actually use a regular
1926
1927 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VideoOnly_MP4_HEVC2) {
1928 // Chromium supports HEVC demuxing, but not decoding, so we expect the decoder
1929 // error to be reported here. It indicates that we did pass media mime type
1930 // checks and attempted to actually demux and decode the stream.
1931 expected_pipeline_status_ = DECODER_ERROR_NOT_SUPPORTED;
1932 MockMediaSource source("bear-320x240-v_frag-hevc.mp4", kMP4VideoHEVC2,
1933 kAppendWholeFile);
1934 StartPipelineWithMediaSource(&source);
1935 }
1936 #endif // #if BUILDFLAG(ENABLE_MP4_VP9_DEMUXING)
1937
1912 #endif // defined(USE_PROPRIETARY_CODECS) 1938 #endif // defined(USE_PROPRIETARY_CODECS)
1913 1939
1914 TEST_F(PipelineIntegrationTest, SeekWhilePaused) { 1940 TEST_F(PipelineIntegrationTest, SeekWhilePaused) {
1915 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); 1941 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm"));
1916 1942
1917 base::TimeDelta duration(pipeline_->GetMediaDuration()); 1943 base::TimeDelta duration(pipeline_->GetMediaDuration());
1918 base::TimeDelta start_seek_time(duration / 4); 1944 base::TimeDelta start_seek_time(duration / 4);
1919 base::TimeDelta seek_time(duration * 3 / 4); 1945 base::TimeDelta seek_time(duration * 3 / 4);
1920 1946
1921 Play(); 1947 Play();
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
2173 2199
2174 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { 2200 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) {
2175 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); 2201 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm"));
2176 Play(); 2202 Play();
2177 ASSERT_TRUE(WaitUntilOnEnded()); 2203 ASSERT_TRUE(WaitUntilOnEnded());
2178 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), 2204 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000),
2179 demuxer_->GetStartTime()); 2205 demuxer_->GetStartTime());
2180 } 2206 }
2181 2207
2182 } // namespace media 2208 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698