From aa6b24f23c155122343cbf0de08ad44758be5f65 Mon Sep 17 00:00:00 2001 From: Sam Zackrisson Date: Wed, 10 Jan 2018 13:33:46 +0100 Subject: [PATCH] Delete DefaultAudioProcessingFactory in the Java layer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Commit-Queue: Sam Zackrisson Cr-Commit-Position: refs/heads/master@{#21577} --- sdk/android/BUILD.gn | 13 ----- .../webrtc/DefaultAudioProcessingFactory.java | 48 ------------------- .../api/org/webrtc/PostProcessingFactory.java | 20 -------- .../DefaultAudioProcessingFactoryTest.java | 47 ------------------ .../jni/pc/defaultaudioprocessingfactory.cc | 35 -------------- 5 files changed, 163 deletions(-) delete mode 100644 sdk/android/api/org/webrtc/DefaultAudioProcessingFactory.java delete mode 100644 sdk/android/api/org/webrtc/PostProcessingFactory.java delete mode 100644 sdk/android/instrumentationtests/src/org/webrtc/DefaultAudioProcessingFactoryTest.java delete mode 100644 sdk/android/src/jni/pc/defaultaudioprocessingfactory.cc diff --git a/sdk/android/BUILD.gn b/sdk/android/BUILD.gn index 9709714415..92a35fd2dd 100644 --- a/sdk/android/BUILD.gn +++ b/sdk/android/BUILD.gn @@ -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", diff --git a/sdk/android/api/org/webrtc/DefaultAudioProcessingFactory.java b/sdk/android/api/org/webrtc/DefaultAudioProcessingFactory.java deleted file mode 100644 index fd4c45af6d..0000000000 --- a/sdk/android/api/org/webrtc/DefaultAudioProcessingFactory.java +++ /dev/null @@ -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); -} diff --git a/sdk/android/api/org/webrtc/PostProcessingFactory.java b/sdk/android/api/org/webrtc/PostProcessingFactory.java deleted file mode 100644 index 11b8fdb118..0000000000 --- a/sdk/android/api/org/webrtc/PostProcessingFactory.java +++ /dev/null @@ -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(); -} diff --git a/sdk/android/instrumentationtests/src/org/webrtc/DefaultAudioProcessingFactoryTest.java b/sdk/android/instrumentationtests/src/org/webrtc/DefaultAudioProcessingFactoryTest.java deleted file mode 100644 index 0ed8c35e3c..0000000000 --- a/sdk/android/instrumentationtests/src/org/webrtc/DefaultAudioProcessingFactoryTest.java +++ /dev/null @@ -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(); - } -} diff --git a/sdk/android/src/jni/pc/defaultaudioprocessingfactory.cc b/sdk/android/src/jni/pc/defaultaudioprocessingfactory.cc deleted file mode 100644 index ea5131cf3f..0000000000 --- a/sdk/android/src/jni/pc/defaultaudioprocessingfactory.cc +++ /dev/null @@ -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 - -#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&, - jlong native_post_processor) { - std::unique_ptr post_processor( - reinterpret_cast(native_post_processor)); - rtc::scoped_refptr audio_processing = - AudioProcessingBuilder() - .SetCapturePostProcessing(std::move(post_processor)) - .Create(); - return jlongFromPointer(audio_processing.release()); -} - -} // namespace jni -} // namespace webrtc