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

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

Issue 22886005: Switch audio synchronization from sleep() based to select() based. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix DCHECK. Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « media/audio/audio_output_device_unittest.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 "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/time/time.h"
9 #include "media/base/channel_layout.h" 10 #include "media/base/channel_layout.h"
10 #include "media/base/media_export.h" 11 #include "media/base/media_export.h"
11 12
12 namespace media { 13 namespace media {
13 14
14 struct MEDIA_EXPORT AudioInputBufferParameters { 15 struct MEDIA_EXPORT AudioInputBufferParameters {
15 double volume; 16 double volume;
16 uint32 size; 17 uint32 size;
17 bool key_pressed; 18 bool key_pressed;
18 }; 19 };
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 63
63 // Returns size of audio buffer in bytes. 64 // Returns size of audio buffer in bytes.
64 int GetBytesPerBuffer() const; 65 int GetBytesPerBuffer() const;
65 66
66 // Returns the number of bytes representing one second of audio. 67 // Returns the number of bytes representing one second of audio.
67 int GetBytesPerSecond() const; 68 int GetBytesPerSecond() const;
68 69
69 // Returns the number of bytes representing a frame of audio. 70 // Returns the number of bytes representing a frame of audio.
70 int GetBytesPerFrame() const; 71 int GetBytesPerFrame() const;
71 72
73 // Returns the duration of this buffer as calculated from frames_per_buffer()
74 // and sample_rate().
75 base::TimeDelta GetBufferDuration() const;
76
72 Format format() const { return format_; } 77 Format format() const { return format_; }
73 ChannelLayout channel_layout() const { return channel_layout_; } 78 ChannelLayout channel_layout() const { return channel_layout_; }
74 int sample_rate() const { return sample_rate_; } 79 int sample_rate() const { return sample_rate_; }
75 int bits_per_sample() const { return bits_per_sample_; } 80 int bits_per_sample() const { return bits_per_sample_; }
76 int frames_per_buffer() const { return frames_per_buffer_; } 81 int frames_per_buffer() const { return frames_per_buffer_; }
77 int channels() const { return channels_; } 82 int channels() const { return channels_; }
78 int input_channels() const { return input_channels_; } 83 int input_channels() const { return input_channels_; }
79 84
80 // Set to CHANNEL_LAYOUT_DISCRETE with given number of channels. 85 // Set to CHANNEL_LAYOUT_DISCRETE with given number of channels.
81 void SetDiscreteChannels(int channels); 86 void SetDiscreteChannels(int channels);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 if (a.sample_rate() != b.sample_rate()) 121 if (a.sample_rate() != b.sample_rate())
117 return a.sample_rate() < b.sample_rate(); 122 return a.sample_rate() < b.sample_rate();
118 if (a.bits_per_sample() != b.bits_per_sample()) 123 if (a.bits_per_sample() != b.bits_per_sample())
119 return a.bits_per_sample() < b.bits_per_sample(); 124 return a.bits_per_sample() < b.bits_per_sample();
120 return a.frames_per_buffer() < b.frames_per_buffer(); 125 return a.frames_per_buffer() < b.frames_per_buffer();
121 } 126 }
122 127
123 } // namespace media 128 } // namespace media
124 129
125 #endif // MEDIA_AUDIO_AUDIO_PARAMETERS_H_ 130 #endif // MEDIA_AUDIO_AUDIO_PARAMETERS_H_
OLDNEW
« no previous file with comments | « media/audio/audio_output_device_unittest.cc ('k') | media/audio/audio_parameters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698