From 3606838d930f5df94aaab5524c5da2968f574104 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Sun, 12 May 2019 12:39:02 +0200 Subject: [PATCH] set video information on prearing also if recoding does not take place --- .../securesms/video/recode/VideoRecoder.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/org/thoughtcrime/securesms/video/recode/VideoRecoder.java b/src/org/thoughtcrime/securesms/video/recode/VideoRecoder.java index 485ab957b..7e68ea77c 100644 --- a/src/org/thoughtcrime/securesms/video/recode/VideoRecoder.java +++ b/src/org/thoughtcrime/securesms/video/recode/VideoRecoder.java @@ -766,21 +766,30 @@ public class VideoRecoder { try { String inPath = msg.getFile(); - if (!canRecode()) { - Log.w(TAG, String.format("recoding for %s failed: this system cannot recode videos", inPath)); - return; - } - + // try to get information from video file VideoEditedInfo vei = getVideoEditInfoFromFile(inPath); if (vei == null) { Log.w(TAG, String.format("recoding for %s failed: cannot get info", inPath)); return; } - vei.rotationValue = vei.originalRotationValue; vei.startTime = 0; vei.endTime = -1; + // set these information to the message object (not yet in database); + // if we can recdode, this will be overwritten below + if (vei.originalRotationValue == 90 || vei.originalRotationValue == 270) { + msg.setDimension(vei.originalHeight, vei.originalWidth); + } else { + msg.setDimension(vei.originalWidth, vei.originalHeight); + } + msg.setDuration((int)vei.originalDurationMs); + + if (!canRecode()) { + Log.w(TAG, String.format("recoding for %s failed: this system cannot recode videos", inPath)); + return; + } + // calculate video bitrate int MAX_BYTES = DcHelper.getInt(context, "sys.msgsize_max_recommended"); long resultDurationMs = (long) vei.originalDurationMs;