| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 | 10 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 int32_t AudioDeviceBuffer::PlayoutSampleRate() const | 163 int32_t AudioDeviceBuffer::PlayoutSampleRate() const |
| 164 { | 164 { |
| 165 return _playSampleRate; | 165 return _playSampleRate; |
| 166 } | 166 } |
| 167 | 167 |
| 168 // ---------------------------------------------------------------------------- | 168 // ---------------------------------------------------------------------------- |
| 169 // SetRecordingChannels | 169 // SetRecordingChannels |
| 170 // ---------------------------------------------------------------------------- | 170 // ---------------------------------------------------------------------------- |
| 171 | 171 |
| 172 int32_t AudioDeviceBuffer::SetRecordingChannels(uint8_t channels) | 172 int32_t AudioDeviceBuffer::SetRecordingChannels(size_t channels) |
| 173 { | 173 { |
| 174 CriticalSectionScoped lock(&_critSect); | 174 CriticalSectionScoped lock(&_critSect); |
| 175 _recChannels = channels; | 175 _recChannels = channels; |
| 176 _recBytesPerSample = 2*channels; // 16 bits per sample in mono, 32 bits in
stereo | 176 _recBytesPerSample = 2*channels; // 16 bits per sample in mono, 32 bits in
stereo |
| 177 return 0; | 177 return 0; |
| 178 } | 178 } |
| 179 | 179 |
| 180 // ---------------------------------------------------------------------------- | 180 // ---------------------------------------------------------------------------- |
| 181 // SetPlayoutChannels | 181 // SetPlayoutChannels |
| 182 // ---------------------------------------------------------------------------- | 182 // ---------------------------------------------------------------------------- |
| 183 | 183 |
| 184 int32_t AudioDeviceBuffer::SetPlayoutChannels(uint8_t channels) | 184 int32_t AudioDeviceBuffer::SetPlayoutChannels(size_t channels) |
| 185 { | 185 { |
| 186 CriticalSectionScoped lock(&_critSect); | 186 CriticalSectionScoped lock(&_critSect); |
| 187 _playChannels = channels; | 187 _playChannels = channels; |
| 188 // 16 bits per sample in mono, 32 bits in stereo | 188 // 16 bits per sample in mono, 32 bits in stereo |
| 189 _playBytesPerSample = 2*channels; | 189 _playBytesPerSample = 2*channels; |
| 190 return 0; | 190 return 0; |
| 191 } | 191 } |
| 192 | 192 |
| 193 // ---------------------------------------------------------------------------- | 193 // ---------------------------------------------------------------------------- |
| 194 // SetRecordingChannel | 194 // SetRecordingChannel |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 int32_t AudioDeviceBuffer::RecordingChannel(AudioDeviceModule::ChannelType& chan
nel) const | 232 int32_t AudioDeviceBuffer::RecordingChannel(AudioDeviceModule::ChannelType& chan
nel) const |
| 233 { | 233 { |
| 234 channel = _recChannel; | 234 channel = _recChannel; |
| 235 return 0; | 235 return 0; |
| 236 } | 236 } |
| 237 | 237 |
| 238 // ---------------------------------------------------------------------------- | 238 // ---------------------------------------------------------------------------- |
| 239 // RecordingChannels | 239 // RecordingChannels |
| 240 // ---------------------------------------------------------------------------- | 240 // ---------------------------------------------------------------------------- |
| 241 | 241 |
| 242 uint8_t AudioDeviceBuffer::RecordingChannels() const | 242 size_t AudioDeviceBuffer::RecordingChannels() const |
| 243 { | 243 { |
| 244 return _recChannels; | 244 return _recChannels; |
| 245 } | 245 } |
| 246 | 246 |
| 247 // ---------------------------------------------------------------------------- | 247 // ---------------------------------------------------------------------------- |
| 248 // PlayoutChannels | 248 // PlayoutChannels |
| 249 // ---------------------------------------------------------------------------- | 249 // ---------------------------------------------------------------------------- |
| 250 | 250 |
| 251 uint8_t AudioDeviceBuffer::PlayoutChannels() const | 251 size_t AudioDeviceBuffer::PlayoutChannels() const |
| 252 { | 252 { |
| 253 return _playChannels; | 253 return _playChannels; |
| 254 } | 254 } |
| 255 | 255 |
| 256 // ---------------------------------------------------------------------------- | 256 // ---------------------------------------------------------------------------- |
| 257 // SetCurrentMicLevel | 257 // SetCurrentMicLevel |
| 258 // ---------------------------------------------------------------------------- | 258 // ---------------------------------------------------------------------------- |
| 259 | 259 |
| 260 int32_t AudioDeviceBuffer::SetCurrentMicLevel(uint32_t level) | 260 int32_t AudioDeviceBuffer::SetCurrentMicLevel(uint32_t level) |
| 261 { | 261 { |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 } | 480 } |
| 481 | 481 |
| 482 // ---------------------------------------------------------------------------- | 482 // ---------------------------------------------------------------------------- |
| 483 // RequestPlayoutData | 483 // RequestPlayoutData |
| 484 // ---------------------------------------------------------------------------- | 484 // ---------------------------------------------------------------------------- |
| 485 | 485 |
| 486 int32_t AudioDeviceBuffer::RequestPlayoutData(size_t nSamples) | 486 int32_t AudioDeviceBuffer::RequestPlayoutData(size_t nSamples) |
| 487 { | 487 { |
| 488 uint32_t playSampleRate = 0; | 488 uint32_t playSampleRate = 0; |
| 489 size_t playBytesPerSample = 0; | 489 size_t playBytesPerSample = 0; |
| 490 uint8_t playChannels = 0; | 490 size_t playChannels = 0; |
| 491 { | 491 { |
| 492 CriticalSectionScoped lock(&_critSect); | 492 CriticalSectionScoped lock(&_critSect); |
| 493 | 493 |
| 494 // Store copies under lock and use copies hereafter to avoid race with | 494 // Store copies under lock and use copies hereafter to avoid race with |
| 495 // setter methods. | 495 // setter methods. |
| 496 playSampleRate = _playSampleRate; | 496 playSampleRate = _playSampleRate; |
| 497 playBytesPerSample = _playBytesPerSample; | 497 playBytesPerSample = _playBytesPerSample; |
| 498 playChannels = _playChannels; | 498 playChannels = _playChannels; |
| 499 | 499 |
| 500 // Ensure that user has initialized all essential members | 500 // Ensure that user has initialized all essential members |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 if (_playFile.Open()) | 575 if (_playFile.Open()) |
| 576 { | 576 { |
| 577 // write to binary file in mono or stereo (interleaved) | 577 // write to binary file in mono or stereo (interleaved) |
| 578 _playFile.Write(&_playBuffer[0], _playSize); | 578 _playFile.Write(&_playBuffer[0], _playSize); |
| 579 } | 579 } |
| 580 | 580 |
| 581 return static_cast<int32_t>(_playSamples); | 581 return static_cast<int32_t>(_playSamples); |
| 582 } | 582 } |
| 583 | 583 |
| 584 } // namespace webrtc | 584 } // namespace webrtc |
| OLD | NEW |