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

Side by Side Diff: media/audio/mac/audio_auhal_mac.h

Issue 1973503003: (Relanding) Restores larger output buffer size when output stream requiring smaller size is closed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added comment Created 4 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 | media/audio/mac/audio_auhal_mac.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // Implementation notes: 5 // Implementation notes:
6 // 6 //
7 // - It is recommended to first acquire the native sample rate of the default 7 // - It is recommended to first acquire the native sample rate of the default
8 // output device and then use the same rate when creating this object. 8 // output device and then use the same rate when creating this object.
9 // Use AudioManagerMac::HardwareSampleRate() to retrieve the sample rate. 9 // Use AudioManagerMac::HardwareSampleRate() to retrieve the sample rate.
10 // - Calling Close() also leads to self destruction. 10 // - Calling Close() also leads to self destruction.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // Implementation of AudioOutputStream. 81 // Implementation of AudioOutputStream.
82 bool Open() override; 82 bool Open() override;
83 void Close() override; 83 void Close() override;
84 void Start(AudioSourceCallback* callback) override; 84 void Start(AudioSourceCallback* callback) override;
85 void Stop() override; 85 void Stop() override;
86 void SetVolume(double volume) override; 86 void SetVolume(double volume) override;
87 void GetVolume(double* volume) override; 87 void GetVolume(double* volume) override;
88 88
89 AudioDeviceID device_id() const { return device_; } 89 AudioDeviceID device_id() const { return device_; }
90 size_t requested_buffer_size() const { return number_of_frames_; } 90 size_t requested_buffer_size() const { return number_of_frames_; }
91 AudioUnit audio_unit() const { return audio_unit_; }
91 92
92 private: 93 private:
93 // AUHAL callback. 94 // AUHAL callback.
94 static OSStatus InputProc(void* user_data, 95 static OSStatus InputProc(void* user_data,
95 AudioUnitRenderActionFlags* flags, 96 AudioUnitRenderActionFlags* flags,
96 const AudioTimeStamp* time_stamp, 97 const AudioTimeStamp* time_stamp,
97 UInt32 bus_number, 98 UInt32 bus_number,
98 UInt32 number_of_frames, 99 UInt32 number_of_frames,
99 AudioBufferList* io_data); 100 AudioBufferList* io_data);
100 101
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // Called from the dtor and when the stream is reset. 139 // Called from the dtor and when the stream is reset.
139 void ReportAndResetStats(); 140 void ReportAndResetStats();
140 141
141 // Our creator, the audio manager needs to be notified when we close. 142 // Our creator, the audio manager needs to be notified when we close.
142 AudioManagerMac* const manager_; 143 AudioManagerMac* const manager_;
143 144
144 const AudioParameters params_; 145 const AudioParameters params_;
145 // For convenience - same as in params_. 146 // For convenience - same as in params_.
146 const int output_channels_; 147 const int output_channels_;
147 148
148 // Buffer-size. 149 // Size of audio buffer requested at construction. The actual buffer size
150 // is given by |actual_io_buffer_frame_size_| and it can differ from the
151 // requested size.
149 const size_t number_of_frames_; 152 const size_t number_of_frames_;
150 153
151 // Stores the number of frames that we actually get callbacks for. 154 // Stores the number of frames that we actually get callbacks for.
152 // This may be different from what we ask for, so we use this for stats in 155 // This may be different from what we ask for, so we use this for stats in
153 // order to understand how often this happens and what are the typical values. 156 // order to understand how often this happens and what are the typical values.
154 size_t number_of_frames_requested_; 157 size_t number_of_frames_requested_;
155 158
156 // Pointer to the object that will provide the audio samples. 159 // Pointer to the object that will provide the audio samples.
157 AudioSourceCallback* source_; 160 AudioSourceCallback* source_;
158 161
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 // Used to make sure control functions (Start(), Stop() etc) are called on the 217 // Used to make sure control functions (Start(), Stop() etc) are called on the
215 // right thread. 218 // right thread.
216 base::ThreadChecker thread_checker_; 219 base::ThreadChecker thread_checker_;
217 220
218 DISALLOW_COPY_AND_ASSIGN(AUHALStream); 221 DISALLOW_COPY_AND_ASSIGN(AUHALStream);
219 }; 222 };
220 223
221 } // namespace media 224 } // namespace media
222 225
223 #endif // MEDIA_AUDIO_MAC_AUDIO_AUHAL_MAC_H_ 226 #endif // MEDIA_AUDIO_MAC_AUDIO_AUHAL_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | media/audio/mac/audio_auhal_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698