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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 return -1; | 172 return -1; |
173 } | 173 } |
174 | 174 |
175 void OpenSLESPlayer::AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) { | 175 void OpenSLESPlayer::AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) { |
176 ALOGD("AttachAudioBuffer"); | 176 ALOGD("AttachAudioBuffer"); |
177 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 177 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
178 audio_device_buffer_ = audioBuffer; | 178 audio_device_buffer_ = audioBuffer; |
179 const int sample_rate_hz = audio_parameters_.sample_rate(); | 179 const int sample_rate_hz = audio_parameters_.sample_rate(); |
180 ALOGD("SetPlayoutSampleRate(%d)", sample_rate_hz); | 180 ALOGD("SetPlayoutSampleRate(%d)", sample_rate_hz); |
181 audio_device_buffer_->SetPlayoutSampleRate(sample_rate_hz); | 181 audio_device_buffer_->SetPlayoutSampleRate(sample_rate_hz); |
182 const int channels = audio_parameters_.channels(); | 182 const size_t channels = audio_parameters_.channels(); |
183 ALOGD("SetPlayoutChannels(%d)", channels); | 183 ALOGD("SetPlayoutChannels(%" PRIuS ")", channels); |
184 audio_device_buffer_->SetPlayoutChannels(channels); | 184 audio_device_buffer_->SetPlayoutChannels(channels); |
185 RTC_CHECK(audio_device_buffer_); | 185 RTC_CHECK(audio_device_buffer_); |
186 AllocateDataBuffers(); | 186 AllocateDataBuffers(); |
187 } | 187 } |
188 | 188 |
189 SLDataFormat_PCM OpenSLESPlayer::CreatePCMConfiguration( | 189 SLDataFormat_PCM OpenSLESPlayer::CreatePCMConfiguration( |
190 int channels, | 190 size_t channels, |
191 int sample_rate, | 191 int sample_rate, |
192 size_t bits_per_sample) { | 192 size_t bits_per_sample) { |
193 ALOGD("CreatePCMConfiguration"); | 193 ALOGD("CreatePCMConfiguration"); |
194 RTC_CHECK_EQ(bits_per_sample, SL_PCMSAMPLEFORMAT_FIXED_16); | 194 RTC_CHECK_EQ(bits_per_sample, SL_PCMSAMPLEFORMAT_FIXED_16); |
195 SLDataFormat_PCM format; | 195 SLDataFormat_PCM format; |
196 format.formatType = SL_DATAFORMAT_PCM; | 196 format.formatType = SL_DATAFORMAT_PCM; |
197 format.numChannels = static_cast<SLuint32>(channels); | 197 format.numChannels = static_cast<SLuint32>(channels); |
198 // Note that, the unit of sample rate is actually in milliHertz and not Hertz. | 198 // Note that, the unit of sample rate is actually in milliHertz and not Hertz. |
199 switch (sample_rate) { | 199 switch (sample_rate) { |
200 case 8000: | 200 case 8000: |
(...skipping 257 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 |