Commit f379f2f9 authored by Dan Sanders's avatar Dan Sanders Committed by Commit Bot

[media] Restrict duration calculation in SimpleWatchTimer.

Bug: 993311, 985144
Change-Id: I36104029d3fdfafcfee5be53b79a250017e9f86c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1751910
Auto-Submit: Dan Sanders <sandersd@chromium.org>
Reviewed-by: default avatarThomas Guilbert <tguilbert@chromium.org>
Commit-Queue: Thomas Guilbert <tguilbert@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686555}
parent 4682927e
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "media/base/simple_watch_timer.h" #include "media/base/simple_watch_timer.h"
#include "base/location.h" #include "base/location.h"
#include "media/base/timestamp_constants.h"
namespace media { namespace media {
...@@ -43,7 +44,11 @@ void SimpleWatchTimer::Stop() { ...@@ -43,7 +44,11 @@ void SimpleWatchTimer::Stop() {
void SimpleWatchTimer::Tick() { void SimpleWatchTimer::Tick() {
base::TimeDelta current_time = get_current_time_cb_.Run(); base::TimeDelta current_time = get_current_time_cb_.Run();
base::TimeDelta duration = current_time - last_current_time_; base::TimeDelta duration;
if (last_current_time_ != kNoTimestamp &&
last_current_time_ != kInfiniteDuration) {
duration = current_time - last_current_time_;
}
last_current_time_ = current_time; last_current_time_ = current_time;
// Accumulate watch time if the duration is reasonable. // Accumulate watch time if the duration is reasonable.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment