Rename software codec classes and move them into api/

We want clients to be able to build their own factories around these
codecs.

Bug: webrtc:7925
Change-Id: Ia8f62d5d85e63ac6e3eb402c5996d8b986625615
Reviewed-on: https://webrtc-review.googlesource.com/c/109529
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Jonathan Yu <yujo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#25543}
This commit is contained in:
Jonathan Yu
2018-11-06 14:10:51 -08:00
committed by Commit Bot
parent ff7020af27
commit 50f60cb4b3
9 changed files with 115 additions and 64 deletions

View File

@ -470,18 +470,44 @@ if (is_android) {
]
}
rtc_android_library("libvpx_vp8_java") {
visibility = [ "*" ]
java_files = [
"api/org/webrtc/LibvpxVp8Decoder.java",
"api/org/webrtc/LibvpxVp8Encoder.java",
]
deps = [
":base_java",
":video_api_java",
":video_java",
"//rtc_base:base_java",
]
}
rtc_android_library("libvpx_vp9_java") {
visibility = [ "*" ]
java_files = [
"api/org/webrtc/LibvpxVp9Decoder.java",
"api/org/webrtc/LibvpxVp9Encoder.java",
]
deps = [
":base_java",
":video_api_java",
":video_java",
"//rtc_base:base_java",
]
}
rtc_android_library("swcodecs_java") {
java_files = [
"api/org/webrtc/SoftwareVideoDecoderFactory.java",
"api/org/webrtc/SoftwareVideoEncoderFactory.java",
"src/java/org/webrtc/VP8Encoder.java",
"src/java/org/webrtc/VP8Decoder.java",
"src/java/org/webrtc/VP9Encoder.java",
"src/java/org/webrtc/VP9Decoder.java",
]
deps = [
":base_java",
":libvpx_vp8_java",
":libvpx_vp9_java",
":video_api_java",
":video_java",
"//rtc_base:base_java",
@ -603,9 +629,12 @@ if (is_android) {
":base_jni",
":generated_video_jni",
":native_api_jni",
# TODO(bugs.webrtc.org/7925): Remove. :swcodecs_jni isn't a true
# dependency of this target. It should be linked in explicitly where
# needed.
":swcodecs_jni",
":videoframe_jni",
":vp8_jni", # TODO(bugs.webrtc.org/7925): Remove.
":vp9_jni", # TODO(bugs.webrtc.org/7925): Remove.
"../..:webrtc_common",
"../../api:libjingle_peerconnection_api",
"../../api/video:encoded_image",
@ -729,6 +758,52 @@ if (is_android) {
]
}
rtc_static_library("default_video_codec_factory_jni") {
deps = [
":swcodecs_jni",
":video_jni",
]
}
rtc_static_library("libvpx_vp8_jni") {
visibility = [ "*" ]
allow_poison = [ "software_video_codecs" ]
sources = [
"src/jni/vp8codec.cc",
]
# TODO(bugs.webrtc.org/7925): add a depenency on :video_jni once :video_jni
# does not depend on us.
deps = [
":base_jni",
":generated_libvpx_vp8_jni",
"../../modules/video_coding:webrtc_vp8",
]
}
rtc_static_library("libvpx_vp9_jni") {
visibility = [ "*" ]
allow_poison = [ "software_video_codecs" ]
sources = [
"src/jni/vp9codec.cc",
]
# TODO(bugs.webrtc.org/7925): add a depenency on :video_jni once :video_jni
# does not depend on us.
deps = [
":base_jni",
":generated_libvpx_vp9_jni",
"../../modules/video_coding:webrtc_vp9",
]
}
rtc_static_library("swcodecs_jni") {
deps = [
":libvpx_vp8_jni",
":libvpx_vp9_jni",
]
}
######################
# Native API targets #
######################
@ -974,30 +1049,6 @@ if (is_android) {
]
}
rtc_static_library("vp8_jni") {
sources = [
"src/jni/vp8codec.cc",
]
deps = [
":base_jni",
":generated_vp8_jni",
"../../modules/video_coding:webrtc_vp8",
]
}
rtc_static_library("vp9_jni") {
sources = [
"src/jni/vp9codec.cc",
]
deps = [
":base_jni",
":generated_vp9_jni",
"../../modules/video_coding:webrtc_vp9",
]
}
rtc_static_library("logging_jni") {
visibility = [ "*" ]
sources = [
@ -1186,10 +1237,10 @@ if (is_android) {
jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h"
}
generate_jni("generated_vp8_jni") {
generate_jni("generated_libvpx_vp8_jni") {
sources = [
"src/java/org/webrtc/VP8Decoder.java",
"src/java/org/webrtc/VP8Encoder.java",
"api/org/webrtc/LibvpxVp8Decoder.java",
"api/org/webrtc/LibvpxVp8Encoder.java",
]
jni_package = ""
@ -1197,10 +1248,10 @@ if (is_android) {
jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h"
}
generate_jni("generated_vp9_jni") {
generate_jni("generated_libvpx_vp9_jni") {
sources = [
"src/java/org/webrtc/VP9Decoder.java",
"src/java/org/webrtc/VP9Encoder.java",
"api/org/webrtc/LibvpxVp9Decoder.java",
"api/org/webrtc/LibvpxVp9Encoder.java",
]
jni_package = ""

View File

@ -10,7 +10,7 @@
package org.webrtc;
class VP8Decoder extends WrappedNativeVideoDecoder {
public class LibvpxVp8Decoder extends WrappedNativeVideoDecoder {
@Override
public long createNativeVideoDecoder() {
return nativeCreateDecoder();

View File

@ -10,7 +10,7 @@
package org.webrtc;
class VP8Encoder extends WrappedNativeVideoEncoder {
public class LibvpxVp8Encoder extends WrappedNativeVideoEncoder {
@Override
public long createNativeVideoEncoder() {
return nativeCreateEncoder();

View File

@ -10,7 +10,7 @@
package org.webrtc;
class VP9Decoder extends WrappedNativeVideoDecoder {
public class LibvpxVp9Decoder extends WrappedNativeVideoDecoder {
@Override
public long createNativeVideoDecoder() {
return nativeCreateDecoder();

View File

@ -10,7 +10,7 @@
package org.webrtc;
class VP9Encoder extends WrappedNativeVideoEncoder {
public class LibvpxVp9Encoder extends WrappedNativeVideoEncoder {
@Override
public long createNativeVideoEncoder() {
return nativeCreateEncoder();

View File

@ -27,10 +27,10 @@ public class SoftwareVideoDecoderFactory implements VideoDecoderFactory {
@Override
public VideoDecoder createDecoder(VideoCodecInfo codecType) {
if (codecType.getName().equalsIgnoreCase("VP8")) {
return new VP8Decoder();
return new LibvpxVp8Decoder();
}
if (codecType.getName().equalsIgnoreCase("VP9") && VP9Decoder.nativeIsSupported()) {
return new VP9Decoder();
if (codecType.getName().equalsIgnoreCase("VP9") && LibvpxVp9Decoder.nativeIsSupported()) {
return new LibvpxVp9Decoder();
}
return null;
@ -45,7 +45,7 @@ public class SoftwareVideoDecoderFactory implements VideoDecoderFactory {
List<VideoCodecInfo> codecs = new ArrayList<VideoCodecInfo>();
codecs.add(new VideoCodecInfo("VP8", new HashMap<>()));
if (VP9Decoder.nativeIsSupported()) {
if (LibvpxVp9Decoder.nativeIsSupported()) {
codecs.add(new VideoCodecInfo("VP9", new HashMap<>()));
}

View File

@ -20,10 +20,10 @@ public class SoftwareVideoEncoderFactory implements VideoEncoderFactory {
@Override
public VideoEncoder createEncoder(VideoCodecInfo info) {
if (info.name.equalsIgnoreCase("VP8")) {
return new VP8Encoder();
return new LibvpxVp8Encoder();
}
if (info.name.equalsIgnoreCase("VP9") && VP9Encoder.nativeIsSupported()) {
return new VP9Encoder();
if (info.name.equalsIgnoreCase("VP9") && LibvpxVp9Encoder.nativeIsSupported()) {
return new LibvpxVp9Encoder();
}
return null;
@ -38,7 +38,7 @@ public class SoftwareVideoEncoderFactory implements VideoEncoderFactory {
List<VideoCodecInfo> codecs = new ArrayList<VideoCodecInfo>();
codecs.add(new VideoCodecInfo("VP8", new HashMap<>()));
if (VP9Encoder.nativeIsSupported()) {
if (LibvpxVp9Encoder.nativeIsSupported()) {
codecs.add(new VideoCodecInfo("VP9", new HashMap<>()));
}

View File

@ -11,19 +11,19 @@
#include <jni.h>
#include "modules/video_coding/codecs/vp8/include/vp8.h"
#include "sdk/android/generated_vp8_jni/jni/VP8Decoder_jni.h"
#include "sdk/android/generated_vp8_jni/jni/VP8Encoder_jni.h"
#include "sdk/android/generated_libvpx_vp8_jni/jni/LibvpxVp8Decoder_jni.h"
#include "sdk/android/generated_libvpx_vp8_jni/jni/LibvpxVp8Encoder_jni.h"
#include "sdk/android/src/jni/jni_helpers.h"
namespace webrtc {
namespace jni {
static jlong JNI_VP8Encoder_CreateEncoder(JNIEnv* jni,
static jlong JNI_LibvpxVp8Encoder_CreateEncoder(JNIEnv* jni,
const JavaParamRef<jclass>&) {
return jlongFromPointer(VP8Encoder::Create().release());
}
static jlong JNI_VP8Decoder_CreateDecoder(JNIEnv* jni,
static jlong JNI_LibvpxVp8Decoder_CreateDecoder(JNIEnv* jni,
const JavaParamRef<jclass>&) {
return jlongFromPointer(VP8Decoder::Create().release());
}

View File

@ -11,29 +11,29 @@
#include <jni.h>
#include "modules/video_coding/codecs/vp9/include/vp9.h"
#include "sdk/android/generated_vp9_jni/jni/VP9Decoder_jni.h"
#include "sdk/android/generated_vp9_jni/jni/VP9Encoder_jni.h"
#include "sdk/android/generated_libvpx_vp9_jni/jni/LibvpxVp9Decoder_jni.h"
#include "sdk/android/generated_libvpx_vp9_jni/jni/LibvpxVp9Encoder_jni.h"
#include "sdk/android/src/jni/jni_helpers.h"
namespace webrtc {
namespace jni {
static jlong JNI_VP9Encoder_CreateEncoder(JNIEnv* jni,
static jlong JNI_LibvpxVp9Encoder_CreateEncoder(JNIEnv* jni,
const JavaParamRef<jclass>& w) {
return jlongFromPointer(VP9Encoder::Create().release());
}
static jboolean JNI_VP9Encoder_IsSupported(JNIEnv* jni,
static jboolean JNI_LibvpxVp9Encoder_IsSupported(JNIEnv* jni,
const JavaParamRef<jclass>&) {
return !SupportedVP9Codecs().empty();
}
static jlong JNI_VP9Decoder_CreateDecoder(JNIEnv* jni,
static jlong JNI_LibvpxVp9Decoder_CreateDecoder(JNIEnv* jni,
const JavaParamRef<jclass>& w) {
return jlongFromPointer(VP9Decoder::Create().release());
}
static jboolean JNI_VP9Decoder_IsSupported(JNIEnv* jni,
static jboolean JNI_LibvpxVp9Decoder_IsSupported(JNIEnv* jni,
const JavaParamRef<jclass>&) {
return !SupportedVP9Codecs().empty();
}