OLD | NEW |
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/filters/audio_clock.h" | 5 #include "media/filters/audio_clock.h" |
6 | 6 |
| 7 #include <stdint.h> |
7 #include <stddef.h> | 8 #include <stddef.h> |
8 | 9 |
9 #include <algorithm> | 10 #include <algorithm> |
10 | 11 |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 | 13 |
13 namespace media { | 14 namespace media { |
14 | 15 |
15 AudioClock::AudioClock(base::TimeDelta start_timestamp, int sample_rate) | 16 AudioClock::AudioClock(base::TimeDelta start_timestamp, int sample_rate) |
16 : start_timestamp_(start_timestamp), | 17 : start_timestamp_(start_timestamp), |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 181 |
181 base::TimeDelta AudioClock::ComputeBufferedMediaDuration() const { | 182 base::TimeDelta AudioClock::ComputeBufferedMediaDuration() const { |
182 double scaled_frames = 0; | 183 double scaled_frames = 0; |
183 for (const auto& buffer : buffered_) | 184 for (const auto& buffer : buffered_) |
184 scaled_frames += buffer.frames * buffer.playback_rate; | 185 scaled_frames += buffer.frames * buffer.playback_rate; |
185 return base::TimeDelta::FromMicroseconds(scaled_frames * | 186 return base::TimeDelta::FromMicroseconds(scaled_frames * |
186 microseconds_per_frame_); | 187 microseconds_per_frame_); |
187 } | 188 } |
188 | 189 |
189 } // namespace media | 190 } // namespace media |
OLD | NEW |