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

Side by Side Diff: media/filters/audio_clock.cc

Issue 1109183002: media: Add extra logging in AudioClock. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/filters/audio_clock.h" 5 #include "media/filters/audio_clock.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "media/base/buffers.h" 10 #include "media/base/buffers.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 75
76 contiguous_audio_data_buffered_ = base::TimeDelta::FromMicroseconds( 76 contiguous_audio_data_buffered_ = base::TimeDelta::FromMicroseconds(
77 scaled_frames * microseconds_per_frame_); 77 scaled_frames * microseconds_per_frame_);
78 contiguous_audio_data_buffered_at_same_rate_ = 78 contiguous_audio_data_buffered_at_same_rate_ =
79 base::TimeDelta::FromMicroseconds(scaled_frames_at_same_rate * 79 base::TimeDelta::FromMicroseconds(scaled_frames_at_same_rate *
80 microseconds_per_frame_); 80 microseconds_per_frame_);
81 } 81 }
82 82
83 base::TimeDelta AudioClock::TimeUntilPlayback(base::TimeDelta timestamp) const { 83 base::TimeDelta AudioClock::TimeUntilPlayback(base::TimeDelta timestamp) const {
84 DCHECK(timestamp >= front_timestamp_); 84 DCHECK_GE(timestamp, front_timestamp_);
85 DCHECK(timestamp <= back_timestamp_); 85 DCHECK_LE(timestamp, back_timestamp_);
86 86
87 int64_t frames_until_timestamp = 0; 87 int64_t frames_until_timestamp = 0;
88 double timestamp_us = timestamp.InMicroseconds(); 88 double timestamp_us = timestamp.InMicroseconds();
89 double media_time_us = front_timestamp_.InMicroseconds(); 89 double media_time_us = front_timestamp_.InMicroseconds();
90 90
91 for (size_t i = 0; i < buffered_.size(); ++i) { 91 for (size_t i = 0; i < buffered_.size(); ++i) {
92 // Leading silence is always accounted prior to anything else. 92 // Leading silence is always accounted prior to anything else.
93 if (buffered_[i].playback_rate == 0) { 93 if (buffered_[i].playback_rate == 0) {
94 frames_until_timestamp += buffered_[i].frames; 94 frames_until_timestamp += buffered_[i].frames;
95 continue; 95 continue;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 int64_t min_frames = std::min(buffered_[i].frames, frames); 159 int64_t min_frames = std::min(buffered_[i].frames, frames);
160 scaled_frames += min_frames * buffered_[i].playback_rate; 160 scaled_frames += min_frames * buffered_[i].playback_rate;
161 frames -= min_frames; 161 frames -= min_frames;
162 } 162 }
163 163
164 return base::TimeDelta::FromMicroseconds(scaled_frames * 164 return base::TimeDelta::FromMicroseconds(scaled_frames *
165 microseconds_per_frame_); 165 microseconds_per_frame_);
166 } 166 }
167 167
168 } // namespace media 168 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698