aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-02-12 19:43:24 +0100
committerChristian Schneppe <christian@pix-art.de>2017-02-12 19:43:24 +0100
commit7c49e47659897c80d7e1b5998c66a7caa97fedc6 (patch)
tree6f7e7e1b2da19ba20c131639e1ad19614435c9f3 /src/main
parent97f529643800dcfe3f7fc996f155dedc36b793a2 (diff)
don't compress videos if they are in our files directory
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/pixart/messenger/persistance/FileBackend.java12
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java10
2 files changed, 19 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
index d670c98d9..e2d339841 100644
--- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
@@ -261,6 +261,18 @@ public class FileBackend {
}
}
+ public boolean useFileAsIs(Uri uri) {
+ String path = getOriginalPath(uri);
+ if (path == null) {
+ return false;
+ }
+ if (path.contains(getConversationsDirectory("null"))) {
+ Log.d(Config.LOGTAG, "File " + path + " is in our directory, sending as is");
+ return true;
+ }
+ return false;
+ }
+
public String getOriginalPath(Uri uri) {
return FileUtils.getPath(mXmppConnectionService, uri);
}
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index 8722bc3b7..752e65cfb 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -562,10 +562,14 @@ public class XmppConnectionService extends Service {
public void run() {
final String mimeType = MimeUtils.guessMimeTypeFromUri(XmppConnectionService.this, uri);
if (mimeType != null && mimeType.startsWith("video/") && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
- try {
- processAsVideo();
- } catch (Throwable e) {
+ if (getFileBackend().useFileAsIs(uri)) {
processAsFile();
+ } else {
+ try {
+ processAsVideo();
+ } catch (Throwable e) {
+ processAsFile();
+ }
}
} else {
processAsFile();