Android: Wrap webrtc::field_trial::FindFullName in Java

The purpose is to be able to add field trials in Java code.

BUG=webrtc:6683

Review-Url: https://codereview.webrtc.org/2621003002
Cr-Commit-Position: refs/heads/master@{#15994}
This commit is contained in:
magjed 2017-01-10 08:02:03 -08:00 committed by Commit bot
parent af916899cc
commit c0ce6cc85e
2 changed files with 15 additions and 0 deletions

View File

@ -57,6 +57,14 @@ public class PeerConnectionFactory {
// Field trial initialization. Must be called before PeerConnectionFactory
// is created.
public static native void initializeFieldTrials(String fieldTrialsInitString);
// 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 native String fieldTrialsFindFullName(String name);
// Internal tracing initialization. Must be called before PeerConnectionFactory is created to
// prevent racing with tracing code.
public static native void initializeInternalTracer();

View File

@ -71,6 +71,7 @@
#include "webrtc/media/base/videocapturer.h"
#include "webrtc/media/engine/webrtcvideodecoderfactory.h"
#include "webrtc/media/engine/webrtcvideoencoderfactory.h"
#include "webrtc/system_wrappers/include/field_trial.h"
#include "webrtc/system_wrappers/include/field_trial_default.h"
#include "webrtc/system_wrappers/include/logcat_trace_context.h"
#include "webrtc/system_wrappers/include/trace.h"
@ -1144,6 +1145,12 @@ JOW(void, PeerConnectionFactory_initializeInternalTracer)(JNIEnv* jni, jclass) {
rtc::tracing::SetupInternalTracer();
}
JOW(jstring, PeerConnectionFactory_fieldTrialsFindFullName)
(JNIEnv* jni, jclass, jstring j_name) {
return JavaStringFromStdString(
jni, webrtc::field_trial::FindFullName(JavaToStdString(jni, j_name)));
}
JOW(jboolean, PeerConnectionFactory_startInternalTracingCapture)(
JNIEnv* jni, jclass, jstring j_event_tracing_filename) {
if (!j_event_tracing_filename)