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

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

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