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

Commit a4b02cd8 authored by Derek Smith's avatar Derek Smith Committed by Jerry Wong
Browse files

media: check decoder support for thumbnail dimensions



Allow thumbnails to be decoded if a decoder supports the
thumbnail resolution but does not support the full image
resolution.

bug: 204349132
test: android.media.cts.ThumbnailUtilsTest

Signed-off-by: default avatarDerek Smith <derek.smith@broadcom.com>
Change-Id: I748509dca03afdb1a93852025d0be30b8df641ed
parent ed71a121
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -231,6 +231,15 @@ sp<IMemory> StagefrightMetadataRetriever::getImageInternal(
        format = NULL;
    }

    // If decoding thumbnail check decoder supports thumbnail dimensions instead
    int32_t thumbHeight, thumbWidth;
    if (thumbnail && format != NULL
            && trackMeta->findInt32(kKeyThumbnailHeight, &thumbHeight)
            && trackMeta->findInt32(kKeyThumbnailWidth, &thumbWidth)) {
        format->setInt32("height", thumbHeight);
        format->setInt32("width", thumbWidth);
    }

    MediaCodecList::findMatchingCodecs(
            mime,
            false, /* encoder */