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

Side by Side Diff: media/base/time_delta_interpolator.cc

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/base/time_delta_interpolator.h" 5 #include "media/base/time_delta_interpolator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/time/tick_clock.h" 10 #include "base/time/tick_clock.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 lower_bound_ = GetInterpolatedTime(); 59 lower_bound_ = GetInterpolatedTime();
60 reference_ = tick_clock_->NowTicks(); 60 reference_ = tick_clock_->NowTicks();
61 upper_bound_ = upper_bound; 61 upper_bound_ = upper_bound;
62 } 62 }
63 63
64 base::TimeDelta TimeDeltaInterpolator::GetInterpolatedTime() { 64 base::TimeDelta TimeDeltaInterpolator::GetInterpolatedTime() {
65 if (!interpolating_) 65 if (!interpolating_)
66 return lower_bound_; 66 return lower_bound_;
67 67
68 int64 now_us = (tick_clock_->NowTicks() - reference_).InMicroseconds(); 68 int64_t now_us = (tick_clock_->NowTicks() - reference_).InMicroseconds();
69 now_us = static_cast<int64>(now_us * playback_rate_); 69 now_us = static_cast<int64_t>(now_us * playback_rate_);
70 base::TimeDelta interpolated_time = 70 base::TimeDelta interpolated_time =
71 lower_bound_ + base::TimeDelta::FromMicroseconds(now_us); 71 lower_bound_ + base::TimeDelta::FromMicroseconds(now_us);
72 72
73 if (upper_bound_ == kNoTimestamp()) 73 if (upper_bound_ == kNoTimestamp())
74 return interpolated_time; 74 return interpolated_time;
75 75
76 return std::min(interpolated_time, upper_bound_); 76 return std::min(interpolated_time, upper_bound_);
77 } 77 }
78 78
79 } // namespace media 79 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698