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

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: Rebased(noop) + addressed comments from PS12 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
« no previous file with comments | « media/filters/frame_processor.cc ('k') | media/filters/media_source_state.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // TODO(wolenetz): Refactor to instead verify the expected signalling or lack
248 // thereof of new coded frame group by the FrameProcessor. See
249 // https://crbug.com/580613.
250 bool in_coded_frame_group() {
251 return frame_processor_->in_coded_frame_group_;
252 }
253
249 base::MessageLoop message_loop_; 254 base::MessageLoop message_loop_;
250 StrictMock<FrameProcessorTestCallbackHelper> callbacks_; 255 StrictMock<FrameProcessorTestCallbackHelper> callbacks_;
251 256
252 scoped_ptr<FrameProcessor> frame_processor_; 257 scoped_ptr<FrameProcessor> frame_processor_;
253 base::TimeDelta append_window_start_; 258 base::TimeDelta append_window_start_;
254 base::TimeDelta append_window_end_; 259 base::TimeDelta append_window_end_;
255 bool new_media_segment_;
256 base::TimeDelta timestamp_offset_; 260 base::TimeDelta timestamp_offset_;
257 scoped_ptr<ChunkDemuxerStream> audio_; 261 scoped_ptr<ChunkDemuxerStream> audio_;
258 scoped_ptr<ChunkDemuxerStream> video_; 262 scoped_ptr<ChunkDemuxerStream> video_;
259 const TrackId audio_id_; 263 const TrackId audio_id_;
260 const TrackId video_id_; 264 const TrackId video_id_;
261 const base::TimeDelta frame_duration_; // Currently the same for all streams. 265 const base::TimeDelta frame_duration_; // Currently the same for all streams.
262 const BufferQueue empty_queue_; 266 const BufferQueue empty_queue_;
263 const TextBufferQueueMap empty_text_buffers_; 267 const TextBufferQueueMap empty_text_buffers_;
264 268
265 // StoreStatusAndBuffer's most recent result. 269 // StoreStatusAndBuffer's most recent result.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 ASSERT_FALSE(true); 313 ASSERT_FALSE(true);
310 } 314 }
311 } 315 }
312 } 316 }
313 317
314 DISALLOW_COPY_AND_ASSIGN(FrameProcessorTest); 318 DISALLOW_COPY_AND_ASSIGN(FrameProcessorTest);
315 }; 319 };
316 320
317 TEST_F(FrameProcessorTest, WrongTypeInAppendedBuffer) { 321 TEST_F(FrameProcessorTest, WrongTypeInAppendedBuffer) {
318 AddTestTracks(HAS_AUDIO); 322 AddTestTracks(HAS_AUDIO);
319 new_media_segment_ = true; 323 EXPECT_FALSE(in_coded_frame_group());
320 324
321 ASSERT_FALSE(frame_processor_->ProcessFrames( 325 ASSERT_FALSE(frame_processor_->ProcessFrames(
322 StringToBufferQueue("0K", audio_id_, DemuxerStream::VIDEO), 326 StringToBufferQueue("0K", audio_id_, DemuxerStream::VIDEO), empty_queue_,
323 empty_queue_, 327 empty_text_buffers_, append_window_start_, append_window_end_,
324 empty_text_buffers_, 328 &timestamp_offset_));
325 append_window_start_, append_window_end_, 329 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_); 330 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
329 CheckExpectedRangesByTimestamp(audio_.get(), "{ }"); 331 CheckExpectedRangesByTimestamp(audio_.get(), "{ }");
330 CheckReadStalls(audio_.get()); 332 CheckReadStalls(audio_.get());
331 } 333 }
332 334
333 TEST_F(FrameProcessorTest, NonMonotonicallyIncreasingTimestampInOneCall) { 335 TEST_F(FrameProcessorTest, NonMonotonicallyIncreasingTimestampInOneCall) {
334 AddTestTracks(HAS_AUDIO); 336 AddTestTracks(HAS_AUDIO);
335 new_media_segment_ = true;
336 337
337 ASSERT_FALSE(frame_processor_->ProcessFrames( 338 ASSERT_FALSE(frame_processor_->ProcessFrames(
338 StringToBufferQueue("10K 0K", audio_id_, DemuxerStream::AUDIO), 339 StringToBufferQueue("10K 0K", audio_id_, DemuxerStream::AUDIO),
339 empty_queue_, 340 empty_queue_, empty_text_buffers_, append_window_start_,
340 empty_text_buffers_, 341 append_window_end_, &timestamp_offset_));
341 append_window_start_, append_window_end_, 342 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_); 343 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
345 CheckExpectedRangesByTimestamp(audio_.get(), "{ }"); 344 CheckExpectedRangesByTimestamp(audio_.get(), "{ }");
346 CheckReadStalls(audio_.get()); 345 CheckReadStalls(audio_.get());
347 } 346 }
348 347
349 TEST_P(FrameProcessorTest, AudioOnly_SingleFrame) { 348 TEST_P(FrameProcessorTest, AudioOnly_SingleFrame) {
350 // Tests A: P(A) -> (a) 349 // Tests A: P(A) -> (a)
351 InSequence s; 350 InSequence s;
352 AddTestTracks(HAS_AUDIO); 351 AddTestTracks(HAS_AUDIO);
353 new_media_segment_ = true;
354 if (GetParam()) 352 if (GetParam())
355 frame_processor_->SetSequenceMode(true); 353 frame_processor_->SetSequenceMode(true);
356 354
357 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_)); 355 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_));
358 ProcessFrames("0K", ""); 356 ProcessFrames("0K", "");
359 EXPECT_FALSE(new_media_segment_); 357 EXPECT_TRUE(in_coded_frame_group());
360 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 358 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
361 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,10) }"); 359 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,10) }");
362 CheckReadsThenReadStalls(audio_.get(), "0"); 360 CheckReadsThenReadStalls(audio_.get(), "0");
363 } 361 }
364 362
365 TEST_P(FrameProcessorTest, VideoOnly_SingleFrame) { 363 TEST_P(FrameProcessorTest, VideoOnly_SingleFrame) {
366 // Tests V: P(V) -> (v) 364 // Tests V: P(V) -> (v)
367 InSequence s; 365 InSequence s;
368 AddTestTracks(HAS_VIDEO); 366 AddTestTracks(HAS_VIDEO);
369 new_media_segment_ = true;
370 if (GetParam()) 367 if (GetParam())
371 frame_processor_->SetSequenceMode(true); 368 frame_processor_->SetSequenceMode(true);
372 369
373 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_)); 370 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_));
374 ProcessFrames("", "0K"); 371 ProcessFrames("", "0K");
375 EXPECT_FALSE(new_media_segment_); 372 EXPECT_TRUE(in_coded_frame_group());
376 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 373 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
377 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,10) }"); 374 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,10) }");
378 CheckReadsThenReadStalls(video_.get(), "0"); 375 CheckReadsThenReadStalls(video_.get(), "0");
379 } 376 }
380 377
381 TEST_P(FrameProcessorTest, AudioOnly_TwoFrames) { 378 TEST_P(FrameProcessorTest, AudioOnly_TwoFrames) {
382 // Tests A: P(A0, A10) -> (a0, a10) 379 // Tests A: P(A0, A10) -> (a0, a10)
383 InSequence s; 380 InSequence s;
384 AddTestTracks(HAS_AUDIO); 381 AddTestTracks(HAS_AUDIO);
385 new_media_segment_ = true;
386 if (GetParam()) 382 if (GetParam())
387 frame_processor_->SetSequenceMode(true); 383 frame_processor_->SetSequenceMode(true);
388 384
389 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2)); 385 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2));
390 ProcessFrames("0K 10K", ""); 386 ProcessFrames("0K 10K", "");
391 EXPECT_FALSE(new_media_segment_); 387 EXPECT_TRUE(in_coded_frame_group());
392 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 388 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
393 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }"); 389 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }");
394 CheckReadsThenReadStalls(audio_.get(), "0 10"); 390 CheckReadsThenReadStalls(audio_.get(), "0 10");
395 } 391 }
396 392
397 TEST_P(FrameProcessorTest, AudioOnly_SetOffsetThenSingleFrame) { 393 TEST_P(FrameProcessorTest, AudioOnly_SetOffsetThenSingleFrame) {
398 // Tests A: STSO(50)+P(A0) -> TSO==50,(a0@50) 394 // Tests A: STSO(50)+P(A0) -> TSO==50,(a0@50)
399 InSequence s; 395 InSequence s;
400 AddTestTracks(HAS_AUDIO); 396 AddTestTracks(HAS_AUDIO);
401 new_media_segment_ = true;
402 if (GetParam()) 397 if (GetParam())
403 frame_processor_->SetSequenceMode(true); 398 frame_processor_->SetSequenceMode(true);
404 399
405 const base::TimeDelta fifty_ms = base::TimeDelta::FromMilliseconds(50); 400 const base::TimeDelta fifty_ms = base::TimeDelta::FromMilliseconds(50);
406 SetTimestampOffset(fifty_ms); 401 SetTimestampOffset(fifty_ms);
407 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ + fifty_ms)); 402 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ + fifty_ms));
408 ProcessFrames("0K", ""); 403 ProcessFrames("0K", "");
409 EXPECT_FALSE(new_media_segment_); 404 EXPECT_TRUE(in_coded_frame_group());
410 EXPECT_EQ(fifty_ms, timestamp_offset_); 405 EXPECT_EQ(fifty_ms, timestamp_offset_);
411 CheckExpectedRangesByTimestamp(audio_.get(), "{ [50,60) }"); 406 CheckExpectedRangesByTimestamp(audio_.get(), "{ [50,60) }");
412 407
413 // We do not stall on reading without seeking to 50ms due to 408 // We do not stall on reading without seeking to 50ms due to
414 // SourceBufferStream::kSeekToStartFudgeRoom(). 409 // SourceBufferStream::kSeekToStartFudgeRoom().
415 CheckReadsThenReadStalls(audio_.get(), "50:0"); 410 CheckReadsThenReadStalls(audio_.get(), "50:0");
416 } 411 }
417 412
418 TEST_P(FrameProcessorTest, AudioOnly_SetOffsetThenFrameTimestampBelowOffset) { 413 TEST_P(FrameProcessorTest, AudioOnly_SetOffsetThenFrameTimestampBelowOffset) {
419 // Tests A: STSO(50)+P(A20) -> 414 // Tests A: STSO(50)+P(A20) ->
420 // if sequence mode: TSO==30,(a20@50) 415 // if sequence mode: TSO==30,(a20@50)
421 // if segments mode: TSO==50,(a20@70) 416 // if segments mode: TSO==50,(a20@70)
422 InSequence s; 417 InSequence s;
423 AddTestTracks(HAS_AUDIO); 418 AddTestTracks(HAS_AUDIO);
424 new_media_segment_ = true;
425 bool using_sequence_mode = GetParam(); 419 bool using_sequence_mode = GetParam();
426 if (using_sequence_mode) 420 if (using_sequence_mode)
427 frame_processor_->SetSequenceMode(true); 421 frame_processor_->SetSequenceMode(true);
428 422
429 const base::TimeDelta fifty_ms = base::TimeDelta::FromMilliseconds(50); 423 const base::TimeDelta fifty_ms = base::TimeDelta::FromMilliseconds(50);
430 const base::TimeDelta twenty_ms = base::TimeDelta::FromMilliseconds(20); 424 const base::TimeDelta twenty_ms = base::TimeDelta::FromMilliseconds(20);
431 SetTimestampOffset(fifty_ms); 425 SetTimestampOffset(fifty_ms);
432 426
433 if (using_sequence_mode) { 427 if (using_sequence_mode) {
434 EXPECT_CALL(callbacks_, PossibleDurationIncrease( 428 EXPECT_CALL(callbacks_, PossibleDurationIncrease(
435 fifty_ms + frame_duration_)); 429 fifty_ms + frame_duration_));
436 } else { 430 } else {
437 EXPECT_CALL(callbacks_, PossibleDurationIncrease( 431 EXPECT_CALL(callbacks_, PossibleDurationIncrease(
438 fifty_ms + twenty_ms + frame_duration_)); 432 fifty_ms + twenty_ms + frame_duration_));
439 } 433 }
440 434
441 ProcessFrames("20K", ""); 435 ProcessFrames("20K", "");
442 EXPECT_FALSE(new_media_segment_); 436 EXPECT_TRUE(in_coded_frame_group());
443 437
444 // We do not stall on reading without seeking to 50ms / 70ms due to 438 // We do not stall on reading without seeking to 50ms / 70ms due to
445 // SourceBufferStream::kSeekToStartFudgeRoom(). 439 // SourceBufferStream::kSeekToStartFudgeRoom().
446 if (using_sequence_mode) { 440 if (using_sequence_mode) {
447 EXPECT_EQ(fifty_ms - twenty_ms, timestamp_offset_); 441 EXPECT_EQ(fifty_ms - twenty_ms, timestamp_offset_);
448 CheckExpectedRangesByTimestamp(audio_.get(), "{ [50,60) }"); 442 CheckExpectedRangesByTimestamp(audio_.get(), "{ [50,60) }");
449 CheckReadsThenReadStalls(audio_.get(), "50:20"); 443 CheckReadsThenReadStalls(audio_.get(), "50:20");
450 } else { 444 } else {
451 EXPECT_EQ(fifty_ms, timestamp_offset_); 445 EXPECT_EQ(fifty_ms, timestamp_offset_);
452 CheckExpectedRangesByTimestamp(audio_.get(), "{ [70,80) }"); 446 CheckExpectedRangesByTimestamp(audio_.get(), "{ [70,80) }");
453 CheckReadsThenReadStalls(audio_.get(), "70:20"); 447 CheckReadsThenReadStalls(audio_.get(), "70:20");
454 } 448 }
455 } 449 }
456 450
457 TEST_P(FrameProcessorTest, AudioOnly_SequentialProcessFrames) { 451 TEST_P(FrameProcessorTest, AudioOnly_SequentialProcessFrames) {
458 // Tests A: P(A0,A10)+P(A20,A30) -> (a0,a10,a20,a30) 452 // Tests A: P(A0,A10)+P(A20,A30) -> (a0,a10,a20,a30)
459 InSequence s; 453 InSequence s;
460 AddTestTracks(HAS_AUDIO); 454 AddTestTracks(HAS_AUDIO);
461 new_media_segment_ = true;
462 if (GetParam()) 455 if (GetParam())
463 frame_processor_->SetSequenceMode(true); 456 frame_processor_->SetSequenceMode(true);
464 457
465 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2)); 458 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2));
466 ProcessFrames("0K 10K", ""); 459 ProcessFrames("0K 10K", "");
467 EXPECT_FALSE(new_media_segment_); 460 EXPECT_TRUE(in_coded_frame_group());
468 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 461 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
469 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }"); 462 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }");
470 463
471 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 4)); 464 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 4));
472 ProcessFrames("20K 30K", ""); 465 ProcessFrames("20K 30K", "");
473 EXPECT_FALSE(new_media_segment_); 466 EXPECT_TRUE(in_coded_frame_group());
474 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 467 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
475 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,40) }"); 468 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,40) }");
476 469
477 CheckReadsThenReadStalls(audio_.get(), "0 10 20 30"); 470 CheckReadsThenReadStalls(audio_.get(), "0 10 20 30");
478 } 471 }
479 472
480 TEST_P(FrameProcessorTest, AudioOnly_NonSequentialProcessFrames) { 473 TEST_P(FrameProcessorTest, AudioOnly_NonSequentialProcessFrames) {
481 // Tests A: P(A20,A30)+P(A0,A10) -> 474 // Tests A: P(A20,A30)+P(A0,A10) ->
482 // if sequence mode: TSO==-20 after first P(), 20 after second P(), and 475 // if sequence mode: TSO==-20 after first P(), 20 after second P(), and
483 // a(20@0,a30@10,a0@20,a10@30) 476 // a(20@0,a30@10,a0@20,a10@30)
484 // if segments mode: TSO==0,(a0,a10,a20,a30) 477 // if segments mode: TSO==0,(a0,a10,a20,a30)
485 InSequence s; 478 InSequence s;
486 AddTestTracks(HAS_AUDIO); 479 AddTestTracks(HAS_AUDIO);
487 new_media_segment_ = true;
488 bool using_sequence_mode = GetParam(); 480 bool using_sequence_mode = GetParam();
489 if (using_sequence_mode) { 481 if (using_sequence_mode) {
490 frame_processor_->SetSequenceMode(true); 482 frame_processor_->SetSequenceMode(true);
491 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2)); 483 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2));
492 } else { 484 } else {
493 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 4)); 485 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 4));
494 } 486 }
495 487
496 ProcessFrames("20K 30K", ""); 488 ProcessFrames("20K 30K", "");
497 EXPECT_FALSE(new_media_segment_); 489 EXPECT_TRUE(in_coded_frame_group());
498 490
499 if (using_sequence_mode) { 491 if (using_sequence_mode) {
500 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }"); 492 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }");
501 EXPECT_EQ(frame_duration_ * -2, timestamp_offset_); 493 EXPECT_EQ(frame_duration_ * -2, timestamp_offset_);
502 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 4)); 494 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 4));
503 } else { 495 } else {
504 CheckExpectedRangesByTimestamp(audio_.get(), "{ [20,40) }"); 496 CheckExpectedRangesByTimestamp(audio_.get(), "{ [20,40) }");
505 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 497 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
506 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2)); 498 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2));
507 } 499 }
508 500
509 ProcessFrames("0K 10K", ""); 501 ProcessFrames("0K 10K", "");
510 EXPECT_FALSE(new_media_segment_); 502 EXPECT_TRUE(in_coded_frame_group());
511 503
512 if (using_sequence_mode) { 504 if (using_sequence_mode) {
513 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,40) }"); 505 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,40) }");
514 EXPECT_EQ(frame_duration_ * 2, timestamp_offset_); 506 EXPECT_EQ(frame_duration_ * 2, timestamp_offset_);
515 CheckReadsThenReadStalls(audio_.get(), "0:20 10:30 20:0 30:10"); 507 CheckReadsThenReadStalls(audio_.get(), "0:20 10:30 20:0 30:10");
516 } else { 508 } else {
517 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,40) }"); 509 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,40) }");
518 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 510 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
519 // TODO(wolenetz): Fix this need to seek to 0ms, possibly by having 511 // TODO(wolenetz): Fix this need to seek to 0ms, possibly by having
520 // SourceBufferStream defer initial seek until next read. See 512 // SourceBufferStream defer initial seek until next read. See
521 // http://crbug.com/371493. 513 // http://crbug.com/371493.
522 audio_->AbortReads(); 514 audio_->AbortReads();
523 audio_->Seek(base::TimeDelta()); 515 audio_->Seek(base::TimeDelta());
524 audio_->StartReturningData(); 516 audio_->StartReturningData();
525 CheckReadsThenReadStalls(audio_.get(), "0 10 20 30"); 517 CheckReadsThenReadStalls(audio_.get(), "0 10 20 30");
526 } 518 }
527 } 519 }
528 520
529 TEST_P(FrameProcessorTest, AudioVideo_SequentialProcessFrames) { 521 TEST_P(FrameProcessorTest, AudioVideo_SequentialProcessFrames) {
530 // Tests AV: P(A0,A10;V0k,V10,V20)+P(A20,A30,A40,V30) -> 522 // Tests AV: P(A0,A10;V0k,V10,V20)+P(A20,A30,A40,V30) ->
531 // (a0,a10,a20,a30,a40);(v0,v10,v20,v30) 523 // (a0,a10,a20,a30,a40);(v0,v10,v20,v30)
532 InSequence s; 524 InSequence s;
533 AddTestTracks(HAS_AUDIO | HAS_VIDEO); 525 AddTestTracks(HAS_AUDIO | HAS_VIDEO);
534 new_media_segment_ = true;
535 if (GetParam()) 526 if (GetParam())
536 frame_processor_->SetSequenceMode(true); 527 frame_processor_->SetSequenceMode(true);
537 528
538 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 3)); 529 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 3));
539 ProcessFrames("0K 10K", "0K 10 20"); 530 ProcessFrames("0K 10K", "0K 10 20");
540 EXPECT_FALSE(new_media_segment_); 531 EXPECT_TRUE(in_coded_frame_group());
541 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 532 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
542 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }"); 533 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }");
543 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,30) }"); 534 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,30) }");
544 535
545 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 5)); 536 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 5));
546 ProcessFrames("20K 30K 40K", "30"); 537 ProcessFrames("20K 30K 40K", "30");
547 EXPECT_FALSE(new_media_segment_); 538 EXPECT_TRUE(in_coded_frame_group());
548 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 539 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
549 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,50) }"); 540 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,50) }");
550 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,40) }"); 541 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,40) }");
551 542
552 CheckReadsThenReadStalls(audio_.get(), "0 10 20 30 40"); 543 CheckReadsThenReadStalls(audio_.get(), "0 10 20 30 40");
553 CheckReadsThenReadStalls(video_.get(), "0 10 20 30"); 544 CheckReadsThenReadStalls(video_.get(), "0 10 20 30");
554 } 545 }
555 546
556 TEST_P(FrameProcessorTest, AudioVideo_Discontinuity) { 547 TEST_P(FrameProcessorTest, AudioVideo_Discontinuity) {
557 // Tests AV: P(A0,A10,A30,A40,A50;V0k,V10,V40,V50key) -> 548 // 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) 549 // 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) 550 // 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 551 // This assumes A40K is processed before V40, which depends currently on
561 // MergeBufferQueues() behavior. 552 // MergeBufferQueues() behavior.
562 InSequence s; 553 InSequence s;
563 AddTestTracks(HAS_AUDIO | HAS_VIDEO); 554 AddTestTracks(HAS_AUDIO | HAS_VIDEO);
564 new_media_segment_ = true;
565 bool using_sequence_mode = GetParam(); 555 bool using_sequence_mode = GetParam();
566 if (using_sequence_mode) { 556 if (using_sequence_mode) {
567 frame_processor_->SetSequenceMode(true); 557 frame_processor_->SetSequenceMode(true);
568 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 7)); 558 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 7));
569 } else { 559 } else {
570 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 6)); 560 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 6));
571 } 561 }
572 562
573 ProcessFrames("0K 10K 30K 40K 50K", "0K 10 40 50K"); 563 ProcessFrames("0K 10K 30K 40K 50K", "0K 10 40 50K");
574 EXPECT_FALSE(new_media_segment_); 564 EXPECT_TRUE(in_coded_frame_group());
575 565
576 if (using_sequence_mode) { 566 if (using_sequence_mode) {
577 EXPECT_EQ(frame_duration_, timestamp_offset_); 567 EXPECT_EQ(frame_duration_, timestamp_offset_);
578 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,70) }"); 568 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,70) }");
579 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,70) }"); 569 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,70) }");
580 CheckReadsThenReadStalls(audio_.get(), "0 10 30 40 60:50"); 570 CheckReadsThenReadStalls(audio_.get(), "0 10 30 40 60:50");
581 CheckReadsThenReadStalls(video_.get(), "0 10 60:50"); 571 CheckReadsThenReadStalls(video_.get(), "0 10 60:50");
582 } else { 572 } else {
583 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 573 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
584 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,60) }"); 574 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,60) }");
585 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,20) [50,60) }"); 575 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,20) [50,60) }");
586 CheckReadsThenReadStalls(audio_.get(), "0 10 30 40 50"); 576 CheckReadsThenReadStalls(audio_.get(), "0 10 30 40 50");
587 CheckReadsThenReadStalls(video_.get(), "0 10"); 577 CheckReadsThenReadStalls(video_.get(), "0 10");
588 video_->AbortReads(); 578 video_->AbortReads();
589 video_->Seek(frame_duration_ * 5); 579 video_->Seek(frame_duration_ * 5);
590 video_->StartReturningData(); 580 video_->StartReturningData();
591 CheckReadsThenReadStalls(video_.get(), "50"); 581 CheckReadsThenReadStalls(video_.get(), "50");
592 } 582 }
593 } 583 }
594 584
595 TEST_P(FrameProcessorTest, 585 TEST_P(FrameProcessorTest,
596 AppendWindowFilterOfNegativeBufferTimestampsWithPrerollDiscard) { 586 AppendWindowFilterOfNegativeBufferTimestampsWithPrerollDiscard) {
597 InSequence s; 587 InSequence s;
598 AddTestTracks(HAS_AUDIO); 588 AddTestTracks(HAS_AUDIO);
599 new_media_segment_ = true;
600 if (GetParam()) 589 if (GetParam())
601 frame_processor_->SetSequenceMode(true); 590 frame_processor_->SetSequenceMode(true);
602 591
603 SetTimestampOffset(frame_duration_ * -2); 592 SetTimestampOffset(frame_duration_ * -2);
604 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_)); 593 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_));
605 ProcessFrames("0K 10K 20K", ""); 594 ProcessFrames("0K 10K 20K", "");
606 EXPECT_FALSE(new_media_segment_); 595 EXPECT_TRUE(in_coded_frame_group());
607 EXPECT_EQ(frame_duration_ * -2, timestamp_offset_); 596 EXPECT_EQ(frame_duration_ * -2, timestamp_offset_);
608 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,10) }"); 597 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,10) }");
609 CheckReadsThenReadStalls(audio_.get(), "0:10P 0:20"); 598 CheckReadsThenReadStalls(audio_.get(), "0:10P 0:20");
610 } 599 }
611 600
612 TEST_P(FrameProcessorTest, AppendWindowFilterWithInexactPreroll) { 601 TEST_P(FrameProcessorTest, AppendWindowFilterWithInexactPreroll) {
613 InSequence s; 602 InSequence s;
614 AddTestTracks(HAS_AUDIO); 603 AddTestTracks(HAS_AUDIO);
615 new_media_segment_ = true;
616 if (GetParam()) 604 if (GetParam())
617 frame_processor_->SetSequenceMode(true); 605 frame_processor_->SetSequenceMode(true);
618 SetTimestampOffset(-frame_duration_); 606 SetTimestampOffset(-frame_duration_);
619 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2)); 607 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2));
620 ProcessFrames("0K 9.75K 20K", ""); 608 ProcessFrames("0K 9.75K 20K", "");
621 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }"); 609 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }");
622 CheckReadsThenReadStalls(audio_.get(), "0P 0:9.75 10:20"); 610 CheckReadsThenReadStalls(audio_.get(), "0P 0:9.75 10:20");
623 } 611 }
624 612
625 TEST_P(FrameProcessorTest, AppendWindowFilterWithInexactPreroll_2) { 613 TEST_P(FrameProcessorTest, AppendWindowFilterWithInexactPreroll_2) {
626 InSequence s; 614 InSequence s;
627 AddTestTracks(HAS_AUDIO); 615 AddTestTracks(HAS_AUDIO);
628 new_media_segment_ = true;
629 if (GetParam()) 616 if (GetParam())
630 frame_processor_->SetSequenceMode(true); 617 frame_processor_->SetSequenceMode(true);
631 SetTimestampOffset(-frame_duration_); 618 SetTimestampOffset(-frame_duration_);
632 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2)); 619 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2));
633 ProcessFrames("0K 10.25K 20K", ""); 620 ProcessFrames("0K 10.25K 20K", "");
634 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }"); 621 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }");
635 CheckReadsThenReadStalls(audio_.get(), "0P 0:10.25 10:20"); 622 CheckReadsThenReadStalls(audio_.get(), "0P 0:10.25 10:20");
636 } 623 }
637 624
638 TEST_P(FrameProcessorTest, AllowNegativeFramePTSAndDTSBeforeOffsetAdjustment) { 625 TEST_P(FrameProcessorTest, AllowNegativeFramePTSAndDTSBeforeOffsetAdjustment) {
639 InSequence s; 626 InSequence s;
640 AddTestTracks(HAS_AUDIO); 627 AddTestTracks(HAS_AUDIO);
641 new_media_segment_ = true;
642 bool using_sequence_mode = GetParam(); 628 bool using_sequence_mode = GetParam();
643 if (using_sequence_mode) { 629 if (using_sequence_mode) {
644 frame_processor_->SetSequenceMode(true); 630 frame_processor_->SetSequenceMode(true);
645 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 3)); 631 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 3));
646 } else { 632 } else {
647 EXPECT_CALL(callbacks_, 633 EXPECT_CALL(callbacks_,
648 PossibleDurationIncrease((frame_duration_ * 5) / 2)); 634 PossibleDurationIncrease((frame_duration_ * 5) / 2));
649 } 635 }
650 636
651 ProcessFrames("-5K 5K 15K", ""); 637 ProcessFrames("-5K 5K 15K", "");
652 638
653 if (using_sequence_mode) { 639 if (using_sequence_mode) {
654 EXPECT_EQ(frame_duration_ / 2, timestamp_offset_); 640 EXPECT_EQ(frame_duration_ / 2, timestamp_offset_);
655 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,30) }"); 641 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,30) }");
656 CheckReadsThenReadStalls(audio_.get(), "0:-5 10:5 20:15"); 642 CheckReadsThenReadStalls(audio_.get(), "0:-5 10:5 20:15");
657 } else { 643 } else {
658 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 644 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
659 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,25) }"); 645 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,25) }");
660 CheckReadsThenReadStalls(audio_.get(), "0:-5 5 15"); 646 CheckReadsThenReadStalls(audio_.get(), "0:-5 5 15");
661 } 647 }
662 } 648 }
663 649
664 TEST_P(FrameProcessorTest, PartialAppendWindowFilterNoDiscontinuity) { 650 TEST_P(FrameProcessorTest, PartialAppendWindowFilterNoDiscontinuity) {
665 // Tests that spurious discontinuity is not introduced by a partially 651 // Tests that spurious discontinuity is not introduced by a partially
666 // trimmed frame. 652 // trimmed frame.
667 InSequence s; 653 InSequence s;
668 AddTestTracks(HAS_AUDIO); 654 AddTestTracks(HAS_AUDIO);
669 new_media_segment_ = true;
670 if (GetParam()) 655 if (GetParam())
671 frame_processor_->SetSequenceMode(true); 656 frame_processor_->SetSequenceMode(true);
672 EXPECT_CALL(callbacks_, 657 EXPECT_CALL(callbacks_,
673 PossibleDurationIncrease(base::TimeDelta::FromMilliseconds(29))); 658 PossibleDurationIncrease(base::TimeDelta::FromMilliseconds(29)));
674 659
675 append_window_start_ = base::TimeDelta::FromMilliseconds(7); 660 append_window_start_ = base::TimeDelta::FromMilliseconds(7);
676 ProcessFrames("0K 19K", ""); 661 ProcessFrames("0K 19K", "");
677 662
678 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 663 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
679 CheckExpectedRangesByTimestamp(audio_.get(), "{ [7,29) }"); 664 CheckExpectedRangesByTimestamp(audio_.get(), "{ [7,29) }");
680 CheckReadsThenReadStalls(audio_.get(), "7:0 19"); 665 CheckReadsThenReadStalls(audio_.get(), "7:0 19");
681 } 666 }
682 667
683 TEST_P(FrameProcessorTest, 668 TEST_P(FrameProcessorTest,
684 PartialAppendWindowFilterNoDiscontinuity_DtsAfterPts) { 669 PartialAppendWindowFilterNoDiscontinuity_DtsAfterPts) {
685 // Tests that spurious discontinuity is not introduced by a partially trimmed 670 // Tests that spurious discontinuity is not introduced by a partially trimmed
686 // frame that originally had DTS > PTS. 671 // frame that originally had DTS > PTS.
687 InSequence s; 672 InSequence s;
688 AddTestTracks(HAS_AUDIO); 673 AddTestTracks(HAS_AUDIO);
689 new_media_segment_ = true;
690 bool using_sequence_mode = GetParam(); 674 bool using_sequence_mode = GetParam();
691 if (using_sequence_mode) { 675 if (using_sequence_mode) {
692 frame_processor_->SetSequenceMode(true); 676 frame_processor_->SetSequenceMode(true);
693 EXPECT_CALL(callbacks_, PossibleDurationIncrease( 677 EXPECT_CALL(callbacks_, PossibleDurationIncrease(
694 base::TimeDelta::FromMilliseconds(20))); 678 base::TimeDelta::FromMilliseconds(20)));
695 } else { 679 } else {
696 EXPECT_CALL(callbacks_, PossibleDurationIncrease( 680 EXPECT_CALL(callbacks_, PossibleDurationIncrease(
697 base::TimeDelta::FromMilliseconds(13))); 681 base::TimeDelta::FromMilliseconds(13)));
698 } 682 }
699 683
(...skipping 18 matching lines...) Expand all
718 } 702 }
719 } 703 }
720 704
721 TEST_P(FrameProcessorTest, PartialAppendWindowFilterNoNewMediaSegment) { 705 TEST_P(FrameProcessorTest, PartialAppendWindowFilterNoNewMediaSegment) {
722 // Tests that a new media segment is not forcibly signalled for audio frame 706 // Tests that a new media segment is not forcibly signalled for audio frame
723 // partial front trim, to prevent incorrect introduction of a discontinuity 707 // partial front trim, to prevent incorrect introduction of a discontinuity
724 // and potentially a non-keyframe video frame to be processed next after the 708 // and potentially a non-keyframe video frame to be processed next after the
725 // discontinuity. 709 // discontinuity.
726 InSequence s; 710 InSequence s;
727 AddTestTracks(HAS_AUDIO | HAS_VIDEO); 711 AddTestTracks(HAS_AUDIO | HAS_VIDEO);
728 new_media_segment_ = true;
729 frame_processor_->SetSequenceMode(GetParam()); 712 frame_processor_->SetSequenceMode(GetParam());
730 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_)); 713 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_));
731 ProcessFrames("", "0K"); 714 ProcessFrames("", "0K");
732 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_)); 715 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_));
733 ProcessFrames("-5K", ""); 716 ProcessFrames("-5K", "");
734 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_* 2)); 717 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_* 2));
735 ProcessFrames("", "10"); 718 ProcessFrames("", "10");
736 719
737 EXPECT_EQ(base::TimeDelta(), timestamp_offset_); 720 EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
738 EXPECT_FALSE(new_media_segment_); 721 EXPECT_TRUE(in_coded_frame_group());
739 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,5) }"); 722 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,5) }");
740 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,20) }"); 723 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,20) }");
741 CheckReadsThenReadStalls(audio_.get(), "0:-5"); 724 CheckReadsThenReadStalls(audio_.get(), "0:-5");
742 CheckReadsThenReadStalls(video_.get(), "0 10"); 725 CheckReadsThenReadStalls(video_.get(), "0 10");
743 } 726 }
744 727
745 TEST_F(FrameProcessorTest, AudioOnly_SequenceModeContinuityAcrossReset) { 728 TEST_F(FrameProcessorTest, AudioOnly_SequenceModeContinuityAcrossReset) {
746 InSequence s; 729 InSequence s;
747 AddTestTracks(HAS_AUDIO); 730 AddTestTracks(HAS_AUDIO);
748 new_media_segment_ = true;
749 frame_processor_->SetSequenceMode(true); 731 frame_processor_->SetSequenceMode(true);
750 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_)); 732 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_));
751 ProcessFrames("0K", ""); 733 ProcessFrames("0K", "");
752 frame_processor_->Reset(); 734 frame_processor_->Reset();
753 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2)); 735 EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2));
754 ProcessFrames("100K", ""); 736 ProcessFrames("100K", "");
755 737
756 EXPECT_EQ(frame_duration_ * -9, timestamp_offset_); 738 EXPECT_EQ(frame_duration_ * -9, timestamp_offset_);
757 EXPECT_FALSE(new_media_segment_); 739 EXPECT_TRUE(in_coded_frame_group());
758 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }"); 740 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }");
759 CheckReadsThenReadStalls(audio_.get(), "0 10:100"); 741 CheckReadsThenReadStalls(audio_.get(), "0 10:100");
760 } 742 }
761 743
762 INSTANTIATE_TEST_CASE_P(SequenceMode, FrameProcessorTest, Values(true)); 744 INSTANTIATE_TEST_CASE_P(SequenceMode, FrameProcessorTest, Values(true));
763 INSTANTIATE_TEST_CASE_P(SegmentsMode, FrameProcessorTest, Values(false)); 745 INSTANTIATE_TEST_CASE_P(SegmentsMode, FrameProcessorTest, Values(false));
764 746
765 } // namespace media 747 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/frame_processor.cc ('k') | media/filters/media_source_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698