diff --git a/sdk/android/BUILD.gn b/sdk/android/BUILD.gn index e8b2a6c974..2de53d900e 100644 --- a/sdk/android/BUILD.gn +++ b/sdk/android/BUILD.gn @@ -258,6 +258,7 @@ generate_jni("generated_java_audio_device_module_native_jni") { generate_jni("generated_video_jni") { sources = [ "api/org/webrtc/EncodedImage.java", + "api/org/webrtc/HardwareVideoEncoderFactory.java", "api/org/webrtc/MediaCodecVideoDecoder.java", "api/org/webrtc/MediaCodecVideoEncoder.java", "api/org/webrtc/VideoCodecInfo.java", @@ -284,9 +285,6 @@ generate_jni("generated_video_jni") { "src/java/org/webrtc/WrappedNativeVideoDecoder.java", "src/java/org/webrtc/WrappedNativeVideoEncoder.java", ] - if (rtc_use_builtin_sw_codecs) { - sources += [ "api/org/webrtc/HardwareVideoEncoderFactory.java" ] # TODO(andersc): This currently depends on SoftwareVideoEncoderFactory - } jni_package = "" namespace = "webrtc::jni" jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h" @@ -924,6 +922,8 @@ if (rtc_use_builtin_sw_codecs) { rtc_android_library("hwcodecs_java") { java_files = [ + "api/org/webrtc/HardwareVideoDecoderFactory.java", + "api/org/webrtc/HardwareVideoEncoderFactory.java", "src/java/org/webrtc/BaseBitrateAdjuster.java", "src/java/org/webrtc/BitrateAdjuster.java", "src/java/org/webrtc/DynamicBitrateAdjuster.java", @@ -941,15 +941,6 @@ rtc_android_library("hwcodecs_java") { ":video_java", "//rtc_base:base_java", ] - - if (rtc_use_builtin_sw_codecs) { - java_files += [ - "api/org/webrtc/HardwareVideoDecoderFactory.java", # TODO(andersc): make this not depend on SoftwareVideoDecoderFactory - "api/org/webrtc/HardwareVideoEncoderFactory.java", # TODO(andersc): make this not depend on SoftwareVideoEncoderFactory - ] - - deps += [ ":swcodecs_java" ] - } } rtc_android_library("peerconnection_java") { diff --git a/sdk/android/api/org/webrtc/DefaultVideoDecoderFactory.java b/sdk/android/api/org/webrtc/DefaultVideoDecoderFactory.java index 55b29a4288..e1908e8d11 100644 --- a/sdk/android/api/org/webrtc/DefaultVideoDecoderFactory.java +++ b/sdk/android/api/org/webrtc/DefaultVideoDecoderFactory.java @@ -20,8 +20,7 @@ public class DefaultVideoDecoderFactory implements VideoDecoderFactory { private final SoftwareVideoDecoderFactory softwareVideoDecoderFactory; public DefaultVideoDecoderFactory(EglBase.Context eglContext) { - hardwareVideoDecoderFactory = - new HardwareVideoDecoderFactory(eglContext, false /* fallbackToSoftware */); + hardwareVideoDecoderFactory = new HardwareVideoDecoderFactory(eglContext); softwareVideoDecoderFactory = new SoftwareVideoDecoderFactory(); } diff --git a/sdk/android/api/org/webrtc/DefaultVideoEncoderFactory.java b/sdk/android/api/org/webrtc/DefaultVideoEncoderFactory.java index 0650cb3e94..4faafaa61d 100644 --- a/sdk/android/api/org/webrtc/DefaultVideoEncoderFactory.java +++ b/sdk/android/api/org/webrtc/DefaultVideoEncoderFactory.java @@ -21,8 +21,8 @@ public class DefaultVideoEncoderFactory implements VideoEncoderFactory { public DefaultVideoEncoderFactory( EglBase.Context eglContext, boolean enableIntelVp8Encoder, boolean enableH264HighProfile) { - hardwareVideoEncoderFactory = new HardwareVideoEncoderFactory( - eglContext, enableIntelVp8Encoder, enableH264HighProfile, false /* fallbackToSoftware */); + hardwareVideoEncoderFactory = + new HardwareVideoEncoderFactory(eglContext, enableIntelVp8Encoder, enableH264HighProfile); softwareVideoEncoderFactory = new SoftwareVideoEncoderFactory(); } diff --git a/sdk/android/api/org/webrtc/HardwareVideoDecoderFactory.java b/sdk/android/api/org/webrtc/HardwareVideoDecoderFactory.java index b40bd05c8c..a901045a8e 100644 --- a/sdk/android/api/org/webrtc/HardwareVideoDecoderFactory.java +++ b/sdk/android/api/org/webrtc/HardwareVideoDecoderFactory.java @@ -29,7 +29,6 @@ public class HardwareVideoDecoderFactory implements VideoDecoderFactory { private static final String TAG = "HardwareVideoDecoderFactory"; private final EglBase.Context sharedContext; - private final boolean fallbackToSoftware; /** Creates a HardwareVideoDecoderFactory that does not use surface textures. */ @Deprecated // Not removed yet to avoid breaking callers. @@ -42,12 +41,7 @@ public class HardwareVideoDecoderFactory implements VideoDecoderFactory { * shared context. The context may be null. If it is null, then surface support is disabled. */ public HardwareVideoDecoderFactory(EglBase.Context sharedContext) { - this(sharedContext, true /* fallbackToSoftware */); - } - - HardwareVideoDecoderFactory(EglBase.Context sharedContext, boolean fallbackToSoftware) { this.sharedContext = sharedContext; - this.fallbackToSoftware = fallbackToSoftware; } @Nullable @@ -57,15 +51,7 @@ public class HardwareVideoDecoderFactory implements VideoDecoderFactory { MediaCodecInfo info = findCodecForType(type); if (info == null) { - // No hardware support for this type. - // TODO(andersc): This is for backwards compatibility. Remove when clients have migrated to - // new DefaultVideoEncoderFactory. - if (fallbackToSoftware) { - SoftwareVideoDecoderFactory softwareVideoDecoderFactory = new SoftwareVideoDecoderFactory(); - return softwareVideoDecoderFactory.createDecoder(codecType); - } else { - return null; - } + return null; } CodecCapabilities capabilities = info.getCapabilitiesForType(type.mimeType()); @@ -94,16 +80,6 @@ public class HardwareVideoDecoderFactory implements VideoDecoderFactory { } } - // TODO(andersc): This is for backwards compatibility. Remove when clients have migrated to - // new DefaultVideoEncoderFactory. - if (fallbackToSoftware) { - for (VideoCodecInfo info : SoftwareVideoDecoderFactory.supportedCodecs()) { - if (!supportedCodecInfos.contains(info)) { - supportedCodecInfos.add(info); - } - } - } - return supportedCodecInfos.toArray(new VideoCodecInfo[supportedCodecInfos.size()]); } diff --git a/sdk/android/api/org/webrtc/HardwareVideoEncoderFactory.java b/sdk/android/api/org/webrtc/HardwareVideoEncoderFactory.java index 9c16298da1..751d1ea54d 100644 --- a/sdk/android/api/org/webrtc/HardwareVideoEncoderFactory.java +++ b/sdk/android/api/org/webrtc/HardwareVideoEncoderFactory.java @@ -42,16 +42,9 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory { @Nullable private final EglBase14.Context sharedContext; private final boolean enableIntelVp8Encoder; private final boolean enableH264HighProfile; - private final boolean fallbackToSoftware; public HardwareVideoEncoderFactory( EglBase.Context sharedContext, boolean enableIntelVp8Encoder, boolean enableH264HighProfile) { - this( - sharedContext, enableIntelVp8Encoder, enableH264HighProfile, true /* fallbackToSoftware */); - } - - HardwareVideoEncoderFactory(EglBase.Context sharedContext, boolean enableIntelVp8Encoder, - boolean enableH264HighProfile, boolean fallbackToSoftware) { // Texture mode requires EglBase14. if (sharedContext instanceof EglBase14.Context) { this.sharedContext = (EglBase14.Context) sharedContext; @@ -61,7 +54,6 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory { } this.enableIntelVp8Encoder = enableIntelVp8Encoder; this.enableH264HighProfile = enableH264HighProfile; - this.fallbackToSoftware = fallbackToSoftware; } @Deprecated @@ -76,15 +68,7 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory { MediaCodecInfo info = findCodecForType(type); if (info == null) { - // No hardware support for this type. - // TODO(andersc): This is for backwards compatibility. Remove when clients have migrated to - // new DefaultVideoEncoderFactory. - if (fallbackToSoftware) { - SoftwareVideoEncoderFactory softwareVideoEncoderFactory = new SoftwareVideoEncoderFactory(); - return softwareVideoEncoderFactory.createEncoder(input); - } else { - return null; - } + return null; } String codecName = info.getName(); @@ -133,16 +117,6 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory { } } - // TODO(andersc): This is for backwards compatibility. Remove when clients have migrated to - // new DefaultVideoEncoderFactory. - if (fallbackToSoftware) { - for (VideoCodecInfo info : SoftwareVideoEncoderFactory.supportedCodecs()) { - if (!supportedCodecInfos.contains(info)) { - supportedCodecInfos.add(info); - } - } - } - return supportedCodecInfos.toArray(new VideoCodecInfo[supportedCodecInfos.size()]); }