Build libvpx VP9 on Android and expose enableVp9 param
This commit is contained in:
parent
e7798ae9e6
commit
e684d32c65
@ -210,7 +210,7 @@ def BuildArch(dry_run, project_dir, webrtc_src_dir, build_dir, arch, debug_build
|
||||
'rtc_build_tools': 'false',
|
||||
'rtc_enable_protobuf': 'false',
|
||||
'rtc_enable_sctp': 'false',
|
||||
'rtc_libvpx_build_vp9': 'false',
|
||||
'rtc_libvpx_build_vp9': 'true',
|
||||
'rtc_disable_metrics': 'true',
|
||||
'rtc_disable_trace_events': 'true',
|
||||
'android_static_analysis': '"off"',
|
||||
|
||||
@ -94,7 +94,7 @@ fi
|
||||
(
|
||||
(
|
||||
cd src/webrtc/src
|
||||
WEBRTC_ARGS="rtc_build_examples=false rtc_build_tools=false rtc_include_tests=false rtc_enable_protobuf=false rtc_use_x11=false rtc_enable_sctp=false rtc_libvpx_build_vp9=false rtc_disable_metrics=true rtc_disable_trace_events=true"
|
||||
WEBRTC_ARGS="rtc_build_examples=false rtc_build_tools=false rtc_include_tests=false rtc_enable_protobuf=false rtc_use_x11=false rtc_enable_sctp=false rtc_libvpx_build_vp9=true rtc_disable_metrics=true rtc_disable_trace_events=true"
|
||||
|
||||
if [ "${BUILD_TYPE}" = "release" ]
|
||||
then
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
webrtc.version=7680f
|
||||
webrtc.version=7680g
|
||||
|
||||
ringrtc.version.major=2
|
||||
ringrtc.version.minor=68
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
{
|
||||
"android": "094d36b182e09f22654e82f6078edae03fb475e7e965de810aebd5c31cbe8e6f",
|
||||
"ios": "6f318fd2a61c1189970cdaade947e9bb0f8763635955cdb598417cf072daa9a7",
|
||||
"linux-x64": "1847a805772f6ae41e26534f36c0e27ca753fc155b310bce943ac5abb7cf41b1",
|
||||
"linux-arm64": "6d1fd40b6f992652027f2b63129d746930ee51e31879d5ec9972001886d889d0",
|
||||
"mac-x64": "da9edcb3c00bb5ad10de87b338542b87d69d4a66738a4e6f07a831c3c36f47ef",
|
||||
"mac-arm64": "0074b41af28368f2a5d3c474701cfd4e857c2905a47432fe71a6daa5d1089a3a",
|
||||
"windows-x64": "5339f09e9978d326ef94663bf8dc3a27520852733ba3d1e8714fb859cd92e571",
|
||||
"windows-arm64": "5b041180e7f7c5a1a76e8c07f3d055ece21279a89ee4c315d5330e23d3273f41"
|
||||
"android": "ad8a5e51c4efb8ff513dea7061ee7c7af8bbfcc94295edea66e87755de773ecb",
|
||||
"ios": "ca8ec0e1be6299298aae2443c360fb26881573b9a797641f54da4c1d162af59c",
|
||||
"linux-x64": "c033733f5404bc60fce15746d9acb9f75d5e13f0120f30ecdfa39f4812a50b01",
|
||||
"linux-arm64": "24d087a5bf2f292aa598e8781f168e6efc5fc06e6bdeaf0adb244fd8b237576f",
|
||||
"mac-x64": "28b8cf503aafa45df30f975e50bfc52fa0f1310d08dd6cb30ca983d609fcd689",
|
||||
"mac-arm64": "21a805dcdee24ac0160e2cd34e060331b2d2919d6b6d0ba1d30755955bde4e50",
|
||||
"windows-x64": "e0634a710351662339b38202af3330f99d74d3be39539c84bc2dc1077aaae0a6",
|
||||
"windows-arm64": "1c80fd5d1de0a4051bbcaf9ae1bf877c898ef34a092ba480b5a373cd985a7518"
|
||||
}
|
||||
|
||||
@ -417,6 +417,7 @@ public class CallManager {
|
||||
* @param dataMode desired data mode to start the session with
|
||||
* @param audioLevelsIntervalMs if greater than 0, enable audio levels with this interval (in milliseconds)
|
||||
* @param dredDuration if provided, client will encode DRED PLC for the period specified
|
||||
* @param enableVp9 if true, allow use of software VP9 video codec for this call
|
||||
* @param enableCamera if true, enable the local camera video track when created
|
||||
*
|
||||
* @throws CallException for native code failures
|
||||
@ -434,6 +435,7 @@ public class CallManager {
|
||||
DataMode dataMode,
|
||||
@Nullable Integer audioLevelsIntervalMs,
|
||||
@Nullable Byte dredDuration,
|
||||
boolean enableVp9,
|
||||
boolean enableCamera)
|
||||
throws CallException
|
||||
{
|
||||
@ -466,7 +468,8 @@ public class CallManager {
|
||||
callContext,
|
||||
dataMode.ordinal(),
|
||||
audioLevelsIntervalMillis,
|
||||
dredDurationByte);
|
||||
dredDurationByte,
|
||||
Util.deviceSupportsVp9HardwareEncoder(eglBase) || enableVp9);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2566,7 +2569,8 @@ public class CallManager {
|
||||
CallContext callContext,
|
||||
int dataMode,
|
||||
int audioLevelsIntervalMillis,
|
||||
byte dredDuration)
|
||||
byte dredDuration,
|
||||
boolean enableVp9)
|
||||
throws CallException;
|
||||
|
||||
private native
|
||||
|
||||
@ -6,11 +6,16 @@ package org.signal.ringrtc;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.webrtc.EglBase;
|
||||
import org.webrtc.HardwareVideoEncoderFactory;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Collection;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class Util {
|
||||
private static final String TAG = "RingRtcUtil";
|
||||
|
||||
// Based on https://gist.github.com/jeffjohnson9046/c663dd22bbe6bb0b3f5e.
|
||||
public static byte[] getBytesFromUuid(UUID uuid) {
|
||||
ByteBuffer bytes = ByteBuffer.wrap(new byte[16]);
|
||||
@ -51,4 +56,26 @@ public final class Util {
|
||||
return new byte[0];
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean deviceSupportsVp9HardwareEncoder(EglBase eglBase) {
|
||||
if (eglBase == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
HardwareVideoEncoderFactory hwFactory = new HardwareVideoEncoderFactory(eglBase.getEglBaseContext(), true, true, (mediaCodecInfo) -> {
|
||||
for (String mimeType : mediaCodecInfo.getSupportedTypes()) {
|
||||
if (mimeType.equals("video/x-vnd.on2.vp9")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
if (hwFactory.getSupportedCodecs().length == 0) {
|
||||
Log.w(TAG, "No supported VP9 hardware encoder found");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,6 +170,7 @@ pub unsafe extern "C" fn Java_org_signal_ringrtc_CallManager_ringrtcProceed(
|
||||
data_mode: jint,
|
||||
audio_levels_interval_millis: jint,
|
||||
dred_duration: jbyte,
|
||||
enable_vp9: jboolean,
|
||||
) {
|
||||
let audio_levels_interval = if audio_levels_interval_millis <= 0 {
|
||||
None
|
||||
@ -184,7 +185,8 @@ pub unsafe extern "C" fn Java_org_signal_ringrtc_CallManager_ringrtcProceed(
|
||||
jni_call_context,
|
||||
CallConfig::default()
|
||||
.with_data_mode(DataMode::from_i32(data_mode))
|
||||
.with_dred_duration(dred_duration as u8),
|
||||
.with_dred_duration(dred_duration as u8)
|
||||
.with_enable_vp9(enable_vp9 != 0),
|
||||
audio_levels_interval,
|
||||
) {
|
||||
Ok(v) => v,
|
||||
|
||||
@ -96,6 +96,7 @@ pub fn common_webrtc_flags() -> Vec<String> {
|
||||
"rtc_enable_sctp=false".to_string(),
|
||||
"rtc_disable_metrics=true".to_string(),
|
||||
"rtc_disable_trace_events=true".to_string(),
|
||||
"rtc_libvpx_build_vp9=true".to_string(),
|
||||
]
|
||||
}
|
||||
|
||||
@ -109,7 +110,6 @@ pub fn build_webrtc_for_desktop(sh: Shell) -> anyhow::Result<()> {
|
||||
args.extend(vec![
|
||||
format!("target_cpu=\"{gnu_arch}\""),
|
||||
"rtc_use_x11=false".to_string(),
|
||||
"rtc_libvpx_build_vp9=true".to_string(),
|
||||
"use_siso=true".to_string(),
|
||||
]);
|
||||
if TARGET_OS.as_str() == "linux" && gnu_arch == "arm64" {
|
||||
@ -156,10 +156,7 @@ pub fn build_webrtc_for_ios(sh: Shell) -> anyhow::Result<()> {
|
||||
const IPHONEOS_DEPLOYMENT_TARGET: &str = "14.0";
|
||||
let profile = PROFILE.as_str();
|
||||
let mut args = common_webrtc_flags();
|
||||
args.extend(vec![
|
||||
format!("enable_dsyms={}", !*IS_RELEASE),
|
||||
"rtc_libvpx_build_vp9=false".to_string(),
|
||||
]);
|
||||
args.extend(vec![format!("enable_dsyms={}", !*IS_RELEASE)]);
|
||||
let working_dir = format!("{}/src", *LIBWEBRTC_DIR);
|
||||
let dest = format!("{}/out/ios/{}", working_dir, *PROFILE);
|
||||
let library_dest = WEBRTC_DEST_DIR.as_str();
|
||||
@ -219,7 +216,6 @@ pub fn build_webrtc_for_android(sh: Shell) -> anyhow::Result<()> {
|
||||
let mut args = common_webrtc_flags();
|
||||
args.extend(vec![
|
||||
format!("target_cpu={gnu_arch}"),
|
||||
"rtc_libvpx_build_vp9=false".to_string(),
|
||||
"android_static_analysis=\"off\"".to_string(),
|
||||
"use_siso=true".to_string(),
|
||||
]);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user