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

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

Issue 205703003: MSE: Use frame duration, if available, in LegacyFrameProcessor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased to pull in WebM frame duration estimation, undid the CD tests' conversion to just BlockGrou… Created 6 years, 9 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
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 10
(...skipping 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after
1552 return source_state_map_.count(source_id) > 0u; 1552 return source_state_map_.count(source_id) > 0u;
1553 } 1553 }
1554 1554
1555 void ChunkDemuxer::UpdateDuration(TimeDelta new_duration) { 1555 void ChunkDemuxer::UpdateDuration(TimeDelta new_duration) {
1556 DCHECK(duration_ != new_duration); 1556 DCHECK(duration_ != new_duration);
1557 user_specified_duration_ = -1; 1557 user_specified_duration_ = -1;
1558 duration_ = new_duration; 1558 duration_ = new_duration;
1559 host_->SetDuration(new_duration); 1559 host_->SetDuration(new_duration);
1560 } 1560 }
1561 1561
1562 void ChunkDemuxer::IncreaseDurationIfNecessary( 1562 void ChunkDemuxer::IncreaseDurationIfNecessary(TimeDelta new_duration) {
1563 TimeDelta last_appended_buffer_timestamp, 1563 DCHECK(new_duration != kNoTimestamp());
1564 ChunkDemuxerStream* stream) { 1564
1565 DCHECK(last_appended_buffer_timestamp != kNoTimestamp()); 1565 if (new_duration <= duration_)
1566 if (last_appended_buffer_timestamp <= duration_)
1567 return; 1566 return;
1568 1567
1569 TimeDelta stream_duration = stream->GetBufferedDuration(); 1568 DVLOG(2) << __FUNCTION__ << ": Increasing duration: "
1570 DCHECK(stream_duration > TimeDelta()); 1569 << duration_.InSecondsF() << " -> " << new_duration.InSecondsF();
1571 1570
1572 if (stream_duration > duration_) 1571 UpdateDuration(new_duration);
1573 UpdateDuration(stream_duration);
1574 } 1572 }
1575 1573
1576 void ChunkDemuxer::DecreaseDurationIfNecessary() { 1574 void ChunkDemuxer::DecreaseDurationIfNecessary() {
1577 lock_.AssertAcquired(); 1575 lock_.AssertAcquired();
1578 1576
1579 TimeDelta max_duration; 1577 TimeDelta max_duration;
1580 1578
1581 for (SourceStateMap::const_iterator itr = source_state_map_.begin(); 1579 for (SourceStateMap::const_iterator itr = source_state_map_.begin();
1582 itr != source_state_map_.end(); ++itr) { 1580 itr != source_state_map_.end(); ++itr) {
1583 max_duration = std::max(max_duration, 1581 max_duration = std::max(max_duration,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1640 } 1638 }
1641 1639
1642 void ChunkDemuxer::ShutdownAllStreams() { 1640 void ChunkDemuxer::ShutdownAllStreams() {
1643 for (SourceStateMap::iterator itr = source_state_map_.begin(); 1641 for (SourceStateMap::iterator itr = source_state_map_.begin();
1644 itr != source_state_map_.end(); ++itr) { 1642 itr != source_state_map_.end(); ++itr) {
1645 itr->second->Shutdown(); 1643 itr->second->Shutdown();
1646 } 1644 }
1647 } 1645 }
1648 1646
1649 } // namespace media 1647 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698