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

Side by Side Diff: webrtc/modules/audio_device/dummy/file_audio_device.cc

Issue 1230503003: Update a ton of audio code to use size_t more correctly and in general reduce (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 #include <iostream> 10 #include <iostream>
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 return -1; 165 return -1;
166 } 166 }
167 167
168 int32_t FileAudioDevice::InitRecording() { 168 int32_t FileAudioDevice::InitRecording() {
169 CriticalSectionScoped lock(&_critSect); 169 CriticalSectionScoped lock(&_critSect);
170 170
171 if (_recording) { 171 if (_recording) {
172 return -1; 172 return -1;
173 } 173 }
174 174
175 _recordingFramesIn10MS = static_cast<uint32_t>(kRecordingFixedSampleRate/100); 175 _recordingFramesIn10MS = static_cast<size_t>(kRecordingFixedSampleRate / 100);
176 176
177 if (_ptrAudioBuffer) { 177 if (_ptrAudioBuffer) {
178 _ptrAudioBuffer->SetRecordingSampleRate(kRecordingFixedSampleRate); 178 _ptrAudioBuffer->SetRecordingSampleRate(kRecordingFixedSampleRate);
179 _ptrAudioBuffer->SetRecordingChannels(kRecordingNumChannels); 179 _ptrAudioBuffer->SetRecordingChannels(kRecordingNumChannels);
180 } 180 }
181 return 0; 181 return 0;
182 } 182 }
183 183
184 bool FileAudioDevice::RecordingIsInitialized() const { 184 bool FileAudioDevice::RecordingIsInitialized() const {
185 return true; 185 return true;
186 } 186 }
187 187
188 int32_t FileAudioDevice::StartPlayout() { 188 int32_t FileAudioDevice::StartPlayout() {
189 if (_playing) { 189 if (_playing) {
190 return 0; 190 return 0;
191 } 191 }
192 192
193 _playoutFramesIn10MS = static_cast<uint32_t>(kPlayoutFixedSampleRate/100); 193 _playoutFramesIn10MS = static_cast<size_t>(kPlayoutFixedSampleRate / 100);
194 _playing = true; 194 _playing = true;
195 _playoutFramesLeft = 0; 195 _playoutFramesLeft = 0;
196 196
197 if (!_playoutBuffer) { 197 if (!_playoutBuffer) {
198 _playoutBuffer = new int8_t[2 * 198 _playoutBuffer = new int8_t[2 *
199 kPlayoutNumChannels * 199 kPlayoutNumChannels *
200 kPlayoutFixedSampleRate/100]; 200 kPlayoutFixedSampleRate/100];
201 } 201 }
202 if (!_playoutBuffer) { 202 if (!_playoutBuffer) {
203 _playing = false; 203 _playing = false;
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 _critSect.Enter(); 542 _critSect.Enter();
543 } 543 }
544 } 544 }
545 545
546 _critSect.Leave(); 546 _critSect.Leave();
547 SleepMs(10 - (_clock->CurrentNtpInMilliseconds() - currentTime)); 547 SleepMs(10 - (_clock->CurrentNtpInMilliseconds() - currentTime));
548 return true; 548 return true;
549 } 549 }
550 550
551 } // namespace webrtc 551 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_device/dummy/file_audio_device.h ('k') | webrtc/modules/audio_device/include/audio_device_defines.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698