OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 RTC_CHECK(audio_device_buffer_); | 238 RTC_CHECK(audio_device_buffer_); |
239 // Don't use the lowest possible size as native buffer size. Instead, | 239 // Don't use the lowest possible size as native buffer size. Instead, |
240 // use 10ms to better match the frame size that WebRTC uses. It will result | 240 // use 10ms to better match the frame size that WebRTC uses. It will result |
241 // in a reduced risk for audio glitches and also in a more "clean" sequence | 241 // in a reduced risk for audio glitches and also in a more "clean" sequence |
242 // of callbacks from the OpenSL ES thread in to WebRTC when asking for audio | 242 // of callbacks from the OpenSL ES thread in to WebRTC when asking for audio |
243 // to render. | 243 // to render. |
244 ALOGD("lowest possible buffer size: %" PRIuS, | 244 ALOGD("lowest possible buffer size: %" PRIuS, |
245 audio_parameters_.GetBytesPerBuffer()); | 245 audio_parameters_.GetBytesPerBuffer()); |
246 bytes_per_buffer_ = audio_parameters_.GetBytesPerFrame() * | 246 bytes_per_buffer_ = audio_parameters_.GetBytesPerFrame() * |
247 audio_parameters_.frames_per_10ms_buffer(); | 247 audio_parameters_.frames_per_10ms_buffer(); |
248 RTC_DCHECK_GT(bytes_per_buffer_, audio_parameters_.GetBytesPerBuffer()); | 248 RTC_DCHECK_GE(bytes_per_buffer_, audio_parameters_.GetBytesPerBuffer()); |
249 ALOGD("native buffer size: %" PRIuS, bytes_per_buffer_); | 249 ALOGD("native buffer size: %" PRIuS, bytes_per_buffer_); |
250 // Create a modified audio buffer class which allows us to ask for any number | 250 // Create a modified audio buffer class which allows us to ask for any number |
251 // of samples (and not only multiple of 10ms) to match the native OpenSL ES | 251 // of samples (and not only multiple of 10ms) to match the native OpenSL ES |
252 // buffer size. | 252 // buffer size. |
253 fine_buffer_.reset(new FineAudioBuffer(audio_device_buffer_, | 253 fine_buffer_.reset(new FineAudioBuffer(audio_device_buffer_, |
254 bytes_per_buffer_, | 254 bytes_per_buffer_, |
255 audio_parameters_.sample_rate())); | 255 audio_parameters_.sample_rate())); |
256 // Each buffer must be of this size to avoid unnecessary memcpy while caching | 256 // Each buffer must be of this size to avoid unnecessary memcpy while caching |
257 // data between successive callbacks. | 257 // data between successive callbacks. |
258 const size_t required_buffer_size = | 258 const size_t required_buffer_size = |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 RTC_DCHECK(player_); | 458 RTC_DCHECK(player_); |
459 SLuint32 state; | 459 SLuint32 state; |
460 SLresult err = (*player_)->GetPlayState(player_, &state); | 460 SLresult err = (*player_)->GetPlayState(player_, &state); |
461 if (SL_RESULT_SUCCESS != err) { | 461 if (SL_RESULT_SUCCESS != err) { |
462 ALOGE("GetPlayState failed: %d", err); | 462 ALOGE("GetPlayState failed: %d", err); |
463 } | 463 } |
464 return state; | 464 return state; |
465 } | 465 } |
466 | 466 |
467 } // namespace webrtc | 467 } // namespace webrtc |
OLD | NEW |