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

Side by Side Diff: media/audio/audio_parameters.h

Issue 1687213002: Express audio delay more precisely in frames rather than milliseconds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 10 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 | « media/audio/audio_output_stream_sink.cc ('k') | media/audio/audio_parameters.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef MEDIA_AUDIO_AUDIO_PARAMETERS_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_PARAMETERS_H_
6 #define MEDIA_AUDIO_AUDIO_PARAMETERS_H_ 6 #define MEDIA_AUDIO_AUDIO_PARAMETERS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string> 9 #include <string>
10 10
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 // Returns size of audio buffer in bytes. 119 // Returns size of audio buffer in bytes.
120 int GetBytesPerBuffer() const; 120 int GetBytesPerBuffer() const;
121 121
122 // Returns the number of bytes representing one second of audio. 122 // Returns the number of bytes representing one second of audio.
123 int GetBytesPerSecond() const; 123 int GetBytesPerSecond() const;
124 124
125 // Returns the number of bytes representing a frame of audio. 125 // Returns the number of bytes representing a frame of audio.
126 int GetBytesPerFrame() const; 126 int GetBytesPerFrame() const;
127 127
128 // Returns the number of microseconds per frame of audio. Intentionally
129 // reported as a double to surface of partial microseconds per frame, which
130 // is common for many sample rates. Failing to account for these nanoseconds
131 // can lead to audio/video sync drift.
132 double GetMicrosecondsPerFrame() const;
133
128 // Returns the duration of this buffer as calculated from frames_per_buffer() 134 // Returns the duration of this buffer as calculated from frames_per_buffer()
129 // and sample_rate(). 135 // and sample_rate().
130 base::TimeDelta GetBufferDuration() const; 136 base::TimeDelta GetBufferDuration() const;
131 137
132 // Comparison with other AudioParams. 138 // Comparison with other AudioParams.
133 bool Equals(const AudioParameters& other) const; 139 bool Equals(const AudioParameters& other) const;
134 140
135 void set_format(Format format) { format_ = format; } 141 void set_format(Format format) { format_ = format; }
136 Format format() const { return format_; } 142 Format format() const { return format_; }
137 143
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 if (a.sample_rate() != b.sample_rate()) 210 if (a.sample_rate() != b.sample_rate())
205 return a.sample_rate() < b.sample_rate(); 211 return a.sample_rate() < b.sample_rate();
206 if (a.bits_per_sample() != b.bits_per_sample()) 212 if (a.bits_per_sample() != b.bits_per_sample())
207 return a.bits_per_sample() < b.bits_per_sample(); 213 return a.bits_per_sample() < b.bits_per_sample();
208 return a.frames_per_buffer() < b.frames_per_buffer(); 214 return a.frames_per_buffer() < b.frames_per_buffer();
209 } 215 }
210 216
211 } // namespace media 217 } // namespace media
212 218
213 #endif // MEDIA_AUDIO_AUDIO_PARAMETERS_H_ 219 #endif // MEDIA_AUDIO_AUDIO_PARAMETERS_H_
OLDNEW
« no previous file with comments | « media/audio/audio_output_stream_sink.cc ('k') | media/audio/audio_parameters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698