mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-18 07:47:47 +01:00
Constant bitrate video encoding.
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
/*
|
||||
* Copyright 2024 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.thoughtcrime.securesms.video.videoconverter;
|
||||
|
||||
import android.media.MediaCodec;
|
||||
@@ -21,7 +26,6 @@ import org.thoughtcrime.securesms.video.videoconverter.utils.Preconditions;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import kotlin.Pair;
|
||||
@@ -157,6 +161,7 @@ final class VideoTrackConverter {
|
||||
// configure() call to throw an unhelpful exception.
|
||||
outputVideoFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
|
||||
outputVideoFormat.setInteger(MediaFormat.KEY_BIT_RATE, videoBitrate);
|
||||
outputVideoFormat.setInteger(MediaFormat.KEY_BITRATE_MODE, MediaCodecInfo.EncoderCapabilities.BITRATE_MODE_CBR);
|
||||
outputVideoFormat.setInteger(MediaFormat.KEY_FRAME_RATE, OUTPUT_VIDEO_FRAME_RATE);
|
||||
outputVideoFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, OUTPUT_VIDEO_IFRAME_INTERVAL);
|
||||
if (Build.VERSION.SDK_INT >= 31 && isHdr(inputVideoFormat)) {
|
||||
@@ -482,7 +487,7 @@ final class VideoTrackConverter {
|
||||
"uniform samplerExternalOES sTexture;\n" +
|
||||
"void main() {\n" +
|
||||
" gl_FragColor = (texture2D(sTexture, vTextureCoord)\n" +
|
||||
colorLoop.toString() +
|
||||
colorLoop +
|
||||
" ) / " + sum + ";\n" +
|
||||
"}\n";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user