aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java4
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java9
2 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java b/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java
index 1a9980e17..e7dde2f84 100644
--- a/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java
+++ b/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java
@@ -42,6 +42,10 @@ public class AttachFileToConversationRunnable implements Runnable, MediaTranscod
this.isVideoMessage = (mimeType != null && mimeType.startsWith("video/") && (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 || !getFileBackend().useFileAsIs(uri)));
}
+ public boolean isVideoMessage() {
+ return this.isVideoMessage;
+ }
+
private void processAsFile() {
final String path = mXmppConnectionService.getFileBackend().getOriginalPath(uri);
if (path != null) {
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index f011c67b1..519cec043 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -160,6 +160,7 @@ public class XmppConnectionService extends Service {
public static final String ACTION_GCM_MESSAGE_RECEIVED = "gcm_message_received";
private static final String ACTION_MERGE_PHONE_CONTACTS = "merge_phone_contacts";
private final SerialSingleThreadExecutor mFileAddingExecutor = new SerialSingleThreadExecutor();
+ private final SerialSingleThreadExecutor mVideoCompressionExecutor = new SerialSingleThreadExecutor();
private final SerialSingleThreadExecutor mDatabaseExecutor = new SerialSingleThreadExecutor();
private final IBinder mBinder = new XmppConnectionBinder();
private final List<Conversation> conversations = new CopyOnWriteArrayList<>();
@@ -493,8 +494,12 @@ public class XmppConnectionService extends Service {
}
message.setCounterpart(conversation.getNextCounterpart());
message.setType(Message.TYPE_FILE);
- AttachFileToConversationRunnable runnable = new AttachFileToConversationRunnable(this,uri,message,callback);
- mFileAddingExecutor.execute(runnable);
+ final AttachFileToConversationRunnable runnable = new AttachFileToConversationRunnable(this, uri, message, callback);
+ if (runnable.isVideoMessage()) {
+ mVideoCompressionExecutor.execute(runnable);
+ } else {
+ mFileAddingExecutor.execute(runnable);
+ }
}
public void attachImageToConversation(final Conversation conversation, final Uri uri, final UiCallback<Message> callback) {