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

Unified Diff: media/base/audio_timestamp_helper.cc

Issue 2158923004: Convert media constants to constexpr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
Index: media/base/audio_timestamp_helper.cc
diff --git a/media/base/audio_timestamp_helper.cc b/media/base/audio_timestamp_helper.cc
index dd0892bb9f19507e98dceded0d75532095671b46..8429a3eb81ea0eb4336b5ef550b4906101c60237 100644
--- a/media/base/audio_timestamp_helper.cc
+++ b/media/base/audio_timestamp_helper.cc
@@ -10,8 +10,7 @@
namespace media {
AudioTimestampHelper::AudioTimestampHelper(int samples_per_second)
- : base_timestamp_(kNoTimestamp()),
- frame_count_(0) {
+ : base_timestamp_(kNoTimestamp), frame_count_(0) {
DCHECK_GT(samples_per_second, 0);
double fps = samples_per_second;
microseconds_per_frame_ = base::Time::kMicrosecondsPerSecond / fps;
@@ -28,7 +27,7 @@ base::TimeDelta AudioTimestampHelper::base_timestamp() const {
void AudioTimestampHelper::AddFrames(int frame_count) {
DCHECK_GE(frame_count, 0);
- DCHECK(base_timestamp_ != kNoTimestamp());
+ DCHECK(base_timestamp_ != kNoTimestamp);
frame_count_ += frame_count;
}
@@ -43,7 +42,7 @@ base::TimeDelta AudioTimestampHelper::GetFrameDuration(int frame_count) const {
}
int64_t AudioTimestampHelper::GetFramesToTarget(base::TimeDelta target) const {
- DCHECK(base_timestamp_ != kNoTimestamp());
+ DCHECK(base_timestamp_ != kNoTimestamp);
DCHECK(target >= base_timestamp_);
int64_t delta_in_us = (target - GetTimestamp()).InMicroseconds();
@@ -67,7 +66,7 @@ int64_t AudioTimestampHelper::GetFramesToTarget(base::TimeDelta target) const {
base::TimeDelta AudioTimestampHelper::ComputeTimestamp(
int64_t frame_count) const {
DCHECK_GE(frame_count, 0);
- DCHECK(base_timestamp_ != kNoTimestamp());
+ DCHECK(base_timestamp_ != kNoTimestamp);
double frames_us = microseconds_per_frame_ * frame_count;
return base_timestamp_ + base::TimeDelta::FromMicroseconds(frames_us);
}

Powered by Google App Engine
This is Rietveld 408576698