Revert "Move Java PeerConnectionFactory.fieldTrialsFindFullName to different file."
This reverts commit d609473b9c51141a2bba691c2b90b84ba28fee89. Reason for revert: Breaks downstream project Original change's description: > Move Java PeerConnectionFactory.fieldTrialsFindFullName to different file. > > Currently, Java equivalent of webrtc::field_trial::FindFullName is in > PeeerConnectionFactory, which belongs to peerconnection_java GN target. > > Move that method into a separate file and GN target to make it easier > to use the fieldTrialsFindFullName method in other code. > > Bug: webrtc:13973 > Change-Id: I4d7d30339883af76c1d066f72270c6caf9c64c49 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/261500 > Reviewed-by: Xavier Lepaul <xalep@webrtc.org> > Commit-Queue: Xavier Lepaul <xalep@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#37233} Bug: webrtc:13973 Change-Id: I08eda44444aee4d64a0cee36f3f921f75088d7fc No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265922 Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com> Owners-Override: Artem Titov <titovartem@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/main@{#37234}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
d609473b9c
commit
091e073b63
@ -117,7 +117,6 @@ if (is_android) {
|
||||
":base_jni",
|
||||
":builtin_audio_codecs_jni",
|
||||
":default_video_codec_factory_jni",
|
||||
":field_trial_jni",
|
||||
":java_audio_device_module_jni",
|
||||
":peerconnection_jni",
|
||||
":video_jni",
|
||||
@ -270,6 +269,7 @@ if (is_android) {
|
||||
"api/org/webrtc/MediaSource.java",
|
||||
"api/org/webrtc/MediaStream.java",
|
||||
"api/org/webrtc/MediaStreamTrack.java",
|
||||
"api/org/webrtc/NativeLibraryLoader.java",
|
||||
"api/org/webrtc/NativePeerConnectionFactory.java",
|
||||
"api/org/webrtc/NetEqFactoryFactory.java",
|
||||
"api/org/webrtc/NetworkChangeDetector.java",
|
||||
@ -302,6 +302,7 @@ if (is_android) {
|
||||
"api/org/webrtc/VideoTrack.java",
|
||||
"src/java/org/webrtc/NativeAndroidVideoTrackSource.java",
|
||||
"src/java/org/webrtc/NativeCapturerObserver.java",
|
||||
"src/java/org/webrtc/NativeLibrary.java",
|
||||
]
|
||||
|
||||
deps = [
|
||||
@ -309,12 +310,10 @@ if (is_android) {
|
||||
":base_java",
|
||||
":builtin_audio_codecs_java",
|
||||
":default_video_codec_factory_java",
|
||||
":field_trial_java",
|
||||
|
||||
#TODO(bugs.webrtc.org/7452): Make injection mandatory and remove this dep.
|
||||
":java_audio_device_module_java",
|
||||
":logging_java",
|
||||
":native_library_java",
|
||||
":swcodecs_java",
|
||||
":video_api_java",
|
||||
":video_java",
|
||||
@ -328,24 +327,6 @@ if (is_android) {
|
||||
]
|
||||
}
|
||||
|
||||
rtc_android_library("native_library_java") {
|
||||
sources = [
|
||||
"api/org/webrtc/NativeLibraryLoader.java",
|
||||
"src/java/org/webrtc/NativeLibrary.java",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":logging_java",
|
||||
"//rtc_base:base_java",
|
||||
]
|
||||
}
|
||||
|
||||
rtc_android_library("field_trial_java") {
|
||||
sources = [ "api/org/webrtc/FieldTrial.java" ]
|
||||
|
||||
deps = [ ":native_library_java" ]
|
||||
}
|
||||
|
||||
# Modules, in alphabetical order.
|
||||
|
||||
rtc_android_library("camera_java") {
|
||||
@ -833,16 +814,6 @@ if (current_os == "linux" || is_android) {
|
||||
]
|
||||
}
|
||||
|
||||
rtc_library("field_trial_jni") {
|
||||
visibility = [ "*" ]
|
||||
sources = [ "src/jni/field_trial.cc" ]
|
||||
deps = [
|
||||
":base_jni",
|
||||
":generated_field_trial_jni",
|
||||
"../../system_wrappers:field_trial",
|
||||
]
|
||||
}
|
||||
|
||||
# JNI target for java_audio_device_module_java
|
||||
rtc_library("java_audio_device_module_jni") {
|
||||
visibility = [ "*" ]
|
||||
@ -1449,12 +1420,6 @@ if (current_os == "linux" || is_android) {
|
||||
jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h"
|
||||
}
|
||||
|
||||
generate_jni("generated_field_trial_jni") {
|
||||
sources = [ "api/org/webrtc/FieldTrial.java" ]
|
||||
namespace = "webrtc::jni"
|
||||
jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h"
|
||||
}
|
||||
|
||||
generate_jni("generated_java_audio_jni") {
|
||||
sources = [ "api/org/webrtc/audio/JavaAudioDeviceModule.java" ]
|
||||
namespace = "webrtc::jni"
|
||||
@ -1560,7 +1525,6 @@ if (is_android) {
|
||||
":hwcodecs_java",
|
||||
":libjingle_peerconnection_java",
|
||||
":libjingle_peerconnection_metrics_default_java",
|
||||
":native_library_java",
|
||||
":peerconnection_java",
|
||||
":surfaceviewrenderer_java",
|
||||
":swcodecs_java",
|
||||
@ -1669,6 +1633,7 @@ if (is_android) {
|
||||
":native_test_jni_onload",
|
||||
":opensles_audio_device_module",
|
||||
":video_jni",
|
||||
"../../api:field_trials_view",
|
||||
"../../api:scoped_refptr",
|
||||
"../../api/rtc_event_log:rtc_event_log_factory",
|
||||
"../../api/task_queue:default_task_queue_factory",
|
||||
@ -1723,7 +1688,6 @@ if (is_android) {
|
||||
deps = [
|
||||
":base_java",
|
||||
":java_audio_device_module_java",
|
||||
":native_library_java",
|
||||
":peerconnection_java",
|
||||
":video_api_java",
|
||||
":video_java",
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 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;
|
||||
|
||||
public class FieldTrial {
|
||||
// Wrapper of webrtc::field_trial::FindFullName. Develop the feature with default behaviour off.
|
||||
// Example usage:
|
||||
// if (FieldTrial.fieldTrialsFindFullName("WebRTCExperiment").equals("Enabled")) {
|
||||
// method1();
|
||||
// } else {
|
||||
// method2();
|
||||
// }
|
||||
public static String fieldTrialsFindFullName(String name) {
|
||||
return NativeLibrary.isLoaded() ? nativeFindFieldTrialsFullName(name) : "";
|
||||
}
|
||||
|
||||
private static native String nativeFindFieldTrialsFullName(String name);
|
||||
}
|
||||
@ -14,7 +14,6 @@ import android.content.Context;
|
||||
import android.os.Process;
|
||||
import androidx.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import org.webrtc.FieldTrial;
|
||||
import org.webrtc.Logging.Severity;
|
||||
import org.webrtc.PeerConnection;
|
||||
import org.webrtc.audio.AudioDeviceModule;
|
||||
@ -336,12 +335,15 @@ public class PeerConnectionFactory {
|
||||
nativeInitializeFieldTrials(fieldTrialsInitString);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link org.webrtc.FieldTrial#fieldTrialsFindFullName(String) } instead.
|
||||
*/
|
||||
@Deprecated
|
||||
// Wrapper of webrtc::field_trial::FindFullName. Develop the feature with default behaviour off.
|
||||
// Example usage:
|
||||
// if (PeerConnectionFactory.fieldTrialsFindFullName("WebRTCExperiment").equals("Enabled")) {
|
||||
// method1();
|
||||
// } else {
|
||||
// method2();
|
||||
// }
|
||||
public static String fieldTrialsFindFullName(String name) {
|
||||
return FieldTrial.fieldTrialsFindFullName(name);
|
||||
return NativeLibrary.isLoaded() ? nativeFindFieldTrialsFullName(name) : "";
|
||||
}
|
||||
// Start/stop internal capturing of internal tracing.
|
||||
public static boolean startInternalTracingCapture(String tracingFilename) {
|
||||
@ -580,6 +582,7 @@ public class PeerConnectionFactory {
|
||||
// (for example, at application startup time).
|
||||
private static native void nativeInitializeAndroidGlobals();
|
||||
private static native void nativeInitializeFieldTrials(String fieldTrialsInitString);
|
||||
private static native String nativeFindFieldTrialsFullName(String name);
|
||||
private static native void nativeInitializeInternalTracer();
|
||||
// Internal tracing shutdown, called to prevent resource leaks. Must be called after
|
||||
// PeerConnectionFactory is gone to prevent races with code performing tracing.
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 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 "system_wrappers/include/field_trial.h"
|
||||
|
||||
#include "sdk/android/generated_field_trial_jni/FieldTrial_jni.h"
|
||||
#include "sdk/android/src/jni/jni_helpers.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace jni {
|
||||
|
||||
static ScopedJavaLocalRef<jstring> JNI_FieldTrial_FindFieldTrialsFullName(
|
||||
JNIEnv* jni,
|
||||
const JavaParamRef<jstring>& j_name) {
|
||||
return NativeToJavaString(
|
||||
jni, field_trial::FindFullName(JavaToStdString(jni, j_name)));
|
||||
}
|
||||
|
||||
} // namespace jni
|
||||
} // namespace webrtc
|
||||
@ -213,6 +213,14 @@ static void JNI_PeerConnectionFactory_InitializeInternalTracer(JNIEnv* jni) {
|
||||
rtc::tracing::SetupInternalTracer();
|
||||
}
|
||||
|
||||
static ScopedJavaLocalRef<jstring>
|
||||
JNI_PeerConnectionFactory_FindFieldTrialsFullName(
|
||||
JNIEnv* jni,
|
||||
const JavaParamRef<jstring>& j_name) {
|
||||
return NativeToJavaString(
|
||||
jni, field_trial::FindFullName(JavaToStdString(jni, j_name)));
|
||||
}
|
||||
|
||||
static jboolean JNI_PeerConnectionFactory_StartInternalTracingCapture(
|
||||
JNIEnv* jni,
|
||||
const JavaParamRef<jstring>& j_event_tracing_filename) {
|
||||
|
||||
Reference in New Issue
Block a user