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

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

Issue 2171133002: Implement opus seek preroll for MediaSourceExtensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add dummy fixed point hashes Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 const int kVP8AWebMFileDurationMs = 2734; 134 const int kVP8AWebMFileDurationMs = 2734;
135 135
136 #if !defined(MOJO_RENDERER) 136 #if !defined(MOJO_RENDERER)
137 #if defined(OPUS_FIXED_POINT) 137 #if defined(OPUS_FIXED_POINT)
138 static const char kOpusEndTrimmingHash_1[] = 138 static const char kOpusEndTrimmingHash_1[] =
139 "-4.57,-5.66,-6.52,-6.30,-4.37,-3.61,"; 139 "-4.57,-5.66,-6.52,-6.30,-4.37,-3.61,";
140 static const char kOpusEndTrimmingHash_2[] = 140 static const char kOpusEndTrimmingHash_2[] =
141 "-11.91,-11.11,-8.27,-7.13,-7.86,-10.00,"; 141 "-11.91,-11.11,-8.27,-7.13,-7.86,-10.00,";
142 static const char kOpusEndTrimmingHash_3[] = 142 static const char kOpusEndTrimmingHash_3[] =
143 "-13.31,-14.38,-13.70,-11.71,-10.21,-10.49,"; 143 "-13.31,-14.38,-13.70,-11.71,-10.21,-10.49,";
144 static const char kOpusSmallCodecDelayHash_1[] =
145 "-0.47,-0.09,1.28,1.07,1.55,-0.22,";
chcunningham 2016/12/01 21:12:24 surprisingly the arm bots didn't fail. not sure if
wolenetz 2016/12/02 00:18:49 I wonder if this is an artifact of OpusAudioDecode
wolenetz 2016/12/02 00:41:04 Oh - android doesn't run pipeline_integration_test
146 static const char kOpusSmallCodecDelayHash_2[] =
147 "0.31,0.15,-0.18,0.25,0.70,0.84,";
144 #else 148 #else
145 // Hash for a full playthrough of "opus-trimming-test.(webm|ogg)". 149 // Hash for a full playthrough of "opus-trimming-test.(webm|ogg)".
146 static const char kOpusEndTrimmingHash_1[] = 150 static const char kOpusEndTrimmingHash_1[] =
147 "-4.56,-5.65,-6.51,-6.29,-4.36,-3.59,"; 151 "-4.56,-5.65,-6.51,-6.29,-4.36,-3.59,";
148 // The above hash, plus an additional playthrough starting from T=1s. 152 // The above hash, plus an additional playthrough starting from T=1s.
149 static const char kOpusEndTrimmingHash_2[] = 153 static const char kOpusEndTrimmingHash_2[] =
150 "-11.89,-11.09,-8.25,-7.11,-7.84,-9.97,"; 154 "-11.89,-11.09,-8.25,-7.11,-7.84,-9.97,";
151 // The above hash, plus an additional playthrough starting from T=6.36s. 155 // The above hash, plus an additional playthrough starting from T=6.36s.
152 static const char kOpusEndTrimmingHash_3[] = 156 static const char kOpusEndTrimmingHash_3[] =
153 "-13.28,-14.35,-13.67,-11.68,-10.18,-10.46,"; 157 "-13.28,-14.35,-13.67,-11.68,-10.18,-10.46,";
158 // Hash for a full playthrough of "bear-opus.webm".
159 static const char kOpusSmallCodecDelayHash_1[] =
160 "-0.47,-0.09,1.28,1.07,1.55,-0.22,";
161 // The above hash, plus an additional plathrough starting from T=1.414s.
wolenetz 2016/12/02 00:18:50 nit: plathrough
chcunningham 2016/12/02 21:41:09 Done.
162 static const char kOpusSmallCodecDelayHash_2[] =
163 "0.31,0.15,-0.18,0.25,0.70,0.84,";
154 #endif // defined(OPUS_FIXED_POINT) 164 #endif // defined(OPUS_FIXED_POINT)
155 #endif // !defined(MOJO_RENDERER) 165 #endif // !defined(MOJO_RENDERER)
156 166
157 #if defined(USE_PROPRIETARY_CODECS) 167 #if defined(USE_PROPRIETARY_CODECS)
158 const int k640IsoFileDurationMs = 2737; 168 const int k640IsoFileDurationMs = 2737;
159 const int k640IsoCencFileDurationMs = 2736; 169 const int k640IsoCencFileDurationMs = 2736;
160 const int k1280IsoFileDurationMs = 2736; 170 const int k1280IsoFileDurationMs = 2736;
161 const int k1280IsoAVC3FileDurationMs = 2736; 171 const int k1280IsoAVC3FileDurationMs = 2736;
162 #endif // defined(USE_PROPRIETARY_CODECS) 172 #endif // defined(USE_PROPRIETARY_CODECS)
163 173
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 // Seek somewhere outside of the pre-skip / end-trim section, demuxer should 1153 // Seek somewhere outside of the pre-skip / end-trim section, demuxer should
1144 // correctly preroll enough to accurately decode this segment. 1154 // correctly preroll enough to accurately decode this segment.
1145 seek_time = base::TimeDelta::FromMilliseconds(6360); 1155 seek_time = base::TimeDelta::FromMilliseconds(6360);
1146 source.Seek(seek_time); 1156 source.Seek(seek_time);
1147 ASSERT_TRUE(Seek(seek_time)); 1157 ASSERT_TRUE(Seek(seek_time));
1148 Play(); 1158 Play();
1149 ASSERT_TRUE(WaitUntilOnEnded()); 1159 ASSERT_TRUE(WaitUntilOnEnded());
1150 EXPECT_HASH_EQ(kOpusEndTrimmingHash_3, GetAudioHash()); 1160 EXPECT_HASH_EQ(kOpusEndTrimmingHash_3, GetAudioHash());
1151 } 1161 }
1152 1162
1153 // TODO(dalecurtis): Add an opus test file which FFmpeg and ChunkDemuxer will 1163 TEST_F(PipelineIntegrationTest,
1154 // both seek the same in and shows the difference of preroll. 1164 MAYBE_CLOCKLESS(BasicPlaybackOpusPrerollExceedsCodecDelay)) {
1155 // http://crbug.com/509894 1165 ASSERT_EQ(PIPELINE_OK, Start("bear-opus.webm", kHashed | kClockless));
1166
1167 AudioDecoderConfig config =
1168 demuxer_->GetStream(DemuxerStream::AUDIO)->audio_decoder_config();
1169
1170 // Verify that this file's preroll is not eclipsed by the codec delay so we
1171 // can detect when preroll is not properly performed.
1172 base::TimeDelta codec_delay = base::TimeDelta::FromSecondsD(
1173 static_cast<double>(config.codec_delay()) / config.samples_per_second());
1174 ASSERT_GT(config.seek_preroll(), codec_delay);
1175
1176 Play();
1177 ASSERT_TRUE(WaitUntilOnEnded());
1178 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_1, GetAudioHash());
1179
1180 // Seek halfway through the file to invoke seek preroll.
1181 ASSERT_TRUE(Seek(base::TimeDelta::FromSecondsD(1.414)));
1182 Play();
1183 ASSERT_TRUE(WaitUntilOnEnded());
1184 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_2, GetAudioHash());
1185 }
1186
1187 TEST_F(PipelineIntegrationTest,
1188 MAYBE_CLOCKLESS(BasicPlaybackOpusPrerollExceedsCodecDelay_MediaSource)) {
1189 MockMediaSource source("bear-opus.webm", kOpusAudioOnlyWebM,
1190 kAppendWholeFile);
1191 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(
1192 &source, kClockless | kHashed, nullptr));
1193 source.EndOfStream();
1194
1195 AudioDecoderConfig config =
1196 demuxer_->GetStream(DemuxerStream::AUDIO)->audio_decoder_config();
1197
1198 // Verify that this file's preroll is not eclipsed by the codec delay so we
1199 // can detect when preroll is not properly performed.
1200 base::TimeDelta codec_delay = base::TimeDelta::FromSecondsD(
1201 static_cast<double>(config.codec_delay()) / config.samples_per_second());
1202 ASSERT_GT(config.seek_preroll(), codec_delay);
1203
1204 Play();
1205 ASSERT_TRUE(WaitUntilOnEnded());
1206 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_1, GetAudioHash());
1207
1208 // Seek halfway through the file to invoke seek preroll.
1209 base::TimeDelta seek_time = base::TimeDelta::FromSecondsD(1.414);
1210 source.Seek(seek_time);
1211 ASSERT_TRUE(Seek(seek_time));
1212 Play();
1213 ASSERT_TRUE(WaitUntilOnEnded());
1214 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_2, GetAudioHash());
1215 }
1156 1216
1157 TEST_F(PipelineIntegrationTest, BasicPlaybackLive) { 1217 TEST_F(PipelineIntegrationTest, BasicPlaybackLive) {
1158 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-live.webm", kHashed)); 1218 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-live.webm", kHashed));
1159 1219
1160 // Live stream does not have duration in the initialization segment. 1220 // Live stream does not have duration in the initialization segment.
1161 // It will be set after the entire file is available. 1221 // It will be set after the entire file is available.
1162 EXPECT_CALL(*this, OnDurationChange()).Times(1); 1222 EXPECT_CALL(*this, OnDurationChange()).Times(1);
1163 1223
1164 Play(); 1224 Play();
1165 1225
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after
2508 2568
2509 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { 2569 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) {
2510 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); 2570 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm"));
2511 Play(); 2571 Play();
2512 ASSERT_TRUE(WaitUntilOnEnded()); 2572 ASSERT_TRUE(WaitUntilOnEnded());
2513 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), 2573 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000),
2514 demuxer_->GetStartTime()); 2574 demuxer_->GetStartTime());
2515 } 2575 }
2516 2576
2517 } // namespace media 2577 } // namespace media
OLDNEW
« media/filters/source_buffer_range.cc ('K') | « media/filters/source_buffer_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698