Index: media/formats/webm/webm_cluster_parser.cc |
diff --git a/media/formats/webm/webm_cluster_parser.cc b/media/formats/webm/webm_cluster_parser.cc |
index 5530815caa8a13dffb70578942314fd3a58a5637..5a3adc363d30ba7309a0e82cd49d00c6e7d2a4cb 100644 |
--- a/media/formats/webm/webm_cluster_parser.cc |
+++ b/media/formats/webm/webm_cluster_parser.cc |
@@ -532,8 +532,18 @@ bool WebMClusterParser::Track::QueueBuffer( |
return false; |
} |
- estimated_next_frame_duration_ = std::max(duration, |
- estimated_next_frame_duration_); |
+ // The estimated frame duration is the minimum non-zero duration since the |
+ // last initialization segment. The minimum is used to ensure frame durations |
+ // aren't overestimated. |
+ if (duration > base::TimeDelta()) { |
+ if (estimated_next_frame_duration_ == kNoTimestamp()) { |
+ estimated_next_frame_duration_ = duration; |
+ } else { |
+ estimated_next_frame_duration_ = |
+ std::min(duration, estimated_next_frame_duration_); |
+ } |
+ } |
+ |
buffers_.push_back(buffer); |
return true; |
} |