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

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

Issue 1526303004: Fix buffered range updates in media::Pipeline (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Android buildfix 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/base/pipeline_unittest.cc ('k') | media/filters/chunk_demuxer_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/chunk_demuxer.h" 5 #include "media/filters/chunk_demuxer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <list> 9 #include <list>
10 #include <utility> 10 #include <utility>
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 // Check to see if data was appended at the pending seek point. This 652 // Check to see if data was appended at the pending seek point. This
653 // indicates we have parsed enough data to complete the seek. 653 // indicates we have parsed enough data to complete the seek.
654 if (old_waiting_for_data && !IsSeekWaitingForData_Locked() && 654 if (old_waiting_for_data && !IsSeekWaitingForData_Locked() &&
655 !seek_cb_.is_null()) { 655 !seek_cb_.is_null()) {
656 base::ResetAndReturn(&seek_cb_).Run(PIPELINE_OK); 656 base::ResetAndReturn(&seek_cb_).Run(PIPELINE_OK);
657 } 657 }
658 658
659 ranges = GetBufferedRanges_Locked(); 659 ranges = GetBufferedRanges_Locked();
660 } 660 }
661 661
662 for (size_t i = 0; i < ranges.size(); ++i) 662 host_->OnBufferedTimeRangesChanged(ranges);
663 host_->AddBufferedTimeRange(ranges.start(i), ranges.end(i));
664 } 663 }
665 664
666 void ChunkDemuxer::ResetParserState(const std::string& id, 665 void ChunkDemuxer::ResetParserState(const std::string& id,
667 TimeDelta append_window_start, 666 TimeDelta append_window_start,
668 TimeDelta append_window_end, 667 TimeDelta append_window_end,
669 TimeDelta* timestamp_offset) { 668 TimeDelta* timestamp_offset) {
670 DVLOG(1) << "ResetParserState(" << id << ")"; 669 DVLOG(1) << "ResetParserState(" << id << ")";
671 base::AutoLock auto_lock(lock_); 670 base::AutoLock auto_lock(lock_);
672 DCHECK(!id.empty()); 671 DCHECK(!id.empty());
673 CHECK(IsValidId(id)); 672 CHECK(IsValidId(id));
(...skipping 21 matching lines...) Expand all
695 DCHECK(start < end) << "start " << start.InSecondsF() 694 DCHECK(start < end) << "start " << start.InSecondsF()
696 << " end " << end.InSecondsF(); 695 << " end " << end.InSecondsF();
697 DCHECK(duration_ != kNoTimestamp()); 696 DCHECK(duration_ != kNoTimestamp());
698 DCHECK(start <= duration_) << "start " << start.InSecondsF() 697 DCHECK(start <= duration_) << "start " << start.InSecondsF()
699 << " duration " << duration_.InSecondsF(); 698 << " duration " << duration_.InSecondsF();
700 699
701 if (start == duration_) 700 if (start == duration_)
702 return; 701 return;
703 702
704 source_state_map_[id]->Remove(start, end, duration_); 703 source_state_map_[id]->Remove(start, end, duration_);
704 host_->OnBufferedTimeRangesChanged(GetBufferedRanges_Locked());
705 } 705 }
706 706
707 double ChunkDemuxer::GetDuration() { 707 double ChunkDemuxer::GetDuration() {
708 base::AutoLock auto_lock(lock_); 708 base::AutoLock auto_lock(lock_);
709 return GetDuration_Locked(); 709 return GetDuration_Locked();
710 } 710 }
711 711
712 double ChunkDemuxer::GetDuration_Locked() { 712 double ChunkDemuxer::GetDuration_Locked() {
713 lock_.AssertAcquired(); 713 lock_.AssertAcquired();
714 if (duration_ == kNoTimestamp()) 714 if (duration_ == kNoTimestamp())
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 } 1109 }
1110 1110
1111 void ChunkDemuxer::ShutdownAllStreams() { 1111 void ChunkDemuxer::ShutdownAllStreams() {
1112 for (MediaSourceStateMap::iterator itr = source_state_map_.begin(); 1112 for (MediaSourceStateMap::iterator itr = source_state_map_.begin();
1113 itr != source_state_map_.end(); ++itr) { 1113 itr != source_state_map_.end(); ++itr) {
1114 itr->second->Shutdown(); 1114 itr->second->Shutdown();
1115 } 1115 }
1116 } 1116 }
1117 1117
1118 } // namespace media 1118 } // namespace media
OLDNEW
« no previous file with comments | « media/base/pipeline_unittest.cc ('k') | media/filters/chunk_demuxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698