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

Commit 59ed7441 authored by guochuang's avatar guochuang
Browse files

VideoThumbnail: improve thumbnailTimeUs.



In many cases, apps directly using MMR will select a frame at the
beginning of the video as the video cover. The use of ThumbnailUtils
should also be consistent to avoid inconsistent display of covers
when transferring videos between different apps.

Change-Id: I64c62e9613131a38e80801a2bd73a4a83c7bcdbd
Signed-off-by: default avatarguochuang <guochuang@xiaomi.corp-partner.google.com>
parent bb99f502
Loading
Loading
Loading
Loading
+2 −4
Original line number Original line Diff line number Diff line
@@ -375,10 +375,8 @@ public class ThumbnailUtils {


            final int width = Integer.parseInt(mmr.extractMetadata(METADATA_KEY_VIDEO_WIDTH));
            final int width = Integer.parseInt(mmr.extractMetadata(METADATA_KEY_VIDEO_WIDTH));
            final int height = Integer.parseInt(mmr.extractMetadata(METADATA_KEY_VIDEO_HEIGHT));
            final int height = Integer.parseInt(mmr.extractMetadata(METADATA_KEY_VIDEO_HEIGHT));
            // Fall back to middle of video
            // Returns whatever frame the implementation considers representative.
            // Note: METADATA_KEY_DURATION unit is in ms, not us.
            final long thumbnailTimeUs = -1;
            final long thumbnailTimeUs =
                    Long.parseLong(mmr.extractMetadata(METADATA_KEY_DURATION)) * 1000 / 2;


            // If we're okay with something larger than native format, just
            // If we're okay with something larger than native format, just
            // return a frame without up-scaling it
            // return a frame without up-scaling it