Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 996af72b authored by Jean-Michel Trivi's avatar Jean-Michel Trivi Committed by Android (Google) Code Review
Browse files

Merge "AudioRecord: filter attributes" into lmp-mr1-dev

parents 2c8c47da 43bcd8fa
Loading
Loading
Loading
Loading
+11 −6
Original line number Original line Diff line number Diff line
@@ -273,18 +273,23 @@ public class AudioRecord
            mInitializationLooper = Looper.getMainLooper();
            mInitializationLooper = Looper.getMainLooper();
        }
        }


        mAudioAttributes = attributes;

        // is this AudioRecord using REMOTE_SUBMIX at full volume?
        // is this AudioRecord using REMOTE_SUBMIX at full volume?
        if (mAudioAttributes.getCapturePreset() == MediaRecorder.AudioSource.REMOTE_SUBMIX) {
        if (attributes.getCapturePreset() == MediaRecorder.AudioSource.REMOTE_SUBMIX) {
            final Iterator<String> tagsIter = mAudioAttributes.getTags().iterator();
            final AudioAttributes.Builder filteredAttr = new AudioAttributes.Builder();
            final Iterator<String> tagsIter = attributes.getTags().iterator();
            while (tagsIter.hasNext()) {
            while (tagsIter.hasNext()) {
                if (tagsIter.next().equalsIgnoreCase(SUBMIX_FIXED_VOLUME)) {
                final String tag = tagsIter.next();
                if (tag.equalsIgnoreCase(SUBMIX_FIXED_VOLUME)) {
                    mIsSubmixFullVolume = true;
                    mIsSubmixFullVolume = true;
                    Log.v(TAG, "Will record from REMOTE_SUBMIX at full fixed volume");
                    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;
        int rate = 0;