AudioRecord: filter attributes

When creating an AudioRecord instance, filter the tags in the
  AudioAttributes to remove tags that are handled at the Java
  layer.

Bug: 18733215
Bug: 18736417

Change-Id: I16a3497742086deced4e8677bd6231290396c5f6
This commit is contained in:
Jean-Michel Trivi
2014-12-19 09:34:07 -08:00
committed by Rachad Alao
parent 2281e7d6a1
commit 43bcd8fa74

View File

@@ -273,18 +273,23 @@ public class AudioRecord
mInitializationLooper = Looper.getMainLooper();
}
mAudioAttributes = attributes;
// is this AudioRecord using REMOTE_SUBMIX at full volume?
if (mAudioAttributes.getCapturePreset() == MediaRecorder.AudioSource.REMOTE_SUBMIX) {
final Iterator<String> tagsIter = mAudioAttributes.getTags().iterator();
if (attributes.getCapturePreset() == MediaRecorder.AudioSource.REMOTE_SUBMIX) {
final AudioAttributes.Builder filteredAttr = new AudioAttributes.Builder();
final Iterator<String> tagsIter = attributes.getTags().iterator();
while (tagsIter.hasNext()) {
if (tagsIter.next().equalsIgnoreCase(SUBMIX_FIXED_VOLUME)) {
final String tag = tagsIter.next();
if (tag.equalsIgnoreCase(SUBMIX_FIXED_VOLUME)) {
mIsSubmixFullVolume = true;
Log.v(TAG, "Will record from REMOTE_SUBMIX at full fixed volume");
break;
} else { // SUBMIX_FIXED_VOLUME: is not to be propagated to the native layers
filteredAttr.addTag(tag);
}
}
filteredAttr.setInternalCapturePreset(attributes.getCapturePreset());
mAudioAttributes = filteredAttr.build();
} else {
mAudioAttributes = attributes;
}
int rate = 0;