Chromium Code Reviews| Index: media/filters/audio_clock.cc |
| diff --git a/media/filters/audio_clock.cc b/media/filters/audio_clock.cc |
| index 03af719bcb2348bb30c022f3de87d35f20483534..d4fea149e0c2b228a60252b5517aa93d0839c564 100644 |
| --- a/media/filters/audio_clock.cc |
| +++ b/media/filters/audio_clock.cc |
| @@ -42,6 +42,7 @@ void AudioClock::WroteAudio(int frames_written, |
| // |
| // The ordering of compute -> push -> pop eliminates unnecessary memory |
| // reallocations in cases where |buffered_| gets emptied. |
| + const int64_t original_buffered_frames = total_buffered_frames_; |
|
jrummell
2015/07/10 00:32:57
Since this is only used in the DCHECK, will a rele
DaleCurtis
2015/07/10 00:34:22
Nope, the DCHECK still counts as usage.
|
| int64_t frames_played = |
| std::max(INT64_C(0), total_buffered_frames_ - delay_frames); |
| front_timestamp_ += ComputeBufferedMediaTime(frames_played); |
| @@ -52,6 +53,16 @@ void AudioClock::WroteAudio(int frames_written, |
| back_timestamp_ += base::TimeDelta::FromMicroseconds( |
| frames_written * playback_rate * microseconds_per_frame_); |
| + // Ensure something crazy hasn't happened to desync the front and back values. |
| + DCHECK_LE(front_timestamp_.InMicroseconds(), back_timestamp_.InMicroseconds()) |
| + << "frames_written=" << frames_written |
| + << ", frames_requested=" << frames_requested |
| + << ", delay_frames=" << delay_frames |
| + << ", playback_rate=" << playback_rate |
| + << ", frames_played=" << frames_played |
| + << ", original_buffered_frames=" << original_buffered_frames |
| + << ", total_buffered_frames_=" << total_buffered_frames_; |
| + |
| // Update cached values. |
| double scaled_frames = 0; |
| double scaled_frames_at_same_rate = 0; |