Remove software fallback in Android hardware codec factories.

Remove backwards compatiblity. Users who need software codecs should
migrate to the DefaultVideoCodecFactories.

Bug: webrtc:7925
Change-Id: Ifb41c9511d53c17c83222422c221b595bc056cb2
Reviewed-on: https://webrtc-review.googlesource.com/82920
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Anders Carlsson <andersc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23563}
This commit is contained in:
Anders Carlsson
2018-06-11 14:57:07 +02:00
committed by Commit Bot
parent 24db1c91a1
commit 80a0a4c482
5 changed files with 8 additions and 68 deletions

View File

@ -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") {

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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,16 +51,8 @@ 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;
}
}
CodecCapabilities capabilities = info.getCapabilitiesForType(type.mimeType());
return new HardwareVideoDecoder(info.getName(), type,
@ -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()]);
}

View File

@ -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,16 +68,8 @@ 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;
}
}
String codecName = info.getName();
String mime = type.mimeType();
@ -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()]);
}