| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 RTC_DCHECK(!initialized_); | 125 RTC_DCHECK(!initialized_); |
| 126 RTC_DCHECK(!recording_); | 126 RTC_DCHECK(!recording_); |
| 127 int frames_per_buffer = j_audio_record_->InitRecording( | 127 int frames_per_buffer = j_audio_record_->InitRecording( |
| 128 audio_parameters_.sample_rate(), audio_parameters_.channels()); | 128 audio_parameters_.sample_rate(), audio_parameters_.channels()); |
| 129 if (frames_per_buffer < 0) { | 129 if (frames_per_buffer < 0) { |
| 130 ALOGE("InitRecording failed!"); | 130 ALOGE("InitRecording failed!"); |
| 131 return -1; | 131 return -1; |
| 132 } | 132 } |
| 133 frames_per_buffer_ = static_cast<size_t>(frames_per_buffer); | 133 frames_per_buffer_ = static_cast<size_t>(frames_per_buffer); |
| 134 ALOGD("frames_per_buffer: %" PRIuS, frames_per_buffer_); | 134 ALOGD("frames_per_buffer: %" PRIuS, frames_per_buffer_); |
| 135 const size_t bytes_per_frame = audio_parameters_.channels() * sizeof(int16_t); |
| 135 RTC_CHECK_EQ(direct_buffer_capacity_in_bytes_, | 136 RTC_CHECK_EQ(direct_buffer_capacity_in_bytes_, |
| 136 frames_per_buffer_ * kBytesPerFrame); | 137 frames_per_buffer_ * bytes_per_frame); |
| 137 RTC_CHECK_EQ(frames_per_buffer_, audio_parameters_.frames_per_10ms_buffer()); | 138 RTC_CHECK_EQ(frames_per_buffer_, audio_parameters_.frames_per_10ms_buffer()); |
| 138 initialized_ = true; | 139 initialized_ = true; |
| 139 return 0; | 140 return 0; |
| 140 } | 141 } |
| 141 | 142 |
| 142 int32_t AudioRecordJni::StartRecording() { | 143 int32_t AudioRecordJni::StartRecording() { |
| 143 ALOGD("StartRecording%s", GetThreadInfo().c_str()); | 144 ALOGD("StartRecording%s", GetThreadInfo().c_str()); |
| 144 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 145 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 145 RTC_DCHECK(initialized_); | 146 RTC_DCHECK(initialized_); |
| 146 RTC_DCHECK(!recording_); | 147 RTC_DCHECK(!recording_); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 // of |playDelayMs| and |recDelayMs|, hence the distributions does not matter. | 248 // of |playDelayMs| and |recDelayMs|, hence the distributions does not matter. |
| 248 audio_device_buffer_->SetVQEData(total_delay_in_milliseconds_, | 249 audio_device_buffer_->SetVQEData(total_delay_in_milliseconds_, |
| 249 0, // recDelayMs | 250 0, // recDelayMs |
| 250 0); // clockDrift | 251 0); // clockDrift |
| 251 if (audio_device_buffer_->DeliverRecordedData() == -1) { | 252 if (audio_device_buffer_->DeliverRecordedData() == -1) { |
| 252 ALOGE("AudioDeviceBuffer::DeliverRecordedData failed!"); | 253 ALOGE("AudioDeviceBuffer::DeliverRecordedData failed!"); |
| 253 } | 254 } |
| 254 } | 255 } |
| 255 | 256 |
| 256 } // namespace webrtc | 257 } // namespace webrtc |
| OLD | NEW |