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

Unified Diff: media/filters/video_cadence_estimator.cc

Issue 1127373006: Fix DCHECK() firing on GPU bots. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test! Created 5 years, 7 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 | « no previous file | media/filters/video_cadence_estimator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/video_cadence_estimator.cc
diff --git a/media/filters/video_cadence_estimator.cc b/media/filters/video_cadence_estimator.cc
index a328abd491a634d9b0d79efa462e8ac68758e670..bad4fd056b76af9a4fe701665f3665c462827117 100644
--- a/media/filters/video_cadence_estimator.cc
+++ b/media/filters/video_cadence_estimator.cc
@@ -135,11 +135,18 @@ VideoCadenceEstimator::Cadence VideoCadenceEstimator::CalculateCadence(
// interval; i.e. 24fps in 60hz.
DCHECK_EQ(1u, result.size());
- // Two pattern cadence is always an odd number.
- DCHECK(result[0] & 1);
-
- result[0] = std::ceil(result[0] / 2.0);
- result.push_back(result[0] - 1);
+ // While we may find a two pattern cadence, sometimes one extra frame
+ // duration is enough to allow a match for 1-frame cadence if the
+ // |time_until_max_drift| was on the edge.
+ //
+ // All 2-frame cadence values should be odd, so we can detect this and fall
+ // back to 1-frame cadence when this occurs.
+ if (result[0] & 1) {
+ result[0] = std::ceil(result[0] / 2.0);
+ result.push_back(result[0] - 1);
+ } else {
+ result[0] /= 2;
+ }
}
return result;
}
« no previous file with comments | « no previous file | media/filters/video_cadence_estimator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698