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

Unified Diff: media/base/clock.cc

Issue 375003002: Remove duration from media::Clock. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix android Created 6 years, 5 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/clock.h ('k') | media/base/clock_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/clock.cc
diff --git a/media/base/clock.cc b/media/base/clock.cc
index 3dc49e9e79cbbd4572433ca1d0fdd3c6dd67b44d..2c21267b0df3ae38e9e5c75591c39f21d3902792 100644
--- a/media/base/clock.cc
+++ b/media/base/clock.cc
@@ -17,8 +17,7 @@ Clock::Clock(base::TickClock* clock)
playing_(false),
underflow_(false),
playback_rate_(1.0f),
- max_time_(kNoTimestamp()),
- duration_(kNoTimestamp()) {
+ max_time_(kNoTimestamp()) {
DCHECK(clock_);
}
@@ -57,9 +56,6 @@ void Clock::SetTime(base::TimeDelta current_time, base::TimeDelta max_time) {
}
base::TimeDelta Clock::Elapsed() {
- if (duration_ == kNoTimestamp())
- return base::TimeDelta();
-
// The clock is not advancing, so return the last recorded time.
if (!playing_ || underflow_)
return media_time_;
@@ -85,15 +81,6 @@ void Clock::SetMaxTime(base::TimeDelta max_time) {
media_time_ = max_time_;
}
-void Clock::SetDuration(base::TimeDelta duration) {
- DCHECK(duration > base::TimeDelta());
- duration_ = duration;
-
- media_time_ = ClampToValidTimeRange(media_time_);
- if (max_time_ != kNoTimestamp())
- max_time_ = ClampToValidTimeRange(max_time_);
-}
-
base::TimeDelta Clock::ElapsedViaProvidedTime(
const base::TimeTicks& time) const {
// TODO(scherkus): floating point badness scaling time by playback rate.
@@ -103,15 +90,7 @@ base::TimeDelta Clock::ElapsedViaProvidedTime(
}
base::TimeDelta Clock::ClampToValidTimeRange(base::TimeDelta time) const {
- if (duration_ == kNoTimestamp())
- return base::TimeDelta();
- return std::max(std::min(time, duration_), base::TimeDelta());
-}
-
-base::TimeDelta Clock::Duration() const {
- if (duration_ == kNoTimestamp())
- return base::TimeDelta();
- return duration_;
+ return std::max(base::TimeDelta(), time);
}
void Clock::UpdateReferencePoints() {
« no previous file with comments | « media/base/clock.h ('k') | media/base/clock_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698