OLD | NEW |
---|---|
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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
148 #else | 148 #else |
149 // Hash for a full playthrough of "opus-trimming-test.(webm|ogg)". | 149 // Hash for a full playthrough of "opus-trimming-test.(webm|ogg)". |
150 static const char kOpusEndTrimmingHash_1[] = | 150 static const char kOpusEndTrimmingHash_1[] = |
151 "-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,"; |
152 // The above hash, plus an additional playthrough starting from T=1s. | 152 // The above hash, plus an additional playthrough starting from T=1s. |
153 static const char kOpusEndTrimmingHash_2[] = | 153 static const char kOpusEndTrimmingHash_2[] = |
154 "-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,"; |
155 // 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. |
156 static const char kOpusEndTrimmingHash_3[] = | 156 static const char kOpusEndTrimmingHash_3[] = |
157 "-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". | |
chcunningham
2016/07/22 01:50:28
TODO - impl fixed point hashes too.
chcunningham
2016/12/01 17:07:16
Will do fixed point in a following PS. For now I'v
wolenetz
2016/12/02 00:18:49
Acknowledged.
| |
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/07/25 21:49:02
nit: 1.414 --> put in a constant?
chcunningham
2016/12/01 17:07:16
Eh. Its the same pattern used with kOpusEndTrimmin
wolenetz
2016/12/02 00:18:49
Acknowledged.
| |
162 static const char kOpusSmallCodecDelayHash_2[] = | |
163 "0.31,0.15,-0.18,0.25,0.70,0.84,"; | |
158 #endif // defined(OPUS_FIXED_POINT) | 164 #endif // defined(OPUS_FIXED_POINT) |
159 #endif // !defined(MOJO_RENDERER) | 165 #endif // !defined(MOJO_RENDERER) |
160 | 166 |
161 #if defined(USE_PROPRIETARY_CODECS) | 167 #if defined(USE_PROPRIETARY_CODECS) |
162 const int k640IsoFileDurationMs = 2737; | 168 const int k640IsoFileDurationMs = 2737; |
163 const int k640IsoCencFileDurationMs = 2736; | 169 const int k640IsoCencFileDurationMs = 2736; |
164 const int k1280IsoFileDurationMs = 2736; | 170 const int k1280IsoFileDurationMs = 2736; |
165 const int k1280IsoAVC3FileDurationMs = 2736; | 171 const int k1280IsoAVC3FileDurationMs = 2736; |
166 #endif // defined(USE_PROPRIETARY_CODECS) | 172 #endif // defined(USE_PROPRIETARY_CODECS) |
167 | 173 |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1095 // Seek somewhere outside of the pre-skip / end-trim section, demuxer should | 1101 // Seek somewhere outside of the pre-skip / end-trim section, demuxer should |
1096 // correctly preroll enough to accurately decode this segment. | 1102 // correctly preroll enough to accurately decode this segment. |
1097 seek_time = base::TimeDelta::FromMilliseconds(6360); | 1103 seek_time = base::TimeDelta::FromMilliseconds(6360); |
1098 source.Seek(seek_time); | 1104 source.Seek(seek_time); |
1099 ASSERT_TRUE(Seek(seek_time)); | 1105 ASSERT_TRUE(Seek(seek_time)); |
1100 Play(); | 1106 Play(); |
1101 ASSERT_TRUE(WaitUntilOnEnded()); | 1107 ASSERT_TRUE(WaitUntilOnEnded()); |
1102 EXPECT_HASH_EQ(kOpusEndTrimmingHash_3, GetAudioHash()); | 1108 EXPECT_HASH_EQ(kOpusEndTrimmingHash_3, GetAudioHash()); |
1103 } | 1109 } |
1104 | 1110 |
1105 // TODO(dalecurtis): Add an opus test file which FFmpeg and ChunkDemuxer will | 1111 TEST_F(PipelineIntegrationTest, |
1106 // both seek the same in and shows the difference of preroll. | 1112 MAYBE_CLOCKLESS(BasicPlaybackOpusPrerollExceedsCodecDelay)) { |
1107 // http://crbug.com/509894 | 1113 ASSERT_EQ(PIPELINE_OK, Start("bear-opus.webm", kHashed | kClockless)); |
1114 | |
1115 AudioDecoderConfig config = | |
1116 demuxer_->GetStream(DemuxerStream::AUDIO)->audio_decoder_config(); | |
1117 | |
1118 // Verify that this file's preroll is not eclipsed by the codec delay so we | |
wolenetz
2016/07/25 21:49:02
nit: please do the same verification in the MSE ve
chcunningham
2016/12/01 17:07:16
Done.
| |
1119 // can detect when preroll is not properly performed. | |
1120 base::TimeDelta codec_delay = base::TimeDelta::FromSecondsD( | |
1121 static_cast<double>(config.codec_delay()) / config.samples_per_second()); | |
1122 ASSERT_GT(config.seek_preroll(), codec_delay); | |
1123 | |
1124 Play(); | |
1125 ASSERT_TRUE(WaitUntilOnEnded()); | |
1126 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_1, GetAudioHash()); | |
1127 | |
1128 // Seek halfway through the file to invoke seek preroll. | |
1129 ASSERT_TRUE(Seek(base::TimeDelta::FromSecondsD(1.414))); | |
1130 Play(); | |
1131 ASSERT_TRUE(WaitUntilOnEnded()); | |
1132 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_2, GetAudioHash()); | |
1133 } | |
1134 | |
1135 TEST_F(PipelineIntegrationTest, | |
1136 MAYBE_CLOCKLESS(BasicPlaybackOpusPrerollExceedsCodecDelay_MediaSource)) { | |
1137 MockMediaSource source("bear-opus.webm", kOpusAudioOnlyWebM, | |
1138 kAppendWholeFile); | |
1139 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource( | |
1140 &source, kClockless | kHashed, nullptr)); | |
1141 source.EndOfStream(); | |
1142 | |
1143 Play(); | |
1144 ASSERT_TRUE(WaitUntilOnEnded()); | |
1145 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_1, GetAudioHash()); | |
1146 | |
1147 // Seek halfway through the file to invoke seek preroll. | |
1148 base::TimeDelta seek_time = base::TimeDelta::FromSecondsD(1.414); | |
1149 source.Seek(seek_time); | |
1150 ASSERT_TRUE(Seek(seek_time)); | |
1151 Play(); | |
1152 ASSERT_TRUE(WaitUntilOnEnded()); | |
1153 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_2, GetAudioHash()); | |
1154 } | |
1108 | 1155 |
1109 TEST_F(PipelineIntegrationTest, BasicPlaybackLive) { | 1156 TEST_F(PipelineIntegrationTest, BasicPlaybackLive) { |
1110 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-live.webm", kHashed)); | 1157 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-live.webm", kHashed)); |
1111 | 1158 |
1112 // Live stream does not have duration in the initialization segment. | 1159 // Live stream does not have duration in the initialization segment. |
1113 // It will be set after the entire file is available. | 1160 // It will be set after the entire file is available. |
1114 EXPECT_CALL(*this, OnDurationChange()).Times(1); | 1161 EXPECT_CALL(*this, OnDurationChange()).Times(1); |
1115 | 1162 |
1116 Play(); | 1163 Play(); |
1117 | 1164 |
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2400 | 2447 |
2401 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { | 2448 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { |
2402 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); | 2449 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); |
2403 Play(); | 2450 Play(); |
2404 ASSERT_TRUE(WaitUntilOnEnded()); | 2451 ASSERT_TRUE(WaitUntilOnEnded()); |
2405 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), | 2452 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), |
2406 demuxer_->GetStartTime()); | 2453 demuxer_->GetStartTime()); |
2407 } | 2454 } |
2408 | 2455 |
2409 } // namespace media | 2456 } // namespace media |
OLD | NEW |