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

Unified Diff: media/filters/source_buffer_stream.cc

Issue 791723003: Use of the playback time in the MSE garbage collection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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/filters/source_buffer_stream.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/source_buffer_stream.cc
diff --git a/media/filters/source_buffer_stream.cc b/media/filters/source_buffer_stream.cc
index faba8ec9d1e8d75832cd3ce30296e4c7b766397a..9fc731f1299fac8a46d119d7863efc80ca0f5cf9 100644
--- a/media/filters/source_buffer_stream.cc
+++ b/media/filters/source_buffer_stream.cc
@@ -103,6 +103,7 @@ SourceBufferStream::SourceBufferStream(const AudioDecoderConfig& audio_config,
end_of_stream_(false),
seek_buffer_timestamp_(kNoTimestamp()),
selected_range_(NULL),
+ current_media_time_(kNoDecodeTimestamp()),
media_segment_start_time_(kNoDecodeTimestamp()),
range_for_next_append_(ranges_.end()),
new_media_segment_(false),
@@ -129,6 +130,7 @@ SourceBufferStream::SourceBufferStream(const VideoDecoderConfig& video_config,
end_of_stream_(false),
seek_buffer_timestamp_(kNoTimestamp()),
selected_range_(NULL),
+ current_media_time_(kNoDecodeTimestamp()),
media_segment_start_time_(kNoDecodeTimestamp()),
range_for_next_append_(ranges_.end()),
new_media_segment_(false),
@@ -156,6 +158,7 @@ SourceBufferStream::SourceBufferStream(const TextTrackConfig& text_config,
end_of_stream_(false),
seek_buffer_timestamp_(kNoTimestamp()),
selected_range_(NULL),
+ current_media_time_(kNoDecodeTimestamp()),
media_segment_start_time_(kNoDecodeTimestamp()),
range_for_next_append_(ranges_.end()),
new_media_segment_(false),
@@ -707,6 +710,10 @@ int SourceBufferStream::FreeBuffers(int total_bytes_to_free,
DCHECK_EQ(current_range, selected_range_);
break;
}
+ if (current_media_time_ != kNoDecodeTimestamp() &&
+ !current_range->FirstGOPEarlierThanMediaTime(current_media_time_)) {
+ break;
+ }
bytes_deleted = current_range->DeleteGOPFromFront(&buffers);
}
@@ -884,11 +891,23 @@ void SourceBufferStream::MergeWithAdjacentRangeIfNecessary(
DeleteAndRemoveRange(&next_range_itr);
}
+void SourceBufferStream::NotifyMediaTimeUpdate(DecodeTimestamp media_time) {
+ if (current_media_time_ != kNoDecodeTimestamp() &&
+ media_time < current_media_time_) {
+ DLOG(WARNING) << "Time should be monotonically increasing: "
+ << media_time.InMilliseconds()
+ << " " << current_media_time_.InMilliseconds();
+ return;
+ }
+ current_media_time_ = media_time;
+}
+
void SourceBufferStream::Seek(base::TimeDelta timestamp) {
DCHECK(timestamp >= base::TimeDelta());
DVLOG(1) << __FUNCTION__ << " " << GetStreamTypeName()
<< " (" << timestamp.InSecondsF() << ")";
ResetSeekState();
+ current_media_time_ = kNoDecodeTimestamp();
if (ShouldSeekToStartOfBuffered(timestamp)) {
ranges_.front()->SeekToStart();
« no previous file with comments | « media/filters/source_buffer_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698