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

Commit 3fa9158b authored by Wonsik Kim's avatar Wonsik Kim
Browse files

MediaCodecInfo: do not alter performance points for 32-bit processes

Bug: 173488434
Test: atest CtsMediaTestCases:MediaCodecListTest
Change-Id: Ie40557dc0401411cc51650ea42c0fd75f90c67ce
parent 85ebf98d
Loading
Loading
Loading
Loading
+5 −28
Original line number Original line Diff line number Diff line
@@ -1865,10 +1865,6 @@ public final class MediaCodecInfo {
                        && aligned.mMaxMacroBlockRate >= otherAligned.mMaxMacroBlockRate);
                        && aligned.mMaxMacroBlockRate >= otherAligned.mMaxMacroBlockRate);
            }
            }


            /* package private */ boolean isEqualDimension(@NonNull PerformancePoint other) {
                return mWidth == other.mWidth && mHeight == other.mHeight;
            }

            private @NonNull Size getCommonBlockSize(@NonNull PerformancePoint other) {
            private @NonNull Size getCommonBlockSize(@NonNull PerformancePoint other) {
                return new Size(
                return new Size(
                        Math.max(mBlockSize.getWidth(), other.mBlockSize.getWidth()) * 16,
                        Math.max(mBlockSize.getWidth(), other.mBlockSize.getWidth()) * 16,
@@ -2010,8 +2006,11 @@ public final class MediaCodecInfo {
         * codecs are active, should use that highest pixel count, and add the frame rates of
         * codecs are active, should use that highest pixel count, and add the frame rates of
         * each individual codec.
         * each individual codec.
         * <p class=note>
         * <p class=note>
         * Supported resolution could be further restricted for 32-bit processes due to
         * 32-bit processes will not support resolutions larger than 4096x4096 due to
         * the limited virtual memory space.
         * the limited address space, but performance points will be presented as is.
         * In other words, even though a component publishes a performance point for
         * a resolution higher than 4096x4096, it does not mean that the resolution is supported
         * for 32-bit processes.
         */
         */
        @Nullable
        @Nullable
        public List<PerformancePoint> getSupportedPerformancePoints() {
        public List<PerformancePoint> getSupportedPerformancePoints() {
@@ -2215,28 +2214,6 @@ public final class MediaCodecInfo {
                       (a.getMaxFrameRate() != b.getMaxFrameRate()) ?
                       (a.getMaxFrameRate() != b.getMaxFrameRate()) ?
                               (a.getMaxFrameRate() < b.getMaxFrameRate() ? -1 : 1) : 0));
                               (a.getMaxFrameRate() < b.getMaxFrameRate() ? -1 : 1) : 0));


            // remove redundant points
            for (int i = 1; i < ret.size(); ++i) {
                PerformancePoint a = ret.get(i);
                for (int j = 0; j < i; ++j) {
                    PerformancePoint b = ret.get(j);
                    if (b.isEqualDimension(a) && b.covers(a)) {
                        ret.set(i, null);
                        break;
                    }
                }
            }
            int newSize = 0;
            for (int i = 0; i < ret.size(); ++i) {
                PerformancePoint a = ret.get(i);
                if (a == null) {
                    continue;
                }
                ret.set(newSize, a);
                ++newSize;
            }
            ret.setSize(newSize);

            return Collections.unmodifiableList(ret);
            return Collections.unmodifiableList(ret);
        }
        }