OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 bool tear_down_; | 181 bool tear_down_; |
182 rtc::PlatformThread extract_thread_; | 182 rtc::PlatformThread extract_thread_; |
183 rtc::Event trigger_extract_event_; | 183 rtc::Event trigger_extract_event_; |
184 rtc::Event crit_acquired_event_; | 184 rtc::Event crit_acquired_event_; |
185 rtc::CriticalSection crit_; | 185 rtc::CriticalSection crit_; |
186 }; | 186 }; |
187 | 187 |
188 TEST_F(TestFrameBuffer2, ExtractFromEmptyBuffer) { | 188 TEST_F(TestFrameBuffer2, ExtractFromEmptyBuffer) { |
189 ExtractFrame(); | 189 ExtractFrame(); |
190 CheckNoFrame(0); | 190 CheckNoFrame(0); |
191 } | 191 } |
stefan-webrtc
2016/05/19 13:02:55
Maybe move this down so all non timing dependent t
| |
192 | 192 |
193 // Following tests are timing dependent. Either the timeouts have to | |
194 // be increased by a large margin, which would slow down all trybots, | |
195 // or we disable them for the very slow ones, like we do here. | |
196 #if !defined(ADDRESS_SANITIZER) && !defined(MEMORY_SANITIZER) | |
193 TEST_F(TestFrameBuffer2, WaitForFrame) { | 197 TEST_F(TestFrameBuffer2, WaitForFrame) { |
194 uint16_t pid = Rand(); | 198 uint16_t pid = Rand(); |
195 uint32_t ts = Rand(); | 199 uint32_t ts = Rand(); |
196 | 200 |
197 ExtractFrame(20); | 201 ExtractFrame(50); |
198 InsertFrame(pid, 0, ts, false); | 202 InsertFrame(pid, 0, ts, false); |
199 CheckFrame(0, pid, 0); | 203 CheckFrame(0, pid, 0); |
200 } | 204 } |
201 | 205 |
202 TEST_F(TestFrameBuffer2, OneSuperFrame) { | 206 TEST_F(TestFrameBuffer2, OneSuperFrame) { |
203 uint16_t pid = Rand(); | 207 uint16_t pid = Rand(); |
204 uint32_t ts = Rand(); | 208 uint32_t ts = Rand(); |
205 | 209 |
206 ExtractFrame(20); | 210 ExtractFrame(50); |
207 InsertFrame(pid, 1, ts, true); | 211 InsertFrame(pid, 1, ts, true); |
208 InsertFrame(pid, 0, ts, false); | 212 InsertFrame(pid, 0, ts, false); |
209 ExtractFrame(); | 213 ExtractFrame(); |
210 | 214 |
211 CheckFrame(0, pid, 0); | 215 CheckFrame(0, pid, 0); |
212 CheckFrame(1, pid, 1); | 216 CheckFrame(1, pid, 1); |
213 } | 217 } |
214 | 218 |
219 TEST_F(TestFrameBuffer2, OneLayerStreamReordered) { | |
220 uint16_t pid = Rand(); | |
221 uint32_t ts = Rand(); | |
222 | |
223 InsertFrame(pid, 0, ts, false); | |
224 ExtractFrame(); | |
225 CheckFrame(0, pid, 0); | |
226 for (int i = 1; i < 10; i += 2) { | |
227 ExtractFrame(50); | |
228 InsertFrame(pid + i + 1, 0, ts + (i + 1) * kFps10, false, pid + i); | |
229 clock_.AdvanceTimeMilliseconds(kFps10); | |
230 InsertFrame(pid + i, 0, ts + i * kFps10, false, pid + i - 1); | |
231 clock_.AdvanceTimeMilliseconds(kFps10); | |
232 ExtractFrame(); | |
233 CheckFrame(i, pid + i, 0); | |
234 CheckFrame(i + 1, pid + i + 1, 0); | |
235 } | |
236 } | |
237 #endif | |
238 | |
215 TEST_F(TestFrameBuffer2, OneLayerStream) { | 239 TEST_F(TestFrameBuffer2, OneLayerStream) { |
216 uint16_t pid = Rand(); | 240 uint16_t pid = Rand(); |
217 uint32_t ts = Rand(); | 241 uint32_t ts = Rand(); |
218 | 242 |
219 InsertFrame(pid, 0, ts, false); | 243 InsertFrame(pid, 0, ts, false); |
220 ExtractFrame(); | 244 ExtractFrame(); |
221 CheckFrame(0, pid, 0); | 245 CheckFrame(0, pid, 0); |
222 for (int i = 1; i < 10; ++i) { | 246 for (int i = 1; i < 10; ++i) { |
223 InsertFrame(pid + i, 0, ts + i * kFps10, false, pid + i - 1); | 247 InsertFrame(pid + i, 0, ts + i * kFps10, false, pid + i - 1); |
224 ExtractFrame(); | 248 ExtractFrame(); |
225 clock_.AdvanceTimeMilliseconds(kFps10); | 249 clock_.AdvanceTimeMilliseconds(kFps10); |
226 CheckFrame(i, pid + i, 0); | 250 CheckFrame(i, pid + i, 0); |
227 } | 251 } |
228 } | 252 } |
229 | 253 |
230 TEST_F(TestFrameBuffer2, OneLayerStreamReordered) { | |
231 uint16_t pid = Rand(); | |
232 uint32_t ts = Rand(); | |
233 | |
234 InsertFrame(pid, 0, ts, false); | |
235 ExtractFrame(); | |
236 CheckFrame(0, pid, 0); | |
237 for (int i = 1; i < 10; i += 2) { | |
238 ExtractFrame(15); | |
239 InsertFrame(pid + i + 1, 0, ts + (i + 1) * kFps10, false, pid + i); | |
240 clock_.AdvanceTimeMilliseconds(kFps10); | |
241 InsertFrame(pid + i, 0, ts + i * kFps10, false, pid + i - 1); | |
242 clock_.AdvanceTimeMilliseconds(kFps10); | |
243 ExtractFrame(); | |
244 CheckFrame(i, pid + i, 0); | |
245 CheckFrame(i + 1, pid + i + 1, 0); | |
246 } | |
247 } | |
248 | |
249 TEST_F(TestFrameBuffer2, DropTemporalLayerSlowDecoder) { | 254 TEST_F(TestFrameBuffer2, DropTemporalLayerSlowDecoder) { |
250 uint16_t pid = Rand(); | 255 uint16_t pid = Rand(); |
251 uint32_t ts = Rand(); | 256 uint32_t ts = Rand(); |
252 | 257 |
253 InsertFrame(pid, 0, ts, false); | 258 InsertFrame(pid, 0, ts, false); |
254 InsertFrame(pid + 1, 0, ts + kFps20, false); | 259 InsertFrame(pid + 1, 0, ts + kFps20, false); |
255 for (int i = 2; i < 10; i += 2) { | 260 for (int i = 2; i < 10; i += 2) { |
256 uint32_t ts_tl0 = ts + i / 2 * kFps10; | 261 uint32_t ts_tl0 = ts + i / 2 * kFps10; |
257 InsertFrame(pid + i, 0, ts_tl0, false, pid + i - 2); | 262 InsertFrame(pid + i, 0, ts_tl0, false, pid + i - 2); |
258 InsertFrame(pid + i + 1, 0, ts_tl0 + kFps20, false, pid + i, pid + i - 1); | 263 InsertFrame(pid + i + 1, 0, ts_tl0 + kFps20, false, pid + i, pid + i - 1); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 InsertFrame(pid + 1, 0, ts, false, pid); | 325 InsertFrame(pid + 1, 0, ts, false, pid); |
321 ExtractFrame(); | 326 ExtractFrame(); |
322 | 327 |
323 CheckFrame(0, pid, 0); | 328 CheckFrame(0, pid, 0); |
324 CheckFrame(1, pid + 2, 0); | 329 CheckFrame(1, pid + 2, 0); |
325 CheckNoFrame(2); | 330 CheckNoFrame(2); |
326 } | 331 } |
327 | 332 |
328 } // namespace video_coding | 333 } // namespace video_coding |
329 } // namespace webrtc | 334 } // namespace webrtc |
OLD | NEW |