Delete DefaultAudioProcessingFactory in the Java layer
This removes the DefaultAudioProcessingFactory, PostProcessingFactory and DefaultAudioProcessingFactoryTest classes and leaves the interface AudioProcessingFactory without any default implementation (as the default APM is already created by the PeerConnectionFactory JNI). Bug: webrtc:8701 Change-Id: I259108afbc5b24cab5161485f45af4236f775c18 Reviewed-on: https://webrtc-review.googlesource.com/37220 Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> Commit-Queue: Sam Zackrisson <saza@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21577}
This commit is contained in:
committed by
Commit Bot
parent
a4eeeffec2
commit
aa6b24f23c
@ -100,23 +100,13 @@ rtc_source_set("base_jni") {
|
||||
}
|
||||
}
|
||||
|
||||
generate_jni("generated_audio_jni") {
|
||||
sources = [
|
||||
"api/org/webrtc/DefaultAudioProcessingFactory.java",
|
||||
]
|
||||
jni_package = ""
|
||||
jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h"
|
||||
}
|
||||
|
||||
rtc_static_library("audio_jni") {
|
||||
sources = [
|
||||
"src/jni/pc/audio.cc",
|
||||
"src/jni/pc/defaultaudioprocessingfactory.cc",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":base_jni",
|
||||
":generated_audio_jni",
|
||||
"../../api/audio_codecs:builtin_audio_decoder_factory",
|
||||
"../../api/audio_codecs:builtin_audio_encoder_factory",
|
||||
"../../modules/audio_processing:audio_processing",
|
||||
@ -601,7 +591,6 @@ rtc_android_library("libjingle_peerconnection_java") {
|
||||
"api/org/webrtc/CameraEnumerator.java",
|
||||
"api/org/webrtc/CameraVideoCapturer.java",
|
||||
"api/org/webrtc/DataChannel.java",
|
||||
"api/org/webrtc/DefaultAudioProcessingFactory.java",
|
||||
"api/org/webrtc/DefaultVideoDecoderFactory.java",
|
||||
"api/org/webrtc/DefaultVideoEncoderFactory.java",
|
||||
"api/org/webrtc/DtmfSender.java",
|
||||
@ -629,7 +618,6 @@ rtc_android_library("libjingle_peerconnection_java") {
|
||||
"api/org/webrtc/NetworkMonitorAutoDetect.java",
|
||||
"api/org/webrtc/PeerConnection.java",
|
||||
"api/org/webrtc/PeerConnectionFactory.java",
|
||||
"api/org/webrtc/PostProcessingFactory.java",
|
||||
"api/org/webrtc/RendererCommon.java",
|
||||
"api/org/webrtc/RTCStats.java",
|
||||
"api/org/webrtc/RTCStatsCollectorCallback.java",
|
||||
@ -728,7 +716,6 @@ if (rtc_include_tests) {
|
||||
"instrumentationtests/src/org/webrtc/Camera1CapturerUsingTextureTest.java",
|
||||
"instrumentationtests/src/org/webrtc/Camera2CapturerTest.java",
|
||||
"instrumentationtests/src/org/webrtc/CameraVideoCapturerTestFixtures.java",
|
||||
"instrumentationtests/src/org/webrtc/DefaultAudioProcessingFactoryTest.java",
|
||||
"instrumentationtests/src/org/webrtc/DefaultVideoEncoderFactoryTest.java",
|
||||
"instrumentationtests/src/org/webrtc/EglRendererTest.java",
|
||||
"instrumentationtests/src/org/webrtc/FileVideoCapturerTest.java",
|
||||
|
||||
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
package org.webrtc;
|
||||
|
||||
/** Factory for instantiating the default webrtc::AudioProcessing implementation. */
|
||||
@JNINamespace("webrtc::jni")
|
||||
public class DefaultAudioProcessingFactory implements AudioProcessingFactory {
|
||||
public DefaultAudioProcessingFactory() {
|
||||
this(null /* postProcessingFactory */);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows injecting a PostProcessingFactory. A null PostProcessingFactory creates a
|
||||
* webrtc::AudioProcessing with nullptr webrtc::postProcessing.
|
||||
*/
|
||||
public DefaultAudioProcessingFactory(PostProcessingFactory postProcessingFactory) {
|
||||
this.postProcessingFactory = postProcessingFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a default webrtc::AudioProcessing module, which takes ownership of objects created by
|
||||
* its factories.
|
||||
*/
|
||||
@Override
|
||||
public long createNative() {
|
||||
long nativePostProcessor = 0;
|
||||
if (postProcessingFactory != null) {
|
||||
nativePostProcessor = postProcessingFactory.createNative();
|
||||
if (nativePostProcessor == 0) {
|
||||
throw new NullPointerException(
|
||||
"PostProcessingFactory.createNative() may not return 0 (nullptr).");
|
||||
}
|
||||
}
|
||||
return nativeCreateAudioProcessing(nativePostProcessor);
|
||||
}
|
||||
|
||||
private PostProcessingFactory postProcessingFactory;
|
||||
|
||||
private static native long nativeCreateAudioProcessing(long postProcessor);
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
package org.webrtc;
|
||||
|
||||
/** Factory for creating webrtc::PostProcessing instances. */
|
||||
public interface PostProcessingFactory {
|
||||
/**
|
||||
* Dynamically allocates a webrtc::PostProcessing instance and returns a pointer to it.
|
||||
* The caller takes ownership of the object.
|
||||
*/
|
||||
public long createNative();
|
||||
}
|
||||
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
package org.webrtc;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.filters.MediumTest;
|
||||
import android.support.test.filters.SmallTest;
|
||||
import org.chromium.base.test.BaseJUnit4ClassRunner;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
/** Unit tests for {@link DefaultAudioProcessingFactory}. */
|
||||
@RunWith(BaseJUnit4ClassRunner.class)
|
||||
public final class DefaultAudioProcessingFactoryTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
PeerConnectionFactory.initialize(
|
||||
PeerConnectionFactory.InitializationOptions.builder(InstrumentationRegistry.getContext())
|
||||
.createInitializationOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that a PeerConnectionFactory can be initialized with an AudioProcessingFactory without
|
||||
* crashing.
|
||||
*/
|
||||
@Test
|
||||
@MediumTest
|
||||
public void testInitializePeerConnectionFactory() {
|
||||
AudioProcessingFactory audioProcessingFactory = new DefaultAudioProcessingFactory();
|
||||
PeerConnectionFactory peerConnectionFactory = new PeerConnectionFactory(null /* options */,
|
||||
null /* encoderFactory */, null /* decoderFactory */, audioProcessingFactory);
|
||||
peerConnectionFactory.dispose();
|
||||
}
|
||||
}
|
||||
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "modules/audio_processing/include/audio_processing.h"
|
||||
#include "rtc_base/scoped_ref_ptr.h"
|
||||
#include "sdk/android/generated_audio_jni/jni/DefaultAudioProcessingFactory_jni.h"
|
||||
#include "sdk/android/src/jni/jni_helpers.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace jni {
|
||||
|
||||
static jlong JNI_DefaultAudioProcessingFactory_CreateAudioProcessing(
|
||||
JNIEnv*,
|
||||
const JavaParamRef<jclass>&,
|
||||
jlong native_post_processor) {
|
||||
std::unique_ptr<CustomProcessing> post_processor(
|
||||
reinterpret_cast<CustomProcessing*>(native_post_processor));
|
||||
rtc::scoped_refptr<AudioProcessing> audio_processing =
|
||||
AudioProcessingBuilder()
|
||||
.SetCapturePostProcessing(std::move(post_processor))
|
||||
.Create();
|
||||
return jlongFromPointer(audio_processing.release());
|
||||
}
|
||||
|
||||
} // namespace jni
|
||||
} // namespace webrtc
|
||||
Reference in New Issue
Block a user