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

Unified Diff: media/filters/source_buffer_range.cc

Issue 1670033002: Reland: MSE: Relax the 'media segment must begin with keyframe' requirement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes and tests for bugs 581125 and 581458, which caused previous attempt to be reverted 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
Index: media/filters/source_buffer_range.cc
diff --git a/media/filters/source_buffer_range.cc b/media/filters/source_buffer_range.cc
index 562e14e0964a4ebdaf438598a6de4670732b2b79..a2b6e8221d2d2129758d9f42ef0626b5812e4da1 100644
--- a/media/filters/source_buffer_range.cc
+++ b/media/filters/source_buffer_range.cc
@@ -22,9 +22,10 @@ static bool CompareStreamParserBufferToTimeDelta(
return buffer->GetDecodeTimestamp() < decode_timestamp;
}
-bool SourceBufferRange::AllowSameTimestamp(
- bool prev_is_keyframe, bool current_is_keyframe) {
- return prev_is_keyframe || !current_is_keyframe;
+bool SourceBufferRange::IsUncommonSameTimestampSequence(
+ bool prev_is_keyframe,
+ bool current_is_keyframe) {
+ return current_is_keyframe && !prev_is_keyframe;
chcunningham 2016/02/09 00:21:08 Just to note: I wasn't sure how (un)common this is
wolenetz 2016/02/09 00:47:19 Acknowledged.
}
SourceBufferRange::SourceBufferRange(
@@ -487,14 +488,13 @@ bool SourceBufferRange::CanAppendRangeToEnd(
bool SourceBufferRange::CanAppendBuffersToEnd(
const BufferQueue& buffers) const {
DCHECK(!buffers_.empty());
- return IsNextInSequence(buffers.front()->GetDecodeTimestamp(),
- buffers.front()->is_key_frame());
+ return IsNextInSequence(buffers.front()->GetDecodeTimestamp());
}
bool SourceBufferRange::BelongsToRange(DecodeTimestamp timestamp) const {
DCHECK(!buffers_.empty());
- return (IsNextInSequence(timestamp, false) ||
+ return (IsNextInSequence(timestamp) ||
(GetStartTimestamp() <= timestamp && timestamp <= GetEndTimestamp()));
}
@@ -570,17 +570,11 @@ DecodeTimestamp SourceBufferRange::KeyframeBeforeTimestamp(
return GetFirstKeyframeAtOrBefore(timestamp)->first;
}
-bool SourceBufferRange::IsNextInSequence(
- DecodeTimestamp timestamp, bool is_key_frame) const {
+bool SourceBufferRange::IsNextInSequence(DecodeTimestamp timestamp) const {
DecodeTimestamp end = buffers_.back()->GetDecodeTimestamp();
- if (end < timestamp &&
- (gap_policy_ == ALLOW_GAPS ||
- timestamp <= end + GetFudgeRoom())) {
- return true;
- }
-
- return timestamp == end && AllowSameTimestamp(
- buffers_.back()->is_key_frame(), is_key_frame);
+ return (end == timestamp ||
+ (end < timestamp &&
+ (gap_policy_ == ALLOW_GAPS || timestamp <= end + GetFudgeRoom())));
}
base::TimeDelta SourceBufferRange::GetFudgeRoom() const {

Powered by Google App Engine
This is Rietveld 408576698