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:

committed by
Commit Bot

parent
24db1c91a1
commit
80a0a4c482
@ -258,6 +258,7 @@ generate_jni("generated_java_audio_device_module_native_jni") {
|
|||||||
generate_jni("generated_video_jni") {
|
generate_jni("generated_video_jni") {
|
||||||
sources = [
|
sources = [
|
||||||
"api/org/webrtc/EncodedImage.java",
|
"api/org/webrtc/EncodedImage.java",
|
||||||
|
"api/org/webrtc/HardwareVideoEncoderFactory.java",
|
||||||
"api/org/webrtc/MediaCodecVideoDecoder.java",
|
"api/org/webrtc/MediaCodecVideoDecoder.java",
|
||||||
"api/org/webrtc/MediaCodecVideoEncoder.java",
|
"api/org/webrtc/MediaCodecVideoEncoder.java",
|
||||||
"api/org/webrtc/VideoCodecInfo.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/WrappedNativeVideoDecoder.java",
|
||||||
"src/java/org/webrtc/WrappedNativeVideoEncoder.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 = ""
|
jni_package = ""
|
||||||
namespace = "webrtc::jni"
|
namespace = "webrtc::jni"
|
||||||
jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h"
|
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") {
|
rtc_android_library("hwcodecs_java") {
|
||||||
java_files = [
|
java_files = [
|
||||||
|
"api/org/webrtc/HardwareVideoDecoderFactory.java",
|
||||||
|
"api/org/webrtc/HardwareVideoEncoderFactory.java",
|
||||||
"src/java/org/webrtc/BaseBitrateAdjuster.java",
|
"src/java/org/webrtc/BaseBitrateAdjuster.java",
|
||||||
"src/java/org/webrtc/BitrateAdjuster.java",
|
"src/java/org/webrtc/BitrateAdjuster.java",
|
||||||
"src/java/org/webrtc/DynamicBitrateAdjuster.java",
|
"src/java/org/webrtc/DynamicBitrateAdjuster.java",
|
||||||
@ -941,15 +941,6 @@ rtc_android_library("hwcodecs_java") {
|
|||||||
":video_java",
|
":video_java",
|
||||||
"//rtc_base:base_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") {
|
rtc_android_library("peerconnection_java") {
|
||||||
|
@ -20,8 +20,7 @@ public class DefaultVideoDecoderFactory implements VideoDecoderFactory {
|
|||||||
private final SoftwareVideoDecoderFactory softwareVideoDecoderFactory;
|
private final SoftwareVideoDecoderFactory softwareVideoDecoderFactory;
|
||||||
|
|
||||||
public DefaultVideoDecoderFactory(EglBase.Context eglContext) {
|
public DefaultVideoDecoderFactory(EglBase.Context eglContext) {
|
||||||
hardwareVideoDecoderFactory =
|
hardwareVideoDecoderFactory = new HardwareVideoDecoderFactory(eglContext);
|
||||||
new HardwareVideoDecoderFactory(eglContext, false /* fallbackToSoftware */);
|
|
||||||
softwareVideoDecoderFactory = new SoftwareVideoDecoderFactory();
|
softwareVideoDecoderFactory = new SoftwareVideoDecoderFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ public class DefaultVideoEncoderFactory implements VideoEncoderFactory {
|
|||||||
|
|
||||||
public DefaultVideoEncoderFactory(
|
public DefaultVideoEncoderFactory(
|
||||||
EglBase.Context eglContext, boolean enableIntelVp8Encoder, boolean enableH264HighProfile) {
|
EglBase.Context eglContext, boolean enableIntelVp8Encoder, boolean enableH264HighProfile) {
|
||||||
hardwareVideoEncoderFactory = new HardwareVideoEncoderFactory(
|
hardwareVideoEncoderFactory =
|
||||||
eglContext, enableIntelVp8Encoder, enableH264HighProfile, false /* fallbackToSoftware */);
|
new HardwareVideoEncoderFactory(eglContext, enableIntelVp8Encoder, enableH264HighProfile);
|
||||||
softwareVideoEncoderFactory = new SoftwareVideoEncoderFactory();
|
softwareVideoEncoderFactory = new SoftwareVideoEncoderFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@ public class HardwareVideoDecoderFactory implements VideoDecoderFactory {
|
|||||||
private static final String TAG = "HardwareVideoDecoderFactory";
|
private static final String TAG = "HardwareVideoDecoderFactory";
|
||||||
|
|
||||||
private final EglBase.Context sharedContext;
|
private final EglBase.Context sharedContext;
|
||||||
private final boolean fallbackToSoftware;
|
|
||||||
|
|
||||||
/** Creates a HardwareVideoDecoderFactory that does not use surface textures. */
|
/** Creates a HardwareVideoDecoderFactory that does not use surface textures. */
|
||||||
@Deprecated // Not removed yet to avoid breaking callers.
|
@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.
|
* shared context. The context may be null. If it is null, then surface support is disabled.
|
||||||
*/
|
*/
|
||||||
public HardwareVideoDecoderFactory(EglBase.Context sharedContext) {
|
public HardwareVideoDecoderFactory(EglBase.Context sharedContext) {
|
||||||
this(sharedContext, true /* fallbackToSoftware */);
|
|
||||||
}
|
|
||||||
|
|
||||||
HardwareVideoDecoderFactory(EglBase.Context sharedContext, boolean fallbackToSoftware) {
|
|
||||||
this.sharedContext = sharedContext;
|
this.sharedContext = sharedContext;
|
||||||
this.fallbackToSoftware = fallbackToSoftware;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -57,15 +51,7 @@ public class HardwareVideoDecoderFactory implements VideoDecoderFactory {
|
|||||||
MediaCodecInfo info = findCodecForType(type);
|
MediaCodecInfo info = findCodecForType(type);
|
||||||
|
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
// No hardware support for this type.
|
return null;
|
||||||
// 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());
|
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()]);
|
return supportedCodecInfos.toArray(new VideoCodecInfo[supportedCodecInfos.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,16 +42,9 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
|
|||||||
@Nullable private final EglBase14.Context sharedContext;
|
@Nullable private final EglBase14.Context sharedContext;
|
||||||
private final boolean enableIntelVp8Encoder;
|
private final boolean enableIntelVp8Encoder;
|
||||||
private final boolean enableH264HighProfile;
|
private final boolean enableH264HighProfile;
|
||||||
private final boolean fallbackToSoftware;
|
|
||||||
|
|
||||||
public HardwareVideoEncoderFactory(
|
public HardwareVideoEncoderFactory(
|
||||||
EglBase.Context sharedContext, boolean enableIntelVp8Encoder, boolean enableH264HighProfile) {
|
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.
|
// Texture mode requires EglBase14.
|
||||||
if (sharedContext instanceof EglBase14.Context) {
|
if (sharedContext instanceof EglBase14.Context) {
|
||||||
this.sharedContext = (EglBase14.Context) sharedContext;
|
this.sharedContext = (EglBase14.Context) sharedContext;
|
||||||
@ -61,7 +54,6 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
|
|||||||
}
|
}
|
||||||
this.enableIntelVp8Encoder = enableIntelVp8Encoder;
|
this.enableIntelVp8Encoder = enableIntelVp8Encoder;
|
||||||
this.enableH264HighProfile = enableH264HighProfile;
|
this.enableH264HighProfile = enableH264HighProfile;
|
||||||
this.fallbackToSoftware = fallbackToSoftware;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -76,15 +68,7 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
|
|||||||
MediaCodecInfo info = findCodecForType(type);
|
MediaCodecInfo info = findCodecForType(type);
|
||||||
|
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
// No hardware support for this type.
|
return null;
|
||||||
// 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 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()]);
|
return supportedCodecInfos.toArray(new VideoCodecInfo[supportedCodecInfos.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user