mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-09-19 16:24:41 +01:00
Remove some unnecessary transcode size limits.
This commit is contained in:
committed by
Michelle Tang
parent
635b5795ea
commit
be9ae5c8f2
@@ -260,7 +260,7 @@ public final class AttachmentCompressionJob extends BaseJob {
|
||||
}
|
||||
}
|
||||
|
||||
StreamingTranscoder transcoder = new StreamingTranscoder(dataSource, options, constraints.getVideoTranscodingSettings(), constraints.getCompressedVideoMaxSize(), RemoteConfig.allowAudioRemuxing());
|
||||
StreamingTranscoder transcoder = new StreamingTranscoder(dataSource, options, constraints.getVideoTranscodingSettings(), AttachmentUploadJob.getMaxPlaintextSize(), RemoteConfig.allowAudioRemuxing());
|
||||
|
||||
if (transcoder.isTranscodeRequired()) {
|
||||
Log.i(TAG, "Compressing with streaming muxer");
|
||||
|
||||
+1
-1
@@ -610,7 +610,7 @@ class MediaReviewFragment : Fragment(R.layout.v2_media_review_fragment), Schedul
|
||||
videoTimeLine.unregisterDragListener()
|
||||
}
|
||||
val size: Long = tryGetUriSize(requireContext(), uri, Long.MAX_VALUE)
|
||||
val maxSend = sharedViewModel.getMediaConstraints().getEditorVideoMaxSize()
|
||||
val maxSend = sharedViewModel.getMediaConstraints().editorVideoMaxSize
|
||||
if (size > maxSend) {
|
||||
videoTimeLine.setTimeLimit(TranscodingConfig.calculateMaxVideoUploadDurationInSeconds(state.transcodingConfigs, state.getOrCreateVideoTrimData(uri).totalInputDurationUs.microseconds), TimeUnit.SECONDS)
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ class CameraXFragment : ComposeFragment(), CameraFragment {
|
||||
CameraXScreen(
|
||||
state = state,
|
||||
onEvent = { event -> controller?.onCameraXScreenEvent(event) },
|
||||
maxVideoDurationSeconds = controller?.let { getMaxVideoDurationInSeconds(it.mediaConstraints, it.maxVideoDuration) } ?: 0,
|
||||
maxVideoDurationSeconds = controller?.let { controller -> controller.maxVideoDuration.takeIf { it > 0 } ?: getMaxVideoDurationInSeconds(controller.mediaConstraints) } ?: 0,
|
||||
onCheckPermissions = { checkPermissions(state.isVideoEnabled) },
|
||||
hasCameraPermission = { hasCameraPermission() },
|
||||
onRequestMicPermission = { requestMicPermission() }
|
||||
@@ -268,12 +268,8 @@ class CameraXFragment : ComposeFragment(), CameraFragment {
|
||||
}
|
||||
}
|
||||
|
||||
internal fun getMaxVideoDurationInSeconds(mediaConstraints: MediaConstraints, maxVideoDuration: Int): Int {
|
||||
var maxDuration = VideoUtil.getMaxVideoRecordDurationInSeconds(mediaConstraints)
|
||||
if (maxVideoDuration > 0) {
|
||||
maxDuration = maxVideoDuration
|
||||
}
|
||||
return maxDuration
|
||||
internal fun getMaxVideoDurationInSeconds(mediaConstraints: MediaConstraints): Int {
|
||||
return VideoUtil.getMaxVideoRecordDurationInSeconds(mediaConstraints)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+5
-4
@@ -30,10 +30,11 @@ fun MediaCameraCaptureScreen(
|
||||
},
|
||||
onEvent = { event -> onEvent(MediaCaptureScreenEvent.Camera(event)) },
|
||||
maxVideoDurationSeconds = remember(state.isStory) {
|
||||
getMaxVideoDurationInSeconds(
|
||||
mediaConstraints = state.mediaConstraints,
|
||||
maxVideoDuration = if (state.isStory) state.storyMaxVideoDuration.inWholeSeconds.toInt() else -1
|
||||
)
|
||||
if (state.isStory) {
|
||||
state.storyMaxVideoDuration.inWholeSeconds.toInt()
|
||||
} else {
|
||||
getMaxVideoDurationInSeconds(mediaConstraints = state.mediaConstraints)
|
||||
}
|
||||
},
|
||||
onCheckPermissions = {}, // TODO [media-send]
|
||||
onRequestMicPermission = {}, // TODO [media-send]
|
||||
|
||||
@@ -164,7 +164,7 @@ public final class StreamingTranscoder {
|
||||
final boolean sizeLimitEnabled = 0 < upperSizeLimit;
|
||||
|
||||
if (sizeLimitEnabled && upperSizeLimit < fileSizeEstimate) {
|
||||
throw new VideoSizeException("Size constraints could not be met!");
|
||||
throw new VideoSizeException("Size constraints could not be met! upperSizeLimit: " + upperSizeLimit + ", fileSizeEstimate: " + fileSizeEstimate);
|
||||
}
|
||||
|
||||
final long startTime = System.currentTimeMillis();
|
||||
|
||||
Reference in New Issue
Block a user