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

Unified Diff: media/filters/chunk_demuxer.cc

Issue 10800041: Update media duration if data is appended after the previous duration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/pipeline.cc ('k') | webkit/media/webmediaplayer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/chunk_demuxer.cc
diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc
index d90052876629057ed7479e71744afd14efe3ed82..1e3dba35ca5bb73129bd8730420ce753a9593b47 100644
--- a/media/filters/chunk_demuxer.cc
+++ b/media/filters/chunk_demuxer.cc
@@ -761,6 +761,14 @@ bool ChunkDemuxer::AppendData(const std::string& id,
}
}
+ if (ranges.size() > 0) {
+ base::TimeDelta last_timestamp_buffered = ranges.end(ranges.size() - 1);
+ if (last_timestamp_buffered > duration_) {
+ duration_ = last_timestamp_buffered;
+ host_->SetDuration(last_timestamp_buffered);
+ }
+ }
+
for (size_t i = 0; i < ranges.size(); ++i)
host_->AddBufferedTimeRange(ranges.start(i), ranges.end(i));
@@ -940,8 +948,6 @@ void ChunkDemuxer::OnStreamParserInitDone(bool success, TimeDelta duration) {
(!source_id_video_.empty() && !video_))
return;
- host_->SetDuration(duration_);
acolwell GONE FROM CHROMIUM 2012/07/20 21:18:36 This isn't needed anymore because of the code in O
vrk (LEFT CHROMIUM) 2012/07/26 22:27:26 Yes. My thought was, I was moving this line to hap
-
ChangeState_Locked(WAITING_FOR_START_TIME);
}
@@ -1059,6 +1065,9 @@ void ChunkDemuxer::OnNewMediaSegment(const std::string& source_id,
video_->Seek(start_time_);
}
+ duration_ = std::max(duration_, start_time_);
acolwell GONE FROM CHROMIUM 2012/07/20 21:18:36 A couple questions here: - Shouldn't the SetDurati
vrk (LEFT CHROMIUM) 2012/07/26 22:27:26 As I said in my other comment, my thinking was I w
+ host_->SetDuration(duration_);
+
// The demuxer is now initialized after the |start_timestamp_| was set.
ChangeState_Locked(INITIALIZED);
base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK);
« no previous file with comments | « media/base/pipeline.cc ('k') | webkit/media/webmediaplayer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698