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

Unified Diff: media/filters/decoder_stream_traits.cc

Issue 2643103002: [Video] Fix keyframe distance average calculations. (Closed)
Patch Set: Created 3 years, 11 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_status.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/decoder_stream_traits.cc
diff --git a/media/filters/decoder_stream_traits.cc b/media/filters/decoder_stream_traits.cc
index a2f8c99c11b5ad97dd7d7d4796387bcfda15d2c8..9577add9f044b70ce8fd17cd40fe79225db8aea8 100644
--- a/media/filters/decoder_stream_traits.cc
+++ b/media/filters/decoder_stream_traits.cc
@@ -107,13 +107,13 @@ void DecoderStreamTraits<DemuxerStream::VIDEO>::ReportStatistics(
PipelineStatistics statistics;
statistics.video_bytes_decoded = bytes_decoded;
- // Before we have enough keyframes to calculate the average distance, we will
- // assume the average keyframe distance is infinitely large.
- if (keyframe_distance_average_.count() < 3) {
- statistics.video_keyframe_distance_average = base::TimeDelta::Max();
- } else {
+ if (keyframe_distance_average_.count()) {
statistics.video_keyframe_distance_average =
keyframe_distance_average_.Average();
+ } else {
+ // Before we have enough keyframes to calculate the average distance, we
+ // will assume the average keyframe distance is infinitely large.
+ statistics.video_keyframe_distance_average = base::TimeDelta::Max();
}
statistics_cb.Run(statistics);
@@ -135,7 +135,6 @@ void DecoderStreamTraits<DemuxerStream::VIDEO>::OnStreamReset(
DemuxerStream* stream) {
DCHECK(stream);
last_keyframe_timestamp_ = base::TimeDelta();
- keyframe_distance_average_.Reset();
}
void DecoderStreamTraits<DemuxerStream::VIDEO>::OnDecode(
« no previous file with comments | « media/base/pipeline_status.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698