Merge "Fix unitialized member/init-parameter in AudioTrack(long) and AudioRecord(long)." into nyc-dev

This commit is contained in:
Paul Mclean
2016-02-26 20:24:37 +00:00
committed by Android (Google) Code Review
2 changed files with 6 additions and 4 deletions

View File

@@ -395,20 +395,21 @@ public class AudioRecord implements AudioRouting
*/
/*package*/ AudioRecord(long nativeRecordInJavaObj) {
int[] session = { 0 };
int[] rates = { 0 };
//TODO: update native initialization when information about hardware init failure
// due to capture device already open is available.
// Note that for this native_setup, we are providing an already created/initialized
// *Native* AudioRecord, so the attributes parameters to native_setup() are ignored.
int initResult = native_setup(new WeakReference<AudioRecord>(this),
null /*mAudioAttributes*/,
null /*mSampleRates*/,
rates /*mSampleRates*/,
0 /*mChannelMask*/,
0 /*mChannelIndexMask*/,
0 /*mAudioFormat*/,
0 /*mNativeBufferSizeInBytes*/,
session,
ActivityThread.currentOpPackageName(),
mNativeRecorderInJavaObj);
nativeRecordInJavaObj);
if (initResult != SUCCESS) {
loge("Error code "+initResult+" when initializing native AudioRecord object.");
return; // with mState == STATE_UNINITIALIZED

View File

@@ -543,16 +543,17 @@ public class AudioTrack implements AudioRouting
// Note that for this native_setup, we are providing an already created/initialized
// *Native* AudioTrack, so the attributes parameters to native_setup() are ignored.
int[] session = { 0 };
int[] rates = { 0 };
int initResult = native_setup(new WeakReference<AudioTrack>(this),
null /*mAttributes - NA*/,
null /*sampleRate - NA*/,
rates /*sampleRate - NA*/,
0 /*mChannelMask - NA*/,
0 /*mChannelIndexMask - NA*/,
0 /*mAudioFormat - NA*/,
0 /*mNativeBufferSizeInBytes - NA*/,
0 /*mDataLoadMode - NA*/,
session,
mNativeTrackInJavaObj);
nativeTrackInJavaObj);
if (initResult != SUCCESS) {
loge("Error code "+initResult+" when initializing AudioTrack.");
return; // with mState == STATE_UNINITIALIZED