Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: webrtc/tools/network_tester/jni.cpp

Issue 2787863002: Add network tester client [android] (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11
12 #include <jni.h>
13 #undef JNIEXPORT
14 #define JNIEXPORT __attribute__((visibility("default")))
15 #include <string>
16
17 #include "webrtc/tools/network_tester/test_controller.h"
18
19 extern "C" JNIEXPORT jlong JNICALL
20 Java_com_google_media_networktester_Tester_CreateTestController(JNIEnv* jni,
21 jclass) {
22 return reinterpret_cast<jlong>(new webrtc::TestController(
magjed_webrtc 2017/04/04 09:05:59 Use jlongFromPointer instead.
michaelt 2017/04/05 15:36:16 I would have to set the libjingle_peerconnection_j
magjed_webrtc 2017/04/05 19:08:41 Ok, then it's an overkill. Let's go with reinterpr
23 0, 0, "/mnt/sdcard/network_tester_client_config.dat",
24 "/mnt/sdcard/network_tester_client_packet_log.dat"));
25 }
26
27 extern "C" JNIEXPORT void JNICALL
28 Java_com_google_media_networktester_Tester_TestControllerConnect(
29 JNIEnv* jni,
30 jclass,
31 jlong native_pointer) {
32 reinterpret_cast<webrtc::TestController*>(native_pointer)
33 ->SendConnectTo("85.195.237.107", 9090);
34 }
35
36 extern "C" JNIEXPORT bool JNICALL
37 Java_com_google_media_networktester_Tester_TestControllerIsDone(
38 JNIEnv* jni,
39 jclass,
40 jlong native_pointer) {
41 return reinterpret_cast<webrtc::TestController*>(native_pointer)
42 ->IsTestDone();
43 }
44
45 extern "C" JNIEXPORT void JNICALL
46 Java_com_google_media_networktester_Tester_TestControllerRun(
47 JNIEnv* jni,
48 jclass,
49 jlong native_pointer) {
50 reinterpret_cast<webrtc::TestController*>(native_pointer)->Run();
51 }
52
53 extern "C" JNIEXPORT void JNICALL
54 Java_com_google_media_networktester_Tester_DestroyTestController(
55 JNIEnv* jni,
56 jclass,
57 jlong native_pointer) {
58 webrtc::TestController* test_controller =
59 reinterpret_cast<webrtc::TestController*>(native_pointer);
60 if (test_controller) {
61 delete test_controller;
62 }
63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698