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

Side by Side Diff: media/filters/frame_processor_unittest.cc

Issue 1091293005: MSE: Relax the 'media segment must begin with keyframe' requirement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Try to fix bot flakes by strictly ordering the blocks in muxed test 3 Created 4 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // sequence mode (if true), or segments mode (if false). 60 // sequence mode (if true), or segments mode (if false).
61 class FrameProcessorTest : public testing::TestWithParam<bool> { 61 class FrameProcessorTest : public testing::TestWithParam<bool> {
62 protected: 62 protected:
63 FrameProcessorTest() 63 FrameProcessorTest()
64 : frame_processor_(new FrameProcessor( 64 : frame_processor_(new FrameProcessor(
65 base::Bind( 65 base::Bind(
66 &FrameProcessorTestCallbackHelper::OnPossibleDurationIncrease, 66 &FrameProcessorTestCallbackHelper::OnPossibleDurationIncrease,
67 base::Unretained(&callbacks_)), 67 base::Unretained(&callbacks_)),
68 new MediaLog())), 68 new MediaLog())),
69 append_window_end_(kInfiniteDuration()), 69 append_window_end_(kInfiniteDuration()),
70 new_media_segment_(false),
71 audio_id_(FrameProcessor::kAudioTrackId), 70 audio_id_(FrameProcessor::kAudioTrackId),
72 video_id_(FrameProcessor::kVideoTrackId), 71 video_id_(FrameProcessor::kVideoTrackId),
73 frame_duration_(base::TimeDelta::FromMilliseconds(10)) {} 72 frame_duration_(base::TimeDelta::FromMilliseconds(10)) {}
74 73
75 enum StreamFlags { 74 enum StreamFlags {
76 HAS_AUDIO = 1 << 0, 75 HAS_AUDIO = 1 << 0,
77 HAS_VIDEO = 1 << 1 76 HAS_VIDEO = 1 << 1
78 }; 77 };
79 78
80 void AddTestTracks(int stream_flags) { 79 void AddTestTracks(int stream_flags) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 buffers.push_back(buffer); 149 buffers.push_back(buffer);
151 } 150 }
152 return buffers; 151 return buffers;
153 } 152 }
154 153
155 void ProcessFrames(const std::string& audio_timestamps, 154 void ProcessFrames(const std::string& audio_timestamps,
156 const std::string& video_timestamps) { 155 const std::string& video_timestamps) {
157 ASSERT_TRUE(frame_processor_->ProcessFrames( 156 ASSERT_TRUE(frame_processor_->ProcessFrames(
158 StringToBufferQueue(audio_timestamps, audio_id_, DemuxerStream::AUDIO), 157 StringToBufferQueue(audio_timestamps, audio_id_, DemuxerStream::AUDIO),
159 StringToBufferQueue(video_timestamps, video_id_, DemuxerStream::VIDEO), 158 StringToBufferQueue(video_timestamps, video_id_, DemuxerStream::VIDEO),
160 empty_text_buffers_, 159 empty_text_buffers_, append_window_start_, append_window_end_,
161 append_window_start_, append_window_end_, 160 &timestamp_offset_));
162 &new_media_segment_, &timestamp_offset_));
163 } 161 }
164 162
165 void CheckExpectedRangesByTimestamp(ChunkDemuxerStream* stream, 163 void CheckExpectedRangesByTimestamp(ChunkDemuxerStream* stream,
166 const std::string& expected) { 164 const std::string& expected) {
167 // Note, DemuxerStream::TEXT streams return [0,duration (==infinity here)) 165 // Note, DemuxerStream::TEXT streams return [0,duration (==infinity here))
168 Ranges<base::TimeDelta> r = stream->GetBufferedRanges(kInfiniteDuration()); 166 Ranges<base::TimeDelta> r = stream->GetBufferedRanges(kInfiniteDuration());
169 167
170 std::stringstream ss; 168 std::stringstream ss;
171 ss << "{ "; 169 ss << "{ ";
172 for (size_t i = 0; i < r.size(); ++i) { 170 for (size_t i = 0; i < r.size(); ++i) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 if (last_read_buffer_->discard_padding().first == kInfiniteDuration() && 237 if (last_read_buffer_->discard_padding().first == kInfiniteDuration() &&
240 last_read_buffer_->discard_padding().second == base::TimeDelta()) { 238 last_read_buffer_->discard_padding().second == base::TimeDelta()) {
241 ss << "P"; 239 ss << "P";
242 } 240 }
243 } 241 }
244 242
245 EXPECT_EQ(expected, ss.str()); 243 EXPECT_EQ(expected, ss.str());
246 CheckReadStalls(stream); 244 CheckReadStalls(stream);
247 } 245 }
248 246
247 bool in_coded_frame_group() {
chcunningham 2016/01/22 01:26:37 Edit: I that the test I described (and many more)
chcunningham 2016/01/22 01:26:38 I feel like this is testing implementation details
wolenetz 2016/01/22 01:50:03 SGTM. Good idea (around mocked stream; checking fo
wolenetz 2016/01/22 01:50:03 Acknowledged (your edit).
wolenetz 2016/01/22 18:59:31 From my investigation and offline chat w/chcunning
chcunningham 2016/01/22 19:26:02 Acknowledged.
248 return frame_processor_->in_coded_frame_group_;
249 }
250
249 base::MessageLoop message_loop_; 251 base::MessageLoop message_loop_;
250 StrictMock<FrameProcessorTestCallbackHelper> callbacks_; 252 StrictMock<FrameProcessorTestCallbackHelper> callbacks_;
251 253
252 scoped_ptr<FrameProcessor> frame_processor_; 254 scoped_ptr<FrameProcessor> frame_processor_;
253 base::TimeDelta append_window_start_; 255 base::TimeDelta append_window_start_;
254 base::TimeDelta append_window_end_; 256 base::TimeDelta append_window_end_;
255 bool new_media_segment_;
256 base::TimeDelta timestamp_offset_; 257 base::TimeDelta timestamp_offset_;
257 scoped_ptr<ChunkDemuxerStream> audio_; 258 scoped_ptr<ChunkDemuxerStream> audio_;
258 scoped_ptr<ChunkDemuxerStream> video_; 259 scoped_ptr<ChunkDemuxerStream> video_;
259 const TrackId audio_id_; 260 const TrackId audio_id_;
260 const TrackId video_id_; 261 const TrackId video_id_;
261 const base::TimeDelta frame_duration_; // Currently the same for all streams. 262 const base::TimeDelta frame_duration_; // Currently the same for all streams.
262 const BufferQueue empty_queue_; 263 const BufferQueue empty_queue_;
263 const TextBufferQueueMap empty_text_buffers_; 264 const TextBufferQueueMap empty_text_buffers_;
264 265
265 // StoreStatusAndBuffer's most recent result. 266 // StoreStatusAndBuffer's most recent result.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 ASSERT_FALSE(true); 310 ASSERT_FALSE(true);
310 } 311 }
311 } 312 }
312 } 313 }
313 314
314 DISALLOW_COPY_AND_ASSIGN(FrameProcessorTest); 315 DISALLOW_COPY_AND_ASSIGN(FrameProcessorTest);
315 }; 316 };
316 317
317 TEST_F(FrameProcessorTest, WrongTypeInAppendedBuffer) { 318 TEST_F(FrameProcessorTest, WrongTypeInAppendedBuffer) {
318 AddTestTracks(HAS_AUDIO); 319 AddTestTracks(HAS_AUDIO);
319 new_media_segment_ = true; 320 EXPECT_FALSE(in_coded_frame_group());
320 321
321 ASSERT_FALSE(frame_processor_->ProcessFrames( 322 ASSERT_FALSE(frame_processor_->ProcessFrames(
322 StringToBufferQueue("0K", audio_id_, DemuxerStream::VIDEO), 323 StringToBufferQueue("0K", audio_id_, DemuxerStream::VIDEO), empty_queue_,
323 empty_queue_, 324 empty_text_buffers_, append_window_start_, append_window_end_,
324 empty_text_buffers_, 325 &timestamp_offset_));
325 append_window_start_, append_window_end_, 326 EXPECT_FALSE(in_coded_frame_group());
326 &new_media_segment_, &timestamp_offset_));
327 EXPECT_TRUE(new_media_segment_);
328 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 327 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
329 CheckExpectedRangesByTimestamp(audio_.get(), "{ }"); 328 CheckExpectedRangesByTimestamp(audio_.get(), "{ }");
330 CheckReadStalls(audio_.get()); 329 CheckReadStalls(audio_.get());
331 } 330 }
332 331
333 TEST_F(FrameProcessorTest, NonMonotonicallyIncreasingTimestampInOneCall) { 332 TEST_F(FrameProcessorTest, NonMonotonicallyIncreasingTimestampInOneCall) {
334 AddTestTracks(HAS_AUDIO); 333 AddTestTracks(HAS_AUDIO);
335 new_media_segment_ = true;
336 334
337 ASSERT_FALSE(frame_processor_->ProcessFrames( 335 ASSERT_FALSE(frame_processor_->ProcessFrames(
338 StringToBufferQueue("10K 0K", audio_id_, DemuxerStream::AUDIO), 336 StringToBufferQueue("10K 0K", audio_id_, DemuxerStream::AUDIO),
339 empty_queue_, 337 empty_queue_, empty_text_buffers_, append_window_start_,
340 empty_text_buffers_, 338 append_window_end_, &timestamp_offset_));
341 append_window_start_, append_window_end_, 339 EXPECT_FALSE(in_coded_frame_group());
342 &new_media_segment_, &timestamp_offset_));
343 EXPECT_TRUE(new_media_segment_);
344 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 340 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
345 CheckExpectedRangesByTimestamp(audio_.get(), "{ }"); 341 CheckExpectedRangesByTimestamp(audio_.get(), "{ }");
346 CheckReadStalls(audio_.get()); 342 CheckReadStalls(audio_.get());
347 } 343 }
348 344
349 TEST_P(FrameProcessorTest, AudioOnly_SingleFrame) { 345 TEST_P(FrameProcessorTest, AudioOnly_SingleFrame) {
350 // Tests A: P(A) -> (a) 346 // Tests A: P(A) -> (a)
351 InSequence s; 347 InSequence s;
352 AddTestTracks(HAS_AUDIO); 348 AddTestTracks(HAS_AUDIO);
353 new_media_segment_ = true;
354 if (GetParam()) 349 if (GetParam())
355 frame_processor_->SetSequenceMode(true); 350 frame_processor_->SetSequenceMode(true);
356 351
357 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_)); 352 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_));
358 ProcessFrames("0K", ""); 353 ProcessFrames("0K", "");
359 EXPECT_FALSE(new_media_segment_); 354 EXPECT_TRUE(in_coded_frame_group());
360 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 355 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
361 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,10) }"); 356 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,10) }");
362 CheckReadsThenReadStalls(audio_.get(), "0"); 357 CheckReadsThenReadStalls(audio_.get(), "0");
363 } 358 }
364 359
365 TEST_P(FrameProcessorTest, VideoOnly_SingleFrame) { 360 TEST_P(FrameProcessorTest, VideoOnly_SingleFrame) {
366 // Tests V: P(V) -> (v) 361 // Tests V: P(V) -> (v)
367 InSequence s; 362 InSequence s;
368 AddTestTracks(HAS_VIDEO); 363 AddTestTracks(HAS_VIDEO);
369 new_media_segment_ = true;
370 if (GetParam()) 364 if (GetParam())
371 frame_processor_->SetSequenceMode(true); 365 frame_processor_->SetSequenceMode(true);
372 366
373 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_)); 367 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_));
374 ProcessFrames("", "0K"); 368 ProcessFrames("", "0K");
375 EXPECT_FALSE(new_media_segment_); 369 EXPECT_TRUE(in_coded_frame_group());
376 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 370 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
377 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,10) }"); 371 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,10) }");
378 CheckReadsThenReadStalls(video_.get(), "0"); 372 CheckReadsThenReadStalls(video_.get(), "0");
379 } 373 }
380 374
381 TEST_P(FrameProcessorTest, AudioOnly_TwoFrames) { 375 TEST_P(FrameProcessorTest, AudioOnly_TwoFrames) {
382 // Tests A: P(A0, A10) -> (a0, a10) 376 // Tests A: P(A0, A10) -> (a0, a10)
383 InSequence s; 377 InSequence s;
384 AddTestTracks(HAS_AUDIO); 378 AddTestTracks(HAS_AUDIO);
385 new_media_segment_ = true;
386 if (GetParam()) 379 if (GetParam())
387 frame_processor_->SetSequenceMode(true); 380 frame_processor_->SetSequenceMode(true);
388 381
389 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2)); 382 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2));
390 ProcessFrames("0K 10K", ""); 383 ProcessFrames("0K 10K", "");
391 EXPECT_FALSE(new_media_segment_); 384 EXPECT_TRUE(in_coded_frame_group());
392 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 385 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
393 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }"); 386 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }");
394 CheckReadsThenReadStalls(audio_.get(), "0 10"); 387 CheckReadsThenReadStalls(audio_.get(), "0 10");
395 } 388 }
396 389
397 TEST_P(FrameProcessorTest, AudioOnly_SetOffsetThenSingleFrame) { 390 TEST_P(FrameProcessorTest, AudioOnly_SetOffsetThenSingleFrame) {
398 // Tests A: STSO(50)+P(A0) -> TSO==50,(a0@50) 391 // Tests A: STSO(50)+P(A0) -> TSO==50,(a0@50)
399 InSequence s; 392 InSequence s;
400 AddTestTracks(HAS_AUDIO); 393 AddTestTracks(HAS_AUDIO);
401 new_media_segment_ = true;
402 if (GetParam()) 394 if (GetParam())
403 frame_processor_->SetSequenceMode(true); 395 frame_processor_->SetSequenceMode(true);
404 396
405 const base::TimeDelta fifty_ms = base::TimeDelta::FromMilliseconds(50); 397 const base::TimeDelta fifty_ms = base::TimeDelta::FromMilliseconds(50);
406 SetTimestampOffset(fifty_ms); 398 SetTimestampOffset(fifty_ms);
407 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ + fifty_ms)); 399 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ + fifty_ms));
408 ProcessFrames("0K", ""); 400 ProcessFrames("0K", "");
409 EXPECT_FALSE(new_media_segment_); 401 EXPECT_TRUE(in_coded_frame_group());
410 EXPECT_EQ(fifty_ms, timestamp_offset_); 402 EXPECT_EQ(fifty_ms, timestamp_offset_);
411 CheckExpectedRangesByTimestamp(audio_.get(), "{ [50,60) }"); 403 CheckExpectedRangesByTimestamp(audio_.get(), "{ [50,60) }");
412 404
413 // We do not stall on reading without seeking to 50ms due to 405 // We do not stall on reading without seeking to 50ms due to
414 // SourceBufferStream::kSeekToStartFudgeRoom(). 406 // SourceBufferStream::kSeekToStartFudgeRoom().
415 CheckReadsThenReadStalls(audio_.get(), "50:0"); 407 CheckReadsThenReadStalls(audio_.get(), "50:0");
416 } 408 }
417 409
418 TEST_P(FrameProcessorTest, AudioOnly_SetOffsetThenFrameTimestampBelowOffset) { 410 TEST_P(FrameProcessorTest, AudioOnly_SetOffsetThenFrameTimestampBelowOffset) {
419 // Tests A: STSO(50)+P(A20) -> 411 // Tests A: STSO(50)+P(A20) ->
420 // if sequence mode: TSO==30,(a20@50) 412 // if sequence mode: TSO==30,(a20@50)
421 // if segments mode: TSO==50,(a20@70) 413 // if segments mode: TSO==50,(a20@70)
422 InSequence s; 414 InSequence s;
423 AddTestTracks(HAS_AUDIO); 415 AddTestTracks(HAS_AUDIO);
424 new_media_segment_ = true;
425 bool using_sequence_mode = GetParam(); 416 bool using_sequence_mode = GetParam();
426 if (using_sequence_mode) 417 if (using_sequence_mode)
427 frame_processor_->SetSequenceMode(true); 418 frame_processor_->SetSequenceMode(true);
428 419
429 const base::TimeDelta fifty_ms = base::TimeDelta::FromMilliseconds(50); 420 const base::TimeDelta fifty_ms = base::TimeDelta::FromMilliseconds(50);
430 const base::TimeDelta twenty_ms = base::TimeDelta::FromMilliseconds(20); 421 const base::TimeDelta twenty_ms = base::TimeDelta::FromMilliseconds(20);
431 SetTimestampOffset(fifty_ms); 422 SetTimestampOffset(fifty_ms);
432 423
433 if (using_sequence_mode) { 424 if (using_sequence_mode) {
434 EXPECT_CALL(callbacks_, PossibleDurationIncrease( 425 EXPECT_CALL(callbacks_, PossibleDurationIncrease(
435 fifty_ms + frame_duration_)); 426 fifty_ms + frame_duration_));
436 } else { 427 } else {
437 EXPECT_CALL(callbacks_, PossibleDurationIncrease( 428 EXPECT_CALL(callbacks_, PossibleDurationIncrease(
438 fifty_ms + twenty_ms + frame_duration_)); 429 fifty_ms + twenty_ms + frame_duration_));
439 } 430 }
440 431
441 ProcessFrames("20K", ""); 432 ProcessFrames("20K", "");
442 EXPECT_FALSE(new_media_segment_); 433 EXPECT_TRUE(in_coded_frame_group());
443 434
444 // We do not stall on reading without seeking to 50ms / 70ms due to 435 // We do not stall on reading without seeking to 50ms / 70ms due to
445 // SourceBufferStream::kSeekToStartFudgeRoom(). 436 // SourceBufferStream::kSeekToStartFudgeRoom().
446 if (using_sequence_mode) { 437 if (using_sequence_mode) {
447 EXPECT_EQ(fifty_ms - twenty_ms, timestamp_offset_); 438 EXPECT_EQ(fifty_ms - twenty_ms, timestamp_offset_);
448 CheckExpectedRangesByTimestamp(audio_.get(), "{ [50,60) }"); 439 CheckExpectedRangesByTimestamp(audio_.get(), "{ [50,60) }");
449 CheckReadsThenReadStalls(audio_.get(), "50:20"); 440 CheckReadsThenReadStalls(audio_.get(), "50:20");
450 } else { 441 } else {
451 EXPECT_EQ(fifty_ms, timestamp_offset_); 442 EXPECT_EQ(fifty_ms, timestamp_offset_);
452 CheckExpectedRangesByTimestamp(audio_.get(), "{ [70,80) }"); 443 CheckExpectedRangesByTimestamp(audio_.get(), "{ [70,80) }");
453 CheckReadsThenReadStalls(audio_.get(), "70:20"); 444 CheckReadsThenReadStalls(audio_.get(), "70:20");
454 } 445 }
455 } 446 }
456 447
457 TEST_P(FrameProcessorTest, AudioOnly_SequentialProcessFrames) { 448 TEST_P(FrameProcessorTest, AudioOnly_SequentialProcessFrames) {
458 // Tests A: P(A0,A10)+P(A20,A30) -> (a0,a10,a20,a30) 449 // Tests A: P(A0,A10)+P(A20,A30) -> (a0,a10,a20,a30)
459 InSequence s; 450 InSequence s;
460 AddTestTracks(HAS_AUDIO); 451 AddTestTracks(HAS_AUDIO);
461 new_media_segment_ = true;
462 if (GetParam()) 452 if (GetParam())
463 frame_processor_->SetSequenceMode(true); 453 frame_processor_->SetSequenceMode(true);
464 454
465 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2)); 455 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2));
466 ProcessFrames("0K 10K", ""); 456 ProcessFrames("0K 10K", "");
467 EXPECT_FALSE(new_media_segment_); 457 EXPECT_TRUE(in_coded_frame_group());
468 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 458 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
469 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }"); 459 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }");
470 460
471 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 4)); 461 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 4));
472 ProcessFrames("20K 30K", ""); 462 ProcessFrames("20K 30K", "");
473 EXPECT_FALSE(new_media_segment_); 463 EXPECT_TRUE(in_coded_frame_group());
474 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 464 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
475 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,40) }"); 465 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,40) }");
476 466
477 CheckReadsThenReadStalls(audio_.get(), "0 10 20 30"); 467 CheckReadsThenReadStalls(audio_.get(), "0 10 20 30");
478 } 468 }
479 469
480 TEST_P(FrameProcessorTest, AudioOnly_NonSequentialProcessFrames) { 470 TEST_P(FrameProcessorTest, AudioOnly_NonSequentialProcessFrames) {
481 // Tests A: P(A20,A30)+P(A0,A10) -> 471 // Tests A: P(A20,A30)+P(A0,A10) ->
482 // if sequence mode: TSO==-20 after first P(), 20 after second P(), and 472 // if sequence mode: TSO==-20 after first P(), 20 after second P(), and
483 // a(20@0,a30@10,a0@20,a10@30) 473 // a(20@0,a30@10,a0@20,a10@30)
484 // if segments mode: TSO==0,(a0,a10,a20,a30) 474 // if segments mode: TSO==0,(a0,a10,a20,a30)
485 InSequence s; 475 InSequence s;
486 AddTestTracks(HAS_AUDIO); 476 AddTestTracks(HAS_AUDIO);
487 new_media_segment_ = true;
488 bool using_sequence_mode = GetParam(); 477 bool using_sequence_mode = GetParam();
489 if (using_sequence_mode) { 478 if (using_sequence_mode) {
490 frame_processor_->SetSequenceMode(true); 479 frame_processor_->SetSequenceMode(true);
491 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2)); 480 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2));
492 } else { 481 } else {
493 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 4)); 482 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 4));
494 } 483 }
495 484
496 ProcessFrames("20K 30K", ""); 485 ProcessFrames("20K 30K", "");
497 EXPECT_FALSE(new_media_segment_); 486 EXPECT_TRUE(in_coded_frame_group());
498 487
499 if (using_sequence_mode) { 488 if (using_sequence_mode) {
500 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }"); 489 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }");
501 EXPECT_EQ(frame_duration_ * -2, timestamp_offset_); 490 EXPECT_EQ(frame_duration_ * -2, timestamp_offset_);
502 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 4)); 491 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 4));
503 } else { 492 } else {
504 CheckExpectedRangesByTimestamp(audio_.get(), "{ [20,40) }"); 493 CheckExpectedRangesByTimestamp(audio_.get(), "{ [20,40) }");
505 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 494 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
506 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2)); 495 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2));
507 } 496 }
508 497
509 ProcessFrames("0K 10K", ""); 498 ProcessFrames("0K 10K", "");
510 EXPECT_FALSE(new_media_segment_); 499 EXPECT_TRUE(in_coded_frame_group());
511 500
512 if (using_sequence_mode) { 501 if (using_sequence_mode) {
513 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,40) }"); 502 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,40) }");
514 EXPECT_EQ(frame_duration_ * 2, timestamp_offset_); 503 EXPECT_EQ(frame_duration_ * 2, timestamp_offset_);
515 CheckReadsThenReadStalls(audio_.get(), "0:20 10:30 20:0 30:10"); 504 CheckReadsThenReadStalls(audio_.get(), "0:20 10:30 20:0 30:10");
516 } else { 505 } else {
517 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,40) }"); 506 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,40) }");
518 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 507 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
519 // TODO(wolenetz): Fix this need to seek to 0ms, possibly by having 508 // TODO(wolenetz): Fix this need to seek to 0ms, possibly by having
520 // SourceBufferStream defer initial seek until next read. See 509 // SourceBufferStream defer initial seek until next read. See
521 // http://crbug.com/371493. 510 // http://crbug.com/371493.
522 audio_->AbortReads(); 511 audio_->AbortReads();
523 audio_->Seek(base::TimeDelta()); 512 audio_->Seek(base::TimeDelta());
524 audio_->StartReturningData(); 513 audio_->StartReturningData();
525 CheckReadsThenReadStalls(audio_.get(), "0 10 20 30"); 514 CheckReadsThenReadStalls(audio_.get(), "0 10 20 30");
526 } 515 }
527 } 516 }
528 517
529 TEST_P(FrameProcessorTest, AudioVideo_SequentialProcessFrames) { 518 TEST_P(FrameProcessorTest, AudioVideo_SequentialProcessFrames) {
530 // Tests AV: P(A0,A10;V0k,V10,V20)+P(A20,A30,A40,V30) -> 519 // Tests AV: P(A0,A10;V0k,V10,V20)+P(A20,A30,A40,V30) ->
531 // (a0,a10,a20,a30,a40);(v0,v10,v20,v30) 520 // (a0,a10,a20,a30,a40);(v0,v10,v20,v30)
532 InSequence s; 521 InSequence s;
533 AddTestTracks(HAS_AUDIO | HAS_VIDEO); 522 AddTestTracks(HAS_AUDIO | HAS_VIDEO);
534 new_media_segment_ = true;
535 if (GetParam()) 523 if (GetParam())
536 frame_processor_->SetSequenceMode(true); 524 frame_processor_->SetSequenceMode(true);
537 525
538 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 3)); 526 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 3));
539 ProcessFrames("0K 10K", "0K 10 20"); 527 ProcessFrames("0K 10K", "0K 10 20");
540 EXPECT_FALSE(new_media_segment_); 528 EXPECT_TRUE(in_coded_frame_group());
541 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 529 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
542 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }"); 530 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }");
543 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,30) }"); 531 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,30) }");
544 532
545 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 5)); 533 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 5));
546 ProcessFrames("20K 30K 40K", "30"); 534 ProcessFrames("20K 30K 40K", "30");
547 EXPECT_FALSE(new_media_segment_); 535 EXPECT_TRUE(in_coded_frame_group());
548 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 536 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
549 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,50) }"); 537 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,50) }");
550 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,40) }"); 538 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,40) }");
551 539
552 CheckReadsThenReadStalls(audio_.get(), "0 10 20 30 40"); 540 CheckReadsThenReadStalls(audio_.get(), "0 10 20 30 40");
553 CheckReadsThenReadStalls(video_.get(), "0 10 20 30"); 541 CheckReadsThenReadStalls(video_.get(), "0 10 20 30");
554 } 542 }
555 543
556 TEST_P(FrameProcessorTest, AudioVideo_Discontinuity) { 544 TEST_P(FrameProcessorTest, AudioVideo_Discontinuity) {
557 // Tests AV: P(A0,A10,A30,A40,A50;V0k,V10,V40,V50key) -> 545 // Tests AV: P(A0,A10,A30,A40,A50;V0k,V10,V40,V50key) ->
558 // if sequence mode: TSO==10,(a0,a10,a30,a40,a50@60);(v0,v10,v50@60) 546 // if sequence mode: TSO==10,(a0,a10,a30,a40,a50@60);(v0,v10,v50@60)
559 // if segments mode: TSO==0,(a0,a10,a30,a40,a50);(v0,v10,v50) 547 // if segments mode: TSO==0,(a0,a10,a30,a40,a50);(v0,v10,v50)
560 // This assumes A40K is processed before V40, which depends currently on 548 // This assumes A40K is processed before V40, which depends currently on
561 // MergeBufferQueues() behavior. 549 // MergeBufferQueues() behavior.
562 InSequence s; 550 InSequence s;
563 AddTestTracks(HAS_AUDIO | HAS_VIDEO); 551 AddTestTracks(HAS_AUDIO | HAS_VIDEO);
564 new_media_segment_ = true;
565 bool using_sequence_mode = GetParam(); 552 bool using_sequence_mode = GetParam();
566 if (using_sequence_mode) { 553 if (using_sequence_mode) {
567 frame_processor_->SetSequenceMode(true); 554 frame_processor_->SetSequenceMode(true);
568 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 7)); 555 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 7));
569 } else { 556 } else {
570 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 6)); 557 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 6));
571 } 558 }
572 559
573 ProcessFrames("0K 10K 30K 40K 50K", "0K 10 40 50K"); 560 ProcessFrames("0K 10K 30K 40K 50K", "0K 10 40 50K");
574 EXPECT_FALSE(new_media_segment_); 561 EXPECT_TRUE(in_coded_frame_group());
575 562
576 if (using_sequence_mode) { 563 if (using_sequence_mode) {
577 EXPECT_EQ(frame_duration_, timestamp_offset_); 564 EXPECT_EQ(frame_duration_, timestamp_offset_);
578 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,70) }"); 565 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,70) }");
579 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,70) }"); 566 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,70) }");
580 CheckReadsThenReadStalls(audio_.get(), "0 10 30 40 60:50"); 567 CheckReadsThenReadStalls(audio_.get(), "0 10 30 40 60:50");
581 CheckReadsThenReadStalls(video_.get(), "0 10 60:50"); 568 CheckReadsThenReadStalls(video_.get(), "0 10 60:50");
582 } else { 569 } else {
583 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 570 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
584 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,60) }"); 571 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,60) }");
585 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,20) [50,60) }"); 572 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,20) [50,60) }");
586 CheckReadsThenReadStalls(audio_.get(), "0 10 30 40 50"); 573 CheckReadsThenReadStalls(audio_.get(), "0 10 30 40 50");
587 CheckReadsThenReadStalls(video_.get(), "0 10"); 574 CheckReadsThenReadStalls(video_.get(), "0 10");
588 video_->AbortReads(); 575 video_->AbortReads();
589 video_->Seek(frame_duration_ * 5); 576 video_->Seek(frame_duration_ * 5);
590 video_->StartReturningData(); 577 video_->StartReturningData();
591 CheckReadsThenReadStalls(video_.get(), "50"); 578 CheckReadsThenReadStalls(video_.get(), "50");
592 } 579 }
593 } 580 }
594 581
595 TEST_P(FrameProcessorTest, 582 TEST_P(FrameProcessorTest,
596 AppendWindowFilterOfNegativeBufferTimestampsWithPrerollDiscard) { 583 AppendWindowFilterOfNegativeBufferTimestampsWithPrerollDiscard) {
597 InSequence s; 584 InSequence s;
598 AddTestTracks(HAS_AUDIO); 585 AddTestTracks(HAS_AUDIO);
599 new_media_segment_ = true;
600 if (GetParam()) 586 if (GetParam())
601 frame_processor_->SetSequenceMode(true); 587 frame_processor_->SetSequenceMode(true);
602 588
603 SetTimestampOffset(frame_duration_ * -2); 589 SetTimestampOffset(frame_duration_ * -2);
604 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_)); 590 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_));
605 ProcessFrames("0K 10K 20K", ""); 591 ProcessFrames("0K 10K 20K", "");
606 EXPECT_FALSE(new_media_segment_); 592 EXPECT_TRUE(in_coded_frame_group());
607 EXPECT_EQ(frame_duration_ * -2, timestamp_offset_); 593 EXPECT_EQ(frame_duration_ * -2, timestamp_offset_);
608 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,10) }"); 594 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,10) }");
609 CheckReadsThenReadStalls(audio_.get(), "0:10P 0:20"); 595 CheckReadsThenReadStalls(audio_.get(), "0:10P 0:20");
610 } 596 }
611 597
612 TEST_P(FrameProcessorTest, AppendWindowFilterWithInexactPreroll) { 598 TEST_P(FrameProcessorTest, AppendWindowFilterWithInexactPreroll) {
613 InSequence s; 599 InSequence s;
614 AddTestTracks(HAS_AUDIO); 600 AddTestTracks(HAS_AUDIO);
615 new_media_segment_ = true;
616 if (GetParam()) 601 if (GetParam())
617 frame_processor_->SetSequenceMode(true); 602 frame_processor_->SetSequenceMode(true);
618 SetTimestampOffset(-frame_duration_); 603 SetTimestampOffset(-frame_duration_);
619 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2)); 604 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2));
620 ProcessFrames("0K 9.75K 20K", ""); 605 ProcessFrames("0K 9.75K 20K", "");
621 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }"); 606 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }");
622 CheckReadsThenReadStalls(audio_.get(), "0P 0:9.75 10:20"); 607 CheckReadsThenReadStalls(audio_.get(), "0P 0:9.75 10:20");
623 } 608 }
624 609
625 TEST_P(FrameProcessorTest, AppendWindowFilterWithInexactPreroll_2) { 610 TEST_P(FrameProcessorTest, AppendWindowFilterWithInexactPreroll_2) {
626 InSequence s; 611 InSequence s;
627 AddTestTracks(HAS_AUDIO); 612 AddTestTracks(HAS_AUDIO);
628 new_media_segment_ = true;
629 if (GetParam()) 613 if (GetParam())
630 frame_processor_->SetSequenceMode(true); 614 frame_processor_->SetSequenceMode(true);
631 SetTimestampOffset(-frame_duration_); 615 SetTimestampOffset(-frame_duration_);
632 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2)); 616 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2));
633 ProcessFrames("0K 10.25K 20K", ""); 617 ProcessFrames("0K 10.25K 20K", "");
634 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }"); 618 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }");
635 CheckReadsThenReadStalls(audio_.get(), "0P 0:10.25 10:20"); 619 CheckReadsThenReadStalls(audio_.get(), "0P 0:10.25 10:20");
636 } 620 }
637 621
638 TEST_P(FrameProcessorTest, AllowNegativeFramePTSAndDTSBeforeOffsetAdjustment) { 622 TEST_P(FrameProcessorTest, AllowNegativeFramePTSAndDTSBeforeOffsetAdjustment) {
639 InSequence s; 623 InSequence s;
640 AddTestTracks(HAS_AUDIO); 624 AddTestTracks(HAS_AUDIO);
641 new_media_segment_ = true;
642 bool using_sequence_mode = GetParam(); 625 bool using_sequence_mode = GetParam();
643 if (using_sequence_mode) { 626 if (using_sequence_mode) {
644 frame_processor_->SetSequenceMode(true); 627 frame_processor_->SetSequenceMode(true);
645 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 3)); 628 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 3));
646 } else { 629 } else {
647 EXPECT_CALL(callbacks_, 630 EXPECT_CALL(callbacks_,
648 PossibleDurationIncrease((frame_duration_ * 5) / 2)); 631 PossibleDurationIncrease((frame_duration_ * 5) / 2));
649 } 632 }
650 633
651 ProcessFrames("-5K 5K 15K", ""); 634 ProcessFrames("-5K 5K 15K", "");
652 635
653 if (using_sequence_mode) { 636 if (using_sequence_mode) {
654 EXPECT_EQ(frame_duration_ / 2, timestamp_offset_); 637 EXPECT_EQ(frame_duration_ / 2, timestamp_offset_);
655 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,30) }"); 638 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,30) }");
656 CheckReadsThenReadStalls(audio_.get(), "0:-5 10:5 20:15"); 639 CheckReadsThenReadStalls(audio_.get(), "0:-5 10:5 20:15");
657 } else { 640 } else {
658 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 641 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
659 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,25) }"); 642 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,25) }");
660 CheckReadsThenReadStalls(audio_.get(), "0:-5 5 15"); 643 CheckReadsThenReadStalls(audio_.get(), "0:-5 5 15");
661 } 644 }
662 } 645 }
663 646
664 TEST_P(FrameProcessorTest, PartialAppendWindowFilterNoDiscontinuity) { 647 TEST_P(FrameProcessorTest, PartialAppendWindowFilterNoDiscontinuity) {
665 // Tests that spurious discontinuity is not introduced by a partially 648 // Tests that spurious discontinuity is not introduced by a partially
666 // trimmed frame. 649 // trimmed frame.
667 InSequence s; 650 InSequence s;
668 AddTestTracks(HAS_AUDIO); 651 AddTestTracks(HAS_AUDIO);
669 new_media_segment_ = true;
670 if (GetParam()) 652 if (GetParam())
671 frame_processor_->SetSequenceMode(true); 653 frame_processor_->SetSequenceMode(true);
672 EXPECT_CALL(callbacks_, 654 EXPECT_CALL(callbacks_,
673 PossibleDurationIncrease(base::TimeDelta::FromMilliseconds(29))); 655 PossibleDurationIncrease(base::TimeDelta::FromMilliseconds(29)));
674 656
675 append_window_start_ = base::TimeDelta::FromMilliseconds(7); 657 append_window_start_ = base::TimeDelta::FromMilliseconds(7);
676 ProcessFrames("0K 19K", ""); 658 ProcessFrames("0K 19K", "");
677 659
678 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 660 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
679 CheckExpectedRangesByTimestamp(audio_.get(), "{ [7,29) }"); 661 CheckExpectedRangesByTimestamp(audio_.get(), "{ [7,29) }");
680 CheckReadsThenReadStalls(audio_.get(), "7:0 19"); 662 CheckReadsThenReadStalls(audio_.get(), "7:0 19");
681 } 663 }
682 664
683 TEST_P(FrameProcessorTest, 665 TEST_P(FrameProcessorTest,
684 PartialAppendWindowFilterNoDiscontinuity_DtsAfterPts) { 666 PartialAppendWindowFilterNoDiscontinuity_DtsAfterPts) {
685 // Tests that spurious discontinuity is not introduced by a partially trimmed 667 // Tests that spurious discontinuity is not introduced by a partially trimmed
686 // frame that originally had DTS > PTS. 668 // frame that originally had DTS > PTS.
687 InSequence s; 669 InSequence s;
688 AddTestTracks(HAS_AUDIO); 670 AddTestTracks(HAS_AUDIO);
689 new_media_segment_ = true;
690 bool using_sequence_mode = GetParam(); 671 bool using_sequence_mode = GetParam();
691 if (using_sequence_mode) { 672 if (using_sequence_mode) {
692 frame_processor_->SetSequenceMode(true); 673 frame_processor_->SetSequenceMode(true);
693 EXPECT_CALL(callbacks_, PossibleDurationIncrease( 674 EXPECT_CALL(callbacks_, PossibleDurationIncrease(
694 base::TimeDelta::FromMilliseconds(20))); 675 base::TimeDelta::FromMilliseconds(20)));
695 } else { 676 } else {
696 EXPECT_CALL(callbacks_, PossibleDurationIncrease( 677 EXPECT_CALL(callbacks_, PossibleDurationIncrease(
697 base::TimeDelta::FromMilliseconds(13))); 678 base::TimeDelta::FromMilliseconds(13)));
698 } 679 }
699 680
(...skipping 18 matching lines...) Expand all
718 } 699 }
719 } 700 }
720 701
721 TEST_P(FrameProcessorTest, PartialAppendWindowFilterNoNewMediaSegment) { 702 TEST_P(FrameProcessorTest, PartialAppendWindowFilterNoNewMediaSegment) {
722 // Tests that a new media segment is not forcibly signalled for audio frame 703 // Tests that a new media segment is not forcibly signalled for audio frame
723 // partial front trim, to prevent incorrect introduction of a discontinuity 704 // partial front trim, to prevent incorrect introduction of a discontinuity
724 // and potentially a non-keyframe video frame to be processed next after the 705 // and potentially a non-keyframe video frame to be processed next after the
725 // discontinuity. 706 // discontinuity.
726 InSequence s; 707 InSequence s;
727 AddTestTracks(HAS_AUDIO | HAS_VIDEO); 708 AddTestTracks(HAS_AUDIO | HAS_VIDEO);
728 new_media_segment_ = true;
729 frame_processor_->SetSequenceMode(GetParam()); 709 frame_processor_->SetSequenceMode(GetParam());
730 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_)); 710 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_));
731 ProcessFrames("", "0K"); 711 ProcessFrames("", "0K");
732 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_)); 712 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_));
733 ProcessFrames("-5K", ""); 713 ProcessFrames("-5K", "");
734 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_* 2)); 714 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_* 2));
735 ProcessFrames("", "10"); 715 ProcessFrames("", "10");
736 716
737 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 717 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
738 EXPECT_FALSE(new_media_segment_); 718 EXPECT_TRUE(in_coded_frame_group());
739 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,5) }"); 719 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,5) }");
740 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,20) }"); 720 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,20) }");
741 CheckReadsThenReadStalls(audio_.get(), "0:-5"); 721 CheckReadsThenReadStalls(audio_.get(), "0:-5");
742 CheckReadsThenReadStalls(video_.get(), "0 10"); 722 CheckReadsThenReadStalls(video_.get(), "0 10");
743 } 723 }
744 724
745 TEST_F(FrameProcessorTest, AudioOnly_SequenceModeContinuityAcrossReset) { 725 TEST_F(FrameProcessorTest, AudioOnly_SequenceModeContinuityAcrossReset) {
746 InSequence s; 726 InSequence s;
747 AddTestTracks(HAS_AUDIO); 727 AddTestTracks(HAS_AUDIO);
748 new_media_segment_ = true;
749 frame_processor_->SetSequenceMode(true); 728 frame_processor_->SetSequenceMode(true);
750 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_)); 729 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_));
751 ProcessFrames("0K", ""); 730 ProcessFrames("0K", "");
752 frame_processor_->Reset(); 731 frame_processor_->Reset();
753 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2)); 732 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2));
754 ProcessFrames("100K", ""); 733 ProcessFrames("100K", "");
755 734
756 EXPECT_EQ(frame_duration_ * -9, timestamp_offset_); 735 EXPECT_EQ(frame_duration_ * -9, timestamp_offset_);
757 EXPECT_FALSE(new_media_segment_); 736 EXPECT_TRUE(in_coded_frame_group());
758 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }"); 737 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }");
759 CheckReadsThenReadStalls(audio_.get(), "0 10:100"); 738 CheckReadsThenReadStalls(audio_.get(), "0 10:100");
760 } 739 }
761 740
762 INSTANTIATE_TEST_CASE_P(SequenceMode, FrameProcessorTest, Values(true)); 741 INSTANTIATE_TEST_CASE_P(SequenceMode, FrameProcessorTest, Values(true));
763 INSTANTIATE_TEST_CASE_P(SegmentsMode, FrameProcessorTest, Values(false)); 742 INSTANTIATE_TEST_CASE_P(SegmentsMode, FrameProcessorTest, Values(false));
764 743
765 } // namespace media 744 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698