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

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: Feedback 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
« no previous file with comments | « media/filters/source_buffer_stream.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 const int kVP8AWebMFileDurationMs = 2734; 126 const int kVP8AWebMFileDurationMs = 2734;
127 127
128 #if !defined(MOJO_RENDERER) 128 #if !defined(MOJO_RENDERER)
129 #if defined(OPUS_FIXED_POINT) 129 #if defined(OPUS_FIXED_POINT)
130 static const char kOpusEndTrimmingHash_1[] = 130 static const char kOpusEndTrimmingHash_1[] =
131 "-4.57,-5.66,-6.52,-6.30,-4.37,-3.61,"; 131 "-4.57,-5.66,-6.52,-6.30,-4.37,-3.61,";
132 static const char kOpusEndTrimmingHash_2[] = 132 static const char kOpusEndTrimmingHash_2[] =
133 "-11.91,-11.11,-8.27,-7.13,-7.86,-10.00,"; 133 "-11.91,-11.11,-8.27,-7.13,-7.86,-10.00,";
134 static const char kOpusEndTrimmingHash_3[] = 134 static const char kOpusEndTrimmingHash_3[] =
135 "-13.31,-14.38,-13.70,-11.71,-10.21,-10.49,"; 135 "-13.31,-14.38,-13.70,-11.71,-10.21,-10.49,";
136 static const char kOpusSmallCodecDelayHash_1[] =
137 "-0.48,-0.09,1.27,1.06,1.54,-0.22,";
138 static const char kOpusSmallCodecDelayHash_2[] =
139 "0.29,0.15,-0.19,0.25,0.68,0.83,";
136 #else 140 #else
137 // Hash for a full playthrough of "opus-trimming-test.(webm|ogg)". 141 // Hash for a full playthrough of "opus-trimming-test.(webm|ogg)".
138 static const char kOpusEndTrimmingHash_1[] = 142 static const char kOpusEndTrimmingHash_1[] =
139 "-4.56,-5.65,-6.51,-6.29,-4.36,-3.59,"; 143 "-4.56,-5.65,-6.51,-6.29,-4.36,-3.59,";
140 // The above hash, plus an additional playthrough starting from T=1s. 144 // The above hash, plus an additional playthrough starting from T=1s.
141 static const char kOpusEndTrimmingHash_2[] = 145 static const char kOpusEndTrimmingHash_2[] =
142 "-11.89,-11.09,-8.25,-7.11,-7.84,-9.97,"; 146 "-11.89,-11.09,-8.25,-7.11,-7.84,-9.97,";
143 // The above hash, plus an additional playthrough starting from T=6.36s. 147 // The above hash, plus an additional playthrough starting from T=6.36s.
144 static const char kOpusEndTrimmingHash_3[] = 148 static const char kOpusEndTrimmingHash_3[] =
145 "-13.28,-14.35,-13.67,-11.68,-10.18,-10.46,"; 149 "-13.28,-14.35,-13.67,-11.68,-10.18,-10.46,";
150 // Hash for a full playthrough of "bear-opus.webm".
151 static const char kOpusSmallCodecDelayHash_1[] =
152 "-0.47,-0.09,1.28,1.07,1.55,-0.22,";
153 // The above hash, plus an additional playthrough starting from T=1.414s.
154 static const char kOpusSmallCodecDelayHash_2[] =
155 "0.31,0.15,-0.18,0.25,0.70,0.84,";
146 #endif // defined(OPUS_FIXED_POINT) 156 #endif // defined(OPUS_FIXED_POINT)
147 #endif // !defined(MOJO_RENDERER) 157 #endif // !defined(MOJO_RENDERER)
148 158
149 #if defined(USE_PROPRIETARY_CODECS) 159 #if defined(USE_PROPRIETARY_CODECS)
150 const int k640IsoFileDurationMs = 2737; 160 const int k640IsoFileDurationMs = 2737;
151 const int k640IsoCencFileDurationMs = 2736; 161 const int k640IsoCencFileDurationMs = 2736;
152 const int k1280IsoFileDurationMs = 2736; 162 const int k1280IsoFileDurationMs = 2736;
153 const int k1280IsoAVC3FileDurationMs = 2736; 163 const int k1280IsoAVC3FileDurationMs = 2736;
154 #endif // defined(USE_PROPRIETARY_CODECS) 164 #endif // defined(USE_PROPRIETARY_CODECS)
155 165
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 // Seek somewhere outside of the pre-skip / end-trim section, demuxer should 1134 // Seek somewhere outside of the pre-skip / end-trim section, demuxer should
1125 // correctly preroll enough to accurately decode this segment. 1135 // correctly preroll enough to accurately decode this segment.
1126 seek_time = base::TimeDelta::FromMilliseconds(6360); 1136 seek_time = base::TimeDelta::FromMilliseconds(6360);
1127 source.Seek(seek_time); 1137 source.Seek(seek_time);
1128 ASSERT_TRUE(Seek(seek_time)); 1138 ASSERT_TRUE(Seek(seek_time));
1129 Play(); 1139 Play();
1130 ASSERT_TRUE(WaitUntilOnEnded()); 1140 ASSERT_TRUE(WaitUntilOnEnded());
1131 EXPECT_HASH_EQ(kOpusEndTrimmingHash_3, GetAudioHash()); 1141 EXPECT_HASH_EQ(kOpusEndTrimmingHash_3, GetAudioHash());
1132 } 1142 }
1133 1143
1134 // TODO(dalecurtis): Add an opus test file which FFmpeg and ChunkDemuxer will 1144 TEST_F(PipelineIntegrationTest,
1135 // both seek the same in and shows the difference of preroll. 1145 MAYBE_CLOCKLESS(BasicPlaybackOpusPrerollExceedsCodecDelay)) {
1136 // http://crbug.com/509894 1146 ASSERT_EQ(PIPELINE_OK, Start("bear-opus.webm", kHashed | kClockless));
1147
1148 AudioDecoderConfig config =
1149 demuxer_->GetStream(DemuxerStream::AUDIO)->audio_decoder_config();
1150
1151 // Verify that this file's preroll is not eclipsed by the codec delay so we
1152 // can detect when preroll is not properly performed.
1153 base::TimeDelta codec_delay = base::TimeDelta::FromSecondsD(
1154 static_cast<double>(config.codec_delay()) / config.samples_per_second());
1155 ASSERT_GT(config.seek_preroll(), codec_delay);
1156
1157 Play();
1158 ASSERT_TRUE(WaitUntilOnEnded());
1159 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_1, GetAudioHash());
1160
1161 // Seek halfway through the file to invoke seek preroll.
1162 ASSERT_TRUE(Seek(base::TimeDelta::FromSecondsD(1.414)));
1163 Play();
1164 ASSERT_TRUE(WaitUntilOnEnded());
1165 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_2, GetAudioHash());
1166 }
1167
1168 TEST_F(PipelineIntegrationTest,
1169 MAYBE_CLOCKLESS(BasicPlaybackOpusPrerollExceedsCodecDelay_MediaSource)) {
1170 MockMediaSource source("bear-opus.webm", kOpusAudioOnlyWebM,
1171 kAppendWholeFile);
1172 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(
1173 &source, kClockless | kHashed, nullptr));
1174 source.EndOfStream();
1175
1176 AudioDecoderConfig config =
1177 demuxer_->GetStream(DemuxerStream::AUDIO)->audio_decoder_config();
1178
1179 // Verify that this file's preroll is not eclipsed by the codec delay so we
1180 // can detect when preroll is not properly performed.
1181 base::TimeDelta codec_delay = base::TimeDelta::FromSecondsD(
1182 static_cast<double>(config.codec_delay()) / config.samples_per_second());
1183 ASSERT_GT(config.seek_preroll(), codec_delay);
1184
1185 Play();
1186 ASSERT_TRUE(WaitUntilOnEnded());
1187 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_1, GetAudioHash());
1188
1189 // Seek halfway through the file to invoke seek preroll.
1190 base::TimeDelta seek_time = base::TimeDelta::FromSecondsD(1.414);
1191 source.Seek(seek_time);
1192 ASSERT_TRUE(Seek(seek_time));
1193 Play();
1194 ASSERT_TRUE(WaitUntilOnEnded());
1195 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_2, GetAudioHash());
1196 }
1137 1197
1138 TEST_F(PipelineIntegrationTest, BasicPlaybackLive) { 1198 TEST_F(PipelineIntegrationTest, BasicPlaybackLive) {
1139 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-live.webm", kHashed)); 1199 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-live.webm", kHashed));
1140 1200
1141 // Live stream does not have duration in the initialization segment. 1201 // Live stream does not have duration in the initialization segment.
1142 // It will be set after the entire file is available. 1202 // It will be set after the entire file is available.
1143 EXPECT_CALL(*this, OnDurationChange()).Times(1); 1203 EXPECT_CALL(*this, OnDurationChange()).Times(1);
1144 1204
1145 Play(); 1205 Play();
1146 1206
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after
2489 2549
2490 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { 2550 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) {
2491 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); 2551 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm"));
2492 Play(); 2552 Play();
2493 ASSERT_TRUE(WaitUntilOnEnded()); 2553 ASSERT_TRUE(WaitUntilOnEnded());
2494 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), 2554 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000),
2495 demuxer_->GetStartTime()); 2555 demuxer_->GetStartTime());
2496 } 2556 }
2497 2557
2498 } // namespace media 2558 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/source_buffer_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698