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

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

Issue 10690124: Revert 145965 - Make sure previous seek points in SourceBufferStream are ignored during overlaps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « media/filters/source_buffer_stream.h ('k') | media/filters/source_buffer_stream_unittest.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/filters/source_buffer_stream.h" 5 #include "media/filters/source_buffer_stream.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // filled with a valid buffer, false if there is not enough data to fulfill 88 // filled with a valid buffer, false if there is not enough data to fulfill
89 // the request. 89 // the request.
90 bool GetNextBuffer(scoped_refptr<StreamParserBuffer>* out_buffer); 90 bool GetNextBuffer(scoped_refptr<StreamParserBuffer>* out_buffer);
91 bool HasNextBuffer() const; 91 bool HasNextBuffer() const;
92 92
93 // Returns true if the range knows the position of the next buffer it should 93 // Returns true if the range knows the position of the next buffer it should
94 // return, i.e. it has been Seek()ed. This does not necessarily mean that it 94 // return, i.e. it has been Seek()ed. This does not necessarily mean that it
95 // has the next buffer yet. 95 // has the next buffer yet.
96 bool HasNextBufferPosition() const; 96 bool HasNextBufferPosition() const;
97 97
98 // Resets this range to an "unseeked" state.
99 void ResetNextBufferPosition();
100
101 // Returns the timestamp of the next buffer that will be returned from 98 // Returns the timestamp of the next buffer that will be returned from
102 // GetNextBuffer(), or kNoTimestamp() if the timestamp is unknown. 99 // GetNextBuffer(), or kNoTimestamp() if the timestamp is unknown.
103 base::TimeDelta GetNextTimestamp() const; 100 base::TimeDelta GetNextTimestamp() const;
104 101
105 // Returns the start timestamp of the range. 102 // Returns the start timestamp of the range.
106 base::TimeDelta GetStartTimestamp() const; 103 base::TimeDelta GetStartTimestamp() const;
107 104
108 // Returns the timestamp of the last buffer in the range. 105 // Returns the timestamp of the last buffer in the range.
109 base::TimeDelta GetEndTimestamp() const; 106 base::TimeDelta GetEndTimestamp() const;
110 107
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 ResolveCompleteOverlaps( 316 ResolveCompleteOverlaps(
320 range_for_new_buffers, &deleted_next_buffer, &deleted_buffers); 317 range_for_new_buffers, &deleted_next_buffer, &deleted_buffers);
321 ResolveEndOverlap( 318 ResolveEndOverlap(
322 range_for_new_buffers, &deleted_next_buffer, &deleted_buffers); 319 range_for_new_buffers, &deleted_next_buffer, &deleted_buffers);
323 MergeWithAdjacentRangeIfNecessary(range_for_new_buffers); 320 MergeWithAdjacentRangeIfNecessary(range_for_new_buffers);
324 321
325 // If these were the first buffers appended to the stream, seek to the 322 // If these were the first buffers appended to the stream, seek to the
326 // beginning of the range. 323 // beginning of the range.
327 // TODO(vrk): This should be done by ChunkDemuxer. (crbug.com/132815) 324 // TODO(vrk): This should be done by ChunkDemuxer. (crbug.com/132815)
328 if (!seek_pending_ && !selected_range_) { 325 if (!seek_pending_ && !selected_range_) {
329 SetSelectedRange(*range_for_new_buffers); 326 selected_range_ = *range_for_new_buffers;
330 selected_range_->Seek(buffers.front()->GetDecodeTimestamp()); 327 selected_range_->Seek(buffers.front()->GetDecodeTimestamp());
331 } 328 }
332 329
333 // Seek to try to fulfill a previous call to Seek(). 330 // Seek to try to fulfill a previous call to Seek().
334 if (seek_pending_) { 331 if (seek_pending_) {
335 DCHECK(!selected_range_); 332 DCHECK(!selected_range_);
336 DCHECK(!deleted_next_buffer); 333 DCHECK(!deleted_next_buffer);
337 Seek(seek_buffer_timestamp_); 334 Seek(seek_buffer_timestamp_);
338 } 335 }
339 336
340 // Seek because the Append() has deleted the buffer that would have been 337 // Seek because the Append() has deleted the buffer that would have been
341 // returned in the next call to GetNextBuffer(). 338 // returned in the next call to GetNextBuffer().
342 if (deleted_next_buffer) { 339 if (deleted_next_buffer) {
343 DCHECK(!seek_pending_); 340 DCHECK(!seek_pending_);
344 SetSelectedRange(*range_for_new_buffers); 341 selected_range_ = *range_for_new_buffers;
345 if (!deleted_buffers.empty()) { 342 if (!deleted_buffers.empty()) {
346 // Seek the range to the keyframe at or after |next_buffer_timestamp|. 343 // Seek the range to the keyframe at or after |next_buffer_timestamp|.
347 selected_range_->SeekAheadTo(next_buffer_timestamp); 344 selected_range_->SeekAheadTo(next_buffer_timestamp);
348 UpdateTrackBuffer(deleted_buffers); 345 UpdateTrackBuffer(deleted_buffers);
349 } else { 346 } else {
350 // If we've deleted the next buffer but |deleted_buffers| is empty, 347 // If we've deleted the next buffer but |deleted_buffers| is empty,
351 // that means we need to seek past the timestamp of the last buffer in 348 // that means we need to seek past the timestamp of the last buffer in
352 // the range (i.e. the keyframe timestamp needs to be strictly greater 349 // the range (i.e. the keyframe timestamp needs to be strictly greater
353 // than |end_buffer_timestamp|). 350 // than |end_buffer_timestamp|).
354 selected_range_->SeekAheadPast(end_buffer_timestamp); 351 selected_range_->SeekAheadPast(end_buffer_timestamp);
355 } 352 }
356 } 353 }
357 354
358 DCHECK(IsRangeListSorted(ranges_)); 355 DCHECK(IsRangeListSorted(ranges_));
359 DCHECK(OnlySelectedRangeIsSeeked());
360 return true; 356 return true;
361 } 357 }
362 358
363 bool SourceBufferStream::IsMonotonicallyIncreasing( 359 bool SourceBufferStream::IsMonotonicallyIncreasing(
364 const BufferQueue& buffers) { 360 const BufferQueue& buffers) {
365 DCHECK(!buffers.empty()); 361 DCHECK(!buffers.empty());
366 base::TimeDelta prev_timestamp = last_buffer_timestamp_; 362 base::TimeDelta prev_timestamp = last_buffer_timestamp_;
367 for (BufferQueue::const_iterator itr = buffers.begin(); 363 for (BufferQueue::const_iterator itr = buffers.begin();
368 itr != buffers.end(); ++itr) { 364 itr != buffers.end(); ++itr) {
369 base::TimeDelta current_timestamp = (*itr)->GetDecodeTimestamp(); 365 base::TimeDelta current_timestamp = (*itr)->GetDecodeTimestamp();
370 DCHECK(current_timestamp != kNoTimestamp()); 366 DCHECK(current_timestamp != kNoTimestamp());
371 367
372 if (prev_timestamp != kNoTimestamp() && current_timestamp < prev_timestamp) 368 if (prev_timestamp != kNoTimestamp() && current_timestamp < prev_timestamp)
373 return false; 369 return false;
374 370
375 prev_timestamp = current_timestamp; 371 prev_timestamp = current_timestamp;
376 } 372 }
377 return true; 373 return true;
378 } 374 }
379 375
380 bool SourceBufferStream::OnlySelectedRangeIsSeeked() const {
381 for (RangeList::const_iterator itr = ranges_.begin();
382 itr != ranges_.end(); ++itr) {
383 if ((*itr)->HasNextBufferPosition() && (*itr) != selected_range_)
384 return false;
385 }
386 return !selected_range_ || selected_range_->HasNextBufferPosition();
387 }
388
389 void SourceBufferStream::UpdateMaxInterbufferDistance( 376 void SourceBufferStream::UpdateMaxInterbufferDistance(
390 const BufferQueue& buffers) { 377 const BufferQueue& buffers) {
391 DCHECK(!buffers.empty()); 378 DCHECK(!buffers.empty());
392 base::TimeDelta prev_timestamp = last_buffer_timestamp_; 379 base::TimeDelta prev_timestamp = last_buffer_timestamp_;
393 for (BufferQueue::const_iterator itr = buffers.begin(); 380 for (BufferQueue::const_iterator itr = buffers.begin();
394 itr != buffers.end(); ++itr) { 381 itr != buffers.end(); ++itr) {
395 base::TimeDelta current_timestamp = (*itr)->GetDecodeTimestamp(); 382 base::TimeDelta current_timestamp = (*itr)->GetDecodeTimestamp();
396 DCHECK(current_timestamp != kNoTimestamp()); 383 DCHECK(current_timestamp != kNoTimestamp());
397 384
398 if (prev_timestamp != kNoTimestamp()) { 385 if (prev_timestamp != kNoTimestamp()) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 // of |new_buffers|, and add them into a new range. 417 // of |new_buffers|, and add them into a new range.
431 SourceBufferRange* new_next_range = 418 SourceBufferRange* new_next_range =
432 range_for_new_buffers->SplitRange( 419 range_for_new_buffers->SplitRange(
433 new_buffers.back()->GetDecodeTimestamp()); 420 new_buffers.back()->GetDecodeTimestamp());
434 421
435 if (new_next_range) 422 if (new_next_range)
436 AddToRanges(new_next_range); 423 AddToRanges(new_next_range);
437 424
438 // Delete the buffers that are overlapped by |new_buffers|, then append 425 // Delete the buffers that are overlapped by |new_buffers|, then append
439 // |new_buffers| to the end of the range. 426 // |new_buffers| to the end of the range.
440 BufferQueue saved_buffers; 427 DCHECK(!*deleted_next_buffer);
441 bool deleted_next_buffer_from_range = 428 *deleted_next_buffer =
442 range_for_new_buffers->TruncateAt(new_buffers.front(), &saved_buffers); 429 range_for_new_buffers->TruncateAt(new_buffers.front(), deleted_buffers);
443 range_for_new_buffers->AppendToEnd(new_buffers); 430 range_for_new_buffers->AppendToEnd(new_buffers);
444 431
445 if (selected_range_ != range_for_new_buffers)
446 return;
447
448 DCHECK(!*deleted_next_buffer);
449 *deleted_buffers = saved_buffers;
450 *deleted_next_buffer = deleted_next_buffer_from_range;
451
452 // If this was a middle overlap resulting in a new range, and the next buffer 432 // If this was a middle overlap resulting in a new range, and the next buffer
453 // position has been transferred to the newly created range, update the 433 // position has been transferred to the newly created range, update the
454 // |selected_range_| accordingly. 434 // |selected_range_| accordingly.
455 if (new_next_range && new_next_range->HasNextBufferPosition()) { 435 if (new_next_range && new_next_range->HasNextBufferPosition()) {
456 DCHECK(!range_for_new_buffers->HasNextBufferPosition()); 436 DCHECK(!range_for_new_buffers->HasNextBufferPosition());
457 DCHECK(!*deleted_next_buffer); 437 DCHECK(!*deleted_next_buffer);
458 SetSelectedRange(new_next_range); 438 selected_range_ = new_next_range;
459 } 439 }
460 } 440 }
461 441
462 void SourceBufferStream::ResolveCompleteOverlaps( 442 void SourceBufferStream::ResolveCompleteOverlaps(
463 const RangeList::iterator& range_with_new_buffers_itr, 443 const RangeList::iterator& range_with_new_buffers_itr,
464 bool* deleted_next_buffer, BufferQueue* deleted_buffers) { 444 bool* deleted_next_buffer, BufferQueue* deleted_buffers) {
465 DCHECK(deleted_next_buffer); 445 DCHECK(deleted_next_buffer);
466 DCHECK(deleted_buffers); 446 DCHECK(deleted_buffers);
467 447
468 SourceBufferRange* range_with_new_buffers = *range_with_new_buffers_itr; 448 SourceBufferRange* range_with_new_buffers = *range_with_new_buffers_itr;
469 RangeList::iterator next_range_itr = range_with_new_buffers_itr; 449 RangeList::iterator next_range_itr = range_with_new_buffers_itr;
470 next_range_itr++; 450 next_range_itr++;
471 451
472 while (next_range_itr != ranges_.end() && 452 while (next_range_itr != ranges_.end() &&
473 range_with_new_buffers->CompletelyOverlaps(**next_range_itr)) { 453 range_with_new_buffers->CompletelyOverlaps(**next_range_itr)) {
474 if (*next_range_itr == selected_range_) { 454 if (*next_range_itr == selected_range_) {
455 selected_range_ = NULL;
475 DCHECK(!*deleted_next_buffer); 456 DCHECK(!*deleted_next_buffer);
476 *deleted_next_buffer = selected_range_->DeleteAll(deleted_buffers); 457 *deleted_next_buffer = (*next_range_itr)->DeleteAll(deleted_buffers);
477 DCHECK(*deleted_next_buffer); 458 DCHECK(*deleted_next_buffer);
478 SetSelectedRange(NULL);
479 } 459 }
480 delete *next_range_itr; 460 delete *next_range_itr;
481 next_range_itr = ranges_.erase(next_range_itr); 461 next_range_itr = ranges_.erase(next_range_itr);
482 } 462 }
483 } 463 }
484 464
485 void SourceBufferStream::ResolveEndOverlap( 465 void SourceBufferStream::ResolveEndOverlap(
486 const RangeList::iterator& range_with_new_buffers_itr, 466 const RangeList::iterator& range_with_new_buffers_itr,
487 bool* deleted_next_buffer, BufferQueue* deleted_buffers) { 467 bool* deleted_next_buffer, BufferQueue* deleted_buffers) {
488 DCHECK(deleted_next_buffer); 468 DCHECK(deleted_next_buffer);
(...skipping 23 matching lines...) Expand all
512 AddToRanges(new_next_range); 492 AddToRanges(new_next_range);
513 493
514 // If we didn't overlap a selected range, return. 494 // If we didn't overlap a selected range, return.
515 if (selected_range_ != overlapped_range.get()) 495 if (selected_range_ != overlapped_range.get())
516 return; 496 return;
517 497
518 // If the |overlapped_range| transfers its next buffer position to 498 // If the |overlapped_range| transfers its next buffer position to
519 // |new_next_range|, make |new_next_range| the |selected_range_|. 499 // |new_next_range|, make |new_next_range| the |selected_range_|.
520 if (new_next_range && new_next_range->HasNextBufferPosition()) { 500 if (new_next_range && new_next_range->HasNextBufferPosition()) {
521 DCHECK(!overlapped_range->HasNextBufferPosition()); 501 DCHECK(!overlapped_range->HasNextBufferPosition());
522 SetSelectedRange(new_next_range); 502 selected_range_ = new_next_range;
523 return; 503 return;
524 } 504 }
525 505
526 // Save the buffers in |overlapped_range|. 506 // Save the buffers in |overlapped_range|.
527 DCHECK(!*deleted_next_buffer); 507 DCHECK(!*deleted_next_buffer);
528 DCHECK_EQ(overlapped_range.get(), selected_range_);
529 *deleted_next_buffer = overlapped_range->DeleteAll(deleted_buffers); 508 *deleted_next_buffer = overlapped_range->DeleteAll(deleted_buffers);
530 DCHECK(*deleted_next_buffer); 509 DCHECK(*deleted_next_buffer);
531 } 510 }
532 511
533 void SourceBufferStream::UpdateTrackBuffer(const BufferQueue& deleted_buffers) { 512 void SourceBufferStream::UpdateTrackBuffer(const BufferQueue& deleted_buffers) {
534 DCHECK(!deleted_buffers.empty()); 513 DCHECK(!deleted_buffers.empty());
535 if (!track_buffer_.empty()) 514 if (!track_buffer_.empty())
536 return; 515 return;
537 516
538 DCHECK(selected_range_); 517 DCHECK(selected_range_);
(...skipping 29 matching lines...) Expand all
568 547
569 // See if the next range contains the keyframe after the end of the 548 // See if the next range contains the keyframe after the end of the
570 // |track_buffer_|, and if so, change |selected_range_|. 549 // |track_buffer_|, and if so, change |selected_range_|.
571 RangeList::iterator next_range_itr = ++(GetSelectedRangeItr()); 550 RangeList::iterator next_range_itr = ++(GetSelectedRangeItr());
572 if (next_range_itr != ranges_.end()) { 551 if (next_range_itr != ranges_.end()) {
573 (*next_range_itr)->SeekAheadPast( 552 (*next_range_itr)->SeekAheadPast(
574 track_buffer_.back()->GetDecodeTimestamp()); 553 track_buffer_.back()->GetDecodeTimestamp());
575 if ((*next_range_itr)->HasNextBuffer() && 554 if ((*next_range_itr)->HasNextBuffer() &&
576 selected_range_->IsNextInSequence( 555 selected_range_->IsNextInSequence(
577 track_buffer_.back(), (*next_range_itr)->GetNextTimestamp())) { 556 track_buffer_.back(), (*next_range_itr)->GetNextTimestamp())) {
578 SetSelectedRange(*next_range_itr); 557 selected_range_ = *next_range_itr;
579 } 558 }
580 } 559 }
581 } 560 }
582 561
583 void SourceBufferStream::MergeWithAdjacentRangeIfNecessary( 562 void SourceBufferStream::MergeWithAdjacentRangeIfNecessary(
584 const RangeList::iterator& range_with_new_buffers_itr) { 563 const RangeList::iterator& range_with_new_buffers_itr) {
585 SourceBufferRange* range_with_new_buffers = *range_with_new_buffers_itr; 564 SourceBufferRange* range_with_new_buffers = *range_with_new_buffers_itr;
586 RangeList::iterator next_range_itr = range_with_new_buffers_itr; 565 RangeList::iterator next_range_itr = range_with_new_buffers_itr;
587 next_range_itr++; 566 next_range_itr++;
588 567
589 if (next_range_itr != ranges_.end() && 568 if (next_range_itr != ranges_.end() &&
590 range_with_new_buffers->CanAppendToEnd(**next_range_itr)) { 569 range_with_new_buffers->CanAppendToEnd(**next_range_itr)) {
591 bool transfer_current_position = selected_range_ == *next_range_itr; 570 bool transfer_current_position = selected_range_ == *next_range_itr;
592 range_with_new_buffers->AppendToEnd(**next_range_itr, 571 range_with_new_buffers->AppendToEnd(**next_range_itr,
593 transfer_current_position); 572 transfer_current_position);
594 // Update |selected_range_| pointer if |range| has become selected after 573 // Update |selected_range_| pointer if |range| has become selected after
595 // merges. 574 // merges.
596 if (transfer_current_position) 575 if (transfer_current_position)
597 SetSelectedRange(range_with_new_buffers); 576 selected_range_ = range_with_new_buffers;
598 577
599 delete *next_range_itr; 578 delete *next_range_itr;
600 ranges_.erase(next_range_itr); 579 ranges_.erase(next_range_itr);
601 } 580 }
602 } 581 }
603 582
604 void SourceBufferStream::Seek(base::TimeDelta timestamp) { 583 void SourceBufferStream::Seek(base::TimeDelta timestamp) {
605 SetSelectedRange(NULL); 584 selected_range_ = NULL;
606 track_buffer_.clear(); 585 track_buffer_.clear();
607 586
608 seek_buffer_timestamp_ = timestamp; 587 seek_buffer_timestamp_ = timestamp;
609 seek_pending_ = true; 588 seek_pending_ = true;
610 589
611 RangeList::iterator itr = ranges_.end(); 590 RangeList::iterator itr = ranges_.end();
612 for (itr = ranges_.begin(); itr != ranges_.end(); itr++) { 591 for (itr = ranges_.begin(); itr != ranges_.end(); itr++) {
613 if ((*itr)->CanSeekTo(timestamp)) 592 if ((*itr)->CanSeekTo(timestamp))
614 break; 593 break;
615 } 594 }
616 595
617 if (itr == ranges_.end()) 596 if (itr == ranges_.end())
618 return; 597 return;
619 598
620 SetSelectedRange(*itr); 599 selected_range_ = *itr;
621 selected_range_->Seek(timestamp); 600 selected_range_->Seek(timestamp);
622 seek_pending_ = false; 601 seek_pending_ = false;
623 end_of_stream_ = false; 602 end_of_stream_ = false;
624 } 603 }
625 604
626 bool SourceBufferStream::IsSeekPending() const { 605 bool SourceBufferStream::IsSeekPending() const {
627 return seek_pending_; 606 return seek_pending_;
628 } 607 }
629 608
630 bool SourceBufferStream::GetNextBuffer( 609 bool SourceBufferStream::GetNextBuffer(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 DCHECK(selected_range_); 662 DCHECK(selected_range_);
684 RangeList::iterator itr = ranges_.end(); 663 RangeList::iterator itr = ranges_.end();
685 for (itr = ranges_.begin(); itr != ranges_.end(); itr++) { 664 for (itr = ranges_.begin(); itr != ranges_.end(); itr++) {
686 if (*itr == selected_range_) 665 if (*itr == selected_range_)
687 break; 666 break;
688 } 667 }
689 DCHECK(itr != ranges_.end()); 668 DCHECK(itr != ranges_.end());
690 return itr; 669 return itr;
691 } 670 }
692 671
693 void SourceBufferStream::SetSelectedRange(SourceBufferRange* range) {
694 if (selected_range_)
695 selected_range_->ResetNextBufferPosition();
696 selected_range_ = range;
697 }
698
699 Ranges<base::TimeDelta> SourceBufferStream::GetBufferedTime() const { 672 Ranges<base::TimeDelta> SourceBufferStream::GetBufferedTime() const {
700 Ranges<base::TimeDelta> ranges; 673 Ranges<base::TimeDelta> ranges;
701 for (RangeList::const_iterator itr = ranges_.begin(); 674 for (RangeList::const_iterator itr = ranges_.begin();
702 itr != ranges_.end(); itr++) { 675 itr != ranges_.end(); itr++) {
703 ranges.Add((*itr)->GetStartTimestamp(), (*itr)->GetBufferedEndTimestamp()); 676 ranges.Add((*itr)->GetStartTimestamp(), (*itr)->GetBufferedEndTimestamp());
704 } 677 }
705 return ranges; 678 return ranges;
706 } 679 }
707 680
708 void SourceBufferStream::EndOfStream() { 681 void SourceBufferStream::EndOfStream() {
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 if (next_buffer_index_ >= static_cast<int>(buffers_.size())) 898 if (next_buffer_index_ >= static_cast<int>(buffers_.size()))
926 return kNoTimestamp(); 899 return kNoTimestamp();
927 900
928 return buffers_.at(next_buffer_index_)->GetDecodeTimestamp(); 901 return buffers_.at(next_buffer_index_)->GetDecodeTimestamp();
929 } 902 }
930 903
931 bool SourceBufferRange::HasNextBufferPosition() const { 904 bool SourceBufferRange::HasNextBufferPosition() const {
932 return next_buffer_index_ >= 0 || waiting_for_keyframe_; 905 return next_buffer_index_ >= 0 || waiting_for_keyframe_;
933 } 906 }
934 907
935 void SourceBufferRange::ResetNextBufferPosition() {
936 next_buffer_index_ = -1;
937 waiting_for_keyframe_ = false;
938 next_keyframe_timestamp_ = kNoTimestamp();
939 }
940
941 void SourceBufferRange::AppendToEnd(const SourceBufferRange& range, 908 void SourceBufferRange::AppendToEnd(const SourceBufferRange& range,
942 bool transfer_current_position) { 909 bool transfer_current_position) {
943 DCHECK(CanAppendToEnd(range)); 910 DCHECK(CanAppendToEnd(range));
944 DCHECK(!buffers_.empty()); 911 DCHECK(!buffers_.empty());
945 912
946 if (transfer_current_position) 913 if (transfer_current_position)
947 next_buffer_index_ = range.next_buffer_index_ + buffers_.size(); 914 next_buffer_index_ = range.next_buffer_index_ + buffers_.size();
948 915
949 AppendToEnd(range.buffers_); 916 AppendToEnd(range.buffers_);
950 } 917 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 return 2 * GetApproximateDuration(); 986 return 2 * GetApproximateDuration();
1020 } 987 }
1021 988
1022 base::TimeDelta SourceBufferRange::GetApproximateDuration() const { 989 base::TimeDelta SourceBufferRange::GetApproximateDuration() const {
1023 base::TimeDelta max_interbuffer_distance = interbuffer_distance_cb_.Run(); 990 base::TimeDelta max_interbuffer_distance = interbuffer_distance_cb_.Run();
1024 DCHECK(max_interbuffer_distance != kNoTimestamp()); 991 DCHECK(max_interbuffer_distance != kNoTimestamp());
1025 return max_interbuffer_distance; 992 return max_interbuffer_distance;
1026 } 993 }
1027 994
1028 } // namespace media 995 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/source_buffer_stream.h ('k') | media/filters/source_buffer_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698