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

Unified Diff: media/filters/source_buffer_stream.cc

Issue 1692403002: MSE - Fix crash caused by incorrect GC of GOP with next buffer position (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Increased hardening + more code comments per chat w/chcunningham@ Created 4 years, 10 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/filters/source_buffer_range.cc ('k') | media/filters/source_buffer_stream_unittest.cc » ('j') | 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 619ff47ab7d4c54a1dcc070384c3ab0bfcfe5c70..d2b4fae6e5fc56a902d344cf03e69ac027355fc9 100644
--- a/media/filters/source_buffer_stream.cc
+++ b/media/filters/source_buffer_stream.cc
@@ -730,7 +730,7 @@ bool SourceBufferStream::GarbageCollectIfNeeded(DecodeTimestamp media_time,
if (bytes_freed < bytes_to_free) {
size_t front2 = FreeBuffers(bytes_to_free - bytes_freed,
ranges_.back()->GetEndTimestamp(), false);
- DVLOG(3) << __FUNCTION__ << " Removed " << front << " bytes from the"
+ DVLOG(3) << __FUNCTION__ << " Removed " << front2 << " bytes from the"
<< " front. ranges_=" << RangesToString(ranges_);
bytes_freed += front2;
}
@@ -855,13 +855,24 @@ size_t SourceBufferStream::FreeBuffers(size_t total_bytes_to_free,
} else {
current_range = ranges_.front();
DVLOG(5) << "current_range=" << RangeToString(*current_range);
- if (!current_range->FirstGOPEarlierThanMediaTime(media_time)) {
+
+ // FirstGOPEarlierThanMediaTime() is useful here especially if
+ // |seek_pending_| (such that no range contains next buffer
+ // position).
+ // FirstGOPContainsNextBufferPosition() is useful here especially if
+ // |!seek_pending_| to protect against DeleteGOPFromFront() if
+ // FirstGOPEarlierThanMediaTime() was insufficient alone.
+ if (!current_range->FirstGOPEarlierThanMediaTime(media_time) ||
+ current_range->FirstGOPContainsNextBufferPosition()) {
// We have removed all data up to the GOP that contains current playback
// position, we can't delete any further.
DVLOG(5) << "current_range contains playback position, stopping GC";
break;
}
- DVLOG(4) << "Deleting GOP from front: " << RangeToString(*current_range);
+ DVLOG(4) << "Deleting GOP from front: " << RangeToString(*current_range)
+ << ", media_time: " << media_time.InMicroseconds()
+ << ", current_range->HasNextBufferPosition(): "
+ << current_range->HasNextBufferPosition();
bytes_deleted = current_range->DeleteGOPFromFront(&buffers);
}
« no previous file with comments | « media/filters/source_buffer_range.cc ('k') | media/filters/source_buffer_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698