mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-17 23:43:34 +01:00
Make max compressed video size remote configurable.
This commit is contained in:
committed by
Michelle Tang
parent
69cad04875
commit
3620db3a92
@@ -6,13 +6,15 @@ import androidx.annotation.IntRange;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import org.signal.core.util.Util;
|
||||||
import org.thoughtcrime.securesms.dependencies.AppDependencies;
|
import org.thoughtcrime.securesms.dependencies.AppDependencies;
|
||||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||||
import org.thoughtcrime.securesms.util.RemoteConfig;
|
|
||||||
import org.thoughtcrime.securesms.util.LocaleRemoteConfig;
|
import org.thoughtcrime.securesms.util.LocaleRemoteConfig;
|
||||||
import org.signal.core.util.Util;
|
import org.thoughtcrime.securesms.util.RemoteConfig;
|
||||||
import org.thoughtcrime.securesms.video.TranscodingPreset;
|
import org.thoughtcrime.securesms.video.TranscodingPreset;
|
||||||
import org.thoughtcrime.securesms.video.videoconverter.utils.DeviceCapabilities;
|
import org.thoughtcrime.securesms.video.videoconverter.utils.DeviceCapabilities;
|
||||||
|
import org.whispersystems.signalservice.api.crypto.AttachmentCipherStreamUtil;
|
||||||
|
import org.whispersystems.signalservice.internal.crypto.PaddingInputStream;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
@@ -65,7 +67,10 @@ public class PushMediaConstraints extends MediaConstraints {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getCompressedVideoMaxSize(Context context) {
|
public long getCompressedVideoMaxSize(Context context) {
|
||||||
return getMaxAttachmentSize();
|
long maxCipherTextSize = RemoteConfig.videoTranscodeTargetSizeBytes();
|
||||||
|
long maxPaddedSize = AttachmentCipherStreamUtil.getPlaintextLength(maxCipherTextSize);
|
||||||
|
|
||||||
|
return Math.min(PaddingInputStream.getMaxUnpaddedSize(maxPaddedSize), getMaxAttachmentSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -929,6 +929,15 @@ object RemoteConfig {
|
|||||||
hotSwappable = true
|
hotSwappable = true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/** Maximum size a video transcode should target in bytes */
|
||||||
|
@JvmStatic
|
||||||
|
@get:JvmName("videoTranscodeTargetSizeBytes")
|
||||||
|
val videoTranscodeTargetSizeBytes: Long by remoteLong(
|
||||||
|
key = "global.videoAttachments.transcodeTargetBytes",
|
||||||
|
defaultValue = 100.mebiBytes.inWholeBytes,
|
||||||
|
hotSwappable = true
|
||||||
|
)
|
||||||
|
|
||||||
/** Maximum input size when opening a video to send in bytes */
|
/** Maximum input size when opening a video to send in bytes */
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@get:JvmName("maxSourceTranscodeVideoSizeBytes")
|
@get:JvmName("maxSourceTranscodeVideoSizeBytes")
|
||||||
|
|||||||
Reference in New Issue
Block a user