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

Unified Diff: media/filters/chunk_demuxer.cc

Issue 10581050: Ensure media's buffered ranges always have a range that includes currentTime. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Alternative implementation, introducing DataSourceHost::AddBufferedTimeRange(). Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: media/filters/chunk_demuxer.cc
diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc
index 3d67e5065cc1352853b8d61d16c39fbf8b10a711..ddfbdace8d20d39b7a2f86ea1af333cf373d9b28 100644
--- a/media/filters/chunk_demuxer.cc
+++ b/media/filters/chunk_demuxer.cc
@@ -75,13 +75,6 @@ static const SupportedTypeInfo kSupportedTypeInfo[] = {
{ "audio/mp4", &BuildMP4Parser, kAudioMP4Codecs },
};
-
-// The fake total size we use for converting times to bytes
-// for AddBufferedByteRange() calls.
-// TODO(acolwell): Remove this once Pipeline accepts buffered times
-// instead of only buffered bytes.
-enum { kFakeTotalBytes = 1000000 };
scherkus (not reviewing) 2012/06/21 21:57:04 \m/,
-
// Checks to see if the specified |type| and |codecs| list are supported.
// Returns true if |type| and all codecs listed in |codecs| are supported.
// |factory_function| contains a function that can build a StreamParser
@@ -747,15 +740,8 @@ bool ChunkDemuxer::AppendData(const std::string& id,
}
}
- DCHECK(!ranges.size() || duration_ > TimeDelta());
- for (size_t i = 0; i < ranges.size(); ++i) {
- // Notify the host of 'network activity' because we got data.
- int64 start =
- kFakeTotalBytes * ranges.start(i).InSecondsF() / duration_.InSecondsF();
- int64 end =
- kFakeTotalBytes * ranges.end(i).InSecondsF() / duration_.InSecondsF();
- host_->AddBufferedByteRange(start, end);
- }
+ for (size_t i = 0; i < ranges.size(); ++i)
+ host_->AddBufferedTimeRange(ranges.start(i), ranges.end(i));
if (!cb.is_null())
cb.Run(PIPELINE_OK);
@@ -923,8 +909,6 @@ void ChunkDemuxer::OnStreamParserInitDone(bool success, TimeDelta duration) {
(!source_id_video_.empty() && !video_))
return;
- if (duration_ > TimeDelta() && duration_ != kInfiniteDuration())
- host_->SetTotalBytes(kFakeTotalBytes);
host_->SetDuration(duration_);
ChangeState_Locked(INITIALIZED);

Powered by Google App Engine
This is Rietveld 408576698