Commit 9c6b3351 authored by Shik Chen's avatar Shik Chen Committed by Commit Bot

CCA: Remove thumbnail size limit for video

The size limit optimization only applies for fragemented MP4. Chrome
needs the whole file of a non-fragemented MP4 to be able to play it.

Bug: 1140852
Test: Record a video and check the thumbnail manually.
Change-Id: I3f4d6d7c317c21203761372265b7283bac4734f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2513415
Auto-Submit: Shik Chen <shik@chromium.org>
Commit-Queue: Inker Kuo <inker@chromium.org>
Reviewed-by: default avatarInker Kuo <inker@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823394}
parent 011da4ee
......@@ -21,15 +21,6 @@ import * as util from './util.js';
*/
const THUMBNAIL_WIDTH = 240;
/**
* The maximum size of video used to generate the thumbnail. The file would be
* truncated to that size before generating the thumbnail, which speeds up the
* generation process significantly when the file is large. 32MB should be more
* than enough for getting the first frame from a video.
* @type {number}
*/
const VIDEO_THUMBNAIL_SIZE_LIMIT = 32 << 20;
/**
* Cover photo of gallery button.
*/
......@@ -74,8 +65,7 @@ class CoverPhoto {
*/
static async create(file) {
const isVideo = filesystem.hasVideoPrefix(file);
const limit = isVideo ? VIDEO_THUMBNAIL_SIZE_LIMIT : Infinity;
const fileUrl = await filesystem.pictureURL(file, {limit});
const fileUrl = await filesystem.pictureURL(file);
const thumbnail =
await util.scalePicture(fileUrl, isVideo, THUMBNAIL_WIDTH);
URL.revokeObjectURL(fileUrl);
......
......@@ -146,16 +146,11 @@ export async function getEntries() {
}
/**
* Returns an URL for a picture given by the file |entry|. Optionally, if
* |limit| is specified, the file would be truncated if it's larger than it.
* Returns an URL for a picture given by the file |entry|.
* @param {!AbstractFileEntry} entry The file entry of the picture.
* @param {{limit: (number|undefined)}=} options
* @return {!Promise<string>} Promise for the result.
*/
export async function pictureURL(entry, {limit = Infinity} = {}) {
let file = await entry.file();
if (file.size > limit) {
file = file.slice(0, limit);
}
export async function pictureURL(entry) {
const file = await entry.file();
return URL.createObjectURL(file);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment