From 76c8a67ade32affffef1da61dd2f9454f730984e Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Thu, 3 Jan 2019 22:48:47 +0100 Subject: introduced 'original' as video and image quality and do not ignorer error --- .../services/AttachFileToConversationRunnable.java | 13 ++++++++----- .../de/pixart/messenger/services/XmppConnectionService.java | 8 ++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'src/main/java/de/pixart/messenger/services') diff --git a/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java b/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java index 192d9221d..993de3bc6 100644 --- a/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java +++ b/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java @@ -49,12 +49,11 @@ public class AttachFileToConversationRunnable implements Runnable, MediaTranscod this.originalFileSize = FileBackend.getFileSize(mXmppConnectionService, uri); this.isVideoMessage = !getFileBackend().useFileAsIs(uri) && (mimeType != null && mimeType.startsWith("video/") - && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) + && (mXmppConnectionService.getCompressVideoBitratePreference() != 0 && mXmppConnectionService.getCompressVideoResolutionPreference() != 0)) && originalFileSize > autoAcceptFileSize; - } - public boolean isVideoMessage() { + boolean isVideoMessage() { return this.isVideoMessage && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2; } @@ -110,8 +109,12 @@ public class AttachFileToConversationRunnable implements Runnable, MediaTranscod mXmppConnectionService.stopForcingForegroundNotification(); throw new AssertionError(e); } catch (ExecutionException e) { - mXmppConnectionService.stopForcingForegroundNotification(); - Log.d(Config.LOGTAG, "ignoring execution exception. Should get handled by onTranscodeFiled() instead", e); + if (e.getCause() instanceof Error) { + mXmppConnectionService.stopForcingForegroundNotification(); + processAsFile(); + } else { + Log.d(Config.LOGTAG, "ignoring execution exception. Should get handled by onTranscodeFiled() instead", e); + } } } diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index f36321b04..98e330ad0 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -893,6 +893,8 @@ public class XmppConnectionService extends Service { return 1920; case "high": return 3840; + case "uncompressed": + return 0; default: return 3840; } @@ -906,6 +908,8 @@ public class XmppConnectionService extends Service { return 524288; // 0.5 * 1024 * 1024 = 524288 (0.5 MiB) case "high": return 1048576; // 1 * 1024 * 1024 = 1048576 (1 MiB) + case "uncompressed": + return 0; default: return 524288; } @@ -919,6 +923,8 @@ public class XmppConnectionService extends Service { return 360; case "high": return 720; + case "uncompressed": + return 0; default: return 360; } @@ -932,6 +938,8 @@ public class XmppConnectionService extends Service { return 500000; case "high": return 2000000; + case "uncompressed": + return 0; default: return 500000; } -- cgit v1.2.3