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

Side by Side Diff: webrtc/modules/audio_device/android/audio_record_jni.cc

Issue 2499613002: Adds stereo support for Java-based input and output audio on Android (Closed)
Patch Set: Feedback from magjed@ Created 4 years, 1 month 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) 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
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
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
OLDNEW
« no previous file with comments | « webrtc/modules/audio_device/android/audio_manager.cc ('k') | webrtc/modules/audio_device/android/audio_track_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698