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

Commit 7d696272 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Default compressed audio bytes per sample to 1" am: aa2884ac am:...

Merge "Default compressed audio bytes per sample to 1" am: aa2884ac am: ce94c11c am: 313ffe6d am: 32039640

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1444316

Change-Id: Ib844aac2d53edb1d8c9de4fb258c2daf038f0a45
parents 96de8166 32039640
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -1263,14 +1263,20 @@ public class AudioTrack extends PlayerBase

            // TODO: Check mEncapsulationMode compatibility with MODE_STATIC, etc?

            try {
            // If the buffer size is not specified in streaming mode,
            // use a single frame for the buffer size and let the
            // native code figure out the minimum buffer size.
            if (mMode == MODE_STREAM && mBufferSizeInBytes == 0) {
                    mBufferSizeInBytes = mFormat.getChannelCount()
                            * mFormat.getBytesPerSample(mFormat.getEncoding());
                int bytesPerSample = 1;
                try {
                    bytesPerSample = mFormat.getBytesPerSample(mFormat.getEncoding());
                } catch (IllegalArgumentException e) {
                    // do nothing
                }
                mBufferSizeInBytes = mFormat.getChannelCount() * bytesPerSample;
            }

            try {
                final AudioTrack track = new AudioTrack(
                        mAttributes, mFormat, mBufferSizeInBytes, mMode, mSessionId, mOffload,
                        mEncapsulationMode, mTunerConfiguration);