From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../libwebrtc/rtc_tools/network_tester/BUILD.gn | 184 +++++++++++++++++++++ .../libwebrtc/rtc_tools/network_tester/README | 35 ++++ .../network_tester/androidapp/AndroidManifest.xml | 24 +++ .../androidapp/res/layout/activity_main.xml | 28 ++++ .../androidapp/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 3418 bytes .../androidapp/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2206 bytes .../androidapp/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4842 bytes .../androidapp/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 7718 bytes .../androidapp/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 10486 bytes .../androidapp/res/values-v17/styles.xml | 8 + .../androidapp/res/values-w820dp/dimens.xml | 6 + .../androidapp/res/values/colors.xml | 6 + .../androidapp/res/values/dimens.xml | 5 + .../androidapp/res/values/strings.xml | 6 + .../google/media/networktester/MainActivity.java | 62 +++++++ .../google/media/networktester/NetworkTester.java | 32 ++++ .../rtc_tools/network_tester/config_reader.cc | 54 ++++++ .../rtc_tools/network_tester/config_reader.h | 53 ++++++ .../network_tester/create_network_tester_config.py | 30 ++++ .../libwebrtc/rtc_tools/network_tester/jni.cc | 68 ++++++++ .../network_tester/network_tester_config.proto | 14 ++ .../network_tester/network_tester_packet.proto | 18 ++ .../network_tester/network_tester_unittest.cc | 37 +++++ .../rtc_tools/network_tester/packet_logger.cc | 44 +++++ .../rtc_tools/network_tester/packet_logger.h | 46 ++++++ .../rtc_tools/network_tester/packet_sender.cc | 133 +++++++++++++++ .../rtc_tools/network_tester/packet_sender.h | 71 ++++++++ .../rtc_tools/network_tester/parse_packet_log.py | 150 +++++++++++++++++ .../libwebrtc/rtc_tools/network_tester/server.cc | 23 +++ .../rtc_tools/network_tester/test_controller.cc | 158 ++++++++++++++++++ .../rtc_tools/network_tester/test_controller.h | 95 +++++++++++ 31 files changed, 1390 insertions(+) create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/BUILD.gn create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/README create mode 100755 third_party/libwebrtc/rtc_tools/network_tester/androidapp/AndroidManifest.xml create mode 100755 third_party/libwebrtc/rtc_tools/network_tester/androidapp/res/layout/activity_main.xml create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/androidapp/res/mipmap-hdpi/ic_launcher.png create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/androidapp/res/mipmap-mdpi/ic_launcher.png create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/androidapp/res/mipmap-xhdpi/ic_launcher.png create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/androidapp/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/androidapp/res/mipmap-xxxhdpi/ic_launcher.png create mode 100755 third_party/libwebrtc/rtc_tools/network_tester/androidapp/res/values-v17/styles.xml create mode 100755 third_party/libwebrtc/rtc_tools/network_tester/androidapp/res/values-w820dp/dimens.xml create mode 100755 third_party/libwebrtc/rtc_tools/network_tester/androidapp/res/values/colors.xml create mode 100755 third_party/libwebrtc/rtc_tools/network_tester/androidapp/res/values/dimens.xml create mode 100755 third_party/libwebrtc/rtc_tools/network_tester/androidapp/res/values/strings.xml create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/androidapp/src/com/google/media/networktester/MainActivity.java create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/androidapp/src/com/google/media/networktester/NetworkTester.java create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/config_reader.cc create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/config_reader.h create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/create_network_tester_config.py create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/jni.cc create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/network_tester_config.proto create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/network_tester_packet.proto create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/network_tester_unittest.cc create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/packet_logger.cc create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/packet_logger.h create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/packet_sender.cc create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/packet_sender.h create mode 100755 third_party/libwebrtc/rtc_tools/network_tester/parse_packet_log.py create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/server.cc create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/test_controller.cc create mode 100644 third_party/libwebrtc/rtc_tools/network_tester/test_controller.h (limited to 'third_party/libwebrtc/rtc_tools/network_tester') diff --git a/third_party/libwebrtc/rtc_tools/network_tester/BUILD.gn b/third_party/libwebrtc/rtc_tools/network_tester/BUILD.gn new file mode 100644 index 0000000000..e33a3c000f --- /dev/null +++ b/third_party/libwebrtc/rtc_tools/network_tester/BUILD.gn @@ -0,0 +1,184 @@ +# Copyright (c) 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. + +import("../../webrtc.gni") +if (rtc_enable_protobuf) { + import("//third_party/protobuf/proto_library.gni") +} + +if (rtc_enable_protobuf) { + proto_library("network_tester_config_proto") { + sources = [ "network_tester_config.proto" ] + proto_out_dir = "rtc_tools/network_tester" + } + + proto_library("network_tester_packet_proto") { + sources = [ "network_tester_packet.proto" ] + proto_out_dir = "rtc_tools/network_tester" + } + + rtc_library("network_tester") { + sources = [ + "config_reader.cc", + "config_reader.h", + "packet_logger.cc", + "packet_logger.h", + "packet_sender.cc", + "packet_sender.h", + "test_controller.cc", + "test_controller.h", + ] + + defines = [ "WEBRTC_NETWORK_TESTER_PROTO" ] + + deps = [ + ":network_tester_config_proto", + ":network_tester_packet_proto", + "../../api:sequence_checker", + "../../api/task_queue", + "../../api/task_queue:default_task_queue_factory", + "../../api/task_queue:pending_task_safety_flag", + "../../p2p:rtc_p2p", + "../../rtc_base:async_packet_socket", + "../../rtc_base:checks", + "../../rtc_base:ignore_wundef", + "../../rtc_base:ip_address", + "../../rtc_base:logging", + "../../rtc_base:macromagic", + "../../rtc_base:protobuf_utils", + "../../rtc_base:rtc_task_queue", + "../../rtc_base:socket_address", + "../../rtc_base:threading", + "../../rtc_base:timeutils", + "../../rtc_base/synchronization:mutex", + "../../rtc_base/system:no_unique_address", + "../../rtc_base/third_party/sigslot", + ] + absl_deps = [ + "//third_party/abseil-cpp/absl/functional:any_invocable", + "//third_party/abseil-cpp/absl/types:optional", + ] + } + + network_tester_unittests_resources = [ + "../../resources/network_tester/client_config.dat", + "../../resources/network_tester/server_config.dat", + ] + + if (is_ios) { + bundle_data("network_tester_unittests_bundle_data") { + testonly = true + sources = network_tester_unittests_resources + outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ] + } + } + + rtc_library("network_tester_unittests") { + testonly = true + + sources = [ "network_tester_unittest.cc" ] + + deps = [ + ":network_tester", + "../../rtc_base:gunit_helpers", + "../../rtc_base:threading", + "../../test:fileutils", + "../../test:test_support", + "//testing/gtest", + ] + + if (is_ios) { + deps += [ ":network_tester_unittests_bundle_data" ] + } + + defines = [ "WEBRTC_NETWORK_TESTER_TEST_ENABLED" ] + + data = network_tester_unittests_resources + } + + rtc_executable("network_tester_server") { + sources = [ "server.cc" ] + + deps = [ + ":network_tester", + "../../rtc_base:null_socket_server", + "../../rtc_base:threading", + ] + } +} + +if (is_android) { + rtc_android_apk("NetworkTesterMobile") { + testonly = true + apk_name = "NetworkTesterMobile" + android_manifest = "androidapp/AndroidManifest.xml" + min_sdk_version = 21 + target_sdk_version = 24 + + deps = [ + ":NetworkTesterMobile_javalib", + ":NetworkTesterMobile_resources", + "../../rtc_base:base_java", + ] + + shared_libraries = [ "../../rtc_tools/network_tester:network_tester_so" ] + } + + rtc_android_library("NetworkTesterMobile_javalib") { + testonly = true + android_manifest = "androidapp/AndroidManifest.xml" + + sources = [ + "androidapp/src/com/google/media/networktester/MainActivity.java", + "androidapp/src/com/google/media/networktester/NetworkTester.java", + ] + + resources_package = "com.google.media.networktester" + deps = [ + ":NetworkTesterMobile_resources", + "../../rtc_base:base_java", + ] + } + + android_resources("NetworkTesterMobile_resources") { + testonly = true + custom_package = "com.google.media.networktester" + sources = [ + "androidapp/res/layout/activity_main.xml", + "androidapp/res/mipmap-hdpi/ic_launcher.png", + "androidapp/res/mipmap-mdpi/ic_launcher.png", + "androidapp/res/mipmap-xhdpi/ic_launcher.png", + "androidapp/res/mipmap-xxhdpi/ic_launcher.png", + "androidapp/res/mipmap-xxxhdpi/ic_launcher.png", + "androidapp/res/values-v17/styles.xml", + "androidapp/res/values-w820dp/dimens.xml", + "androidapp/res/values/colors.xml", + "androidapp/res/values/dimens.xml", + "androidapp/res/values/strings.xml", + ] + + # Needed for Bazel converter. + resource_dirs = [ "androidapp/res" ] + assert(resource_dirs != []) # Mark as used. + } + + rtc_shared_library("network_tester_so") { + sources = [ "jni.cc" ] + + deps = [ + ":network_tester", + "../../rtc_base:logging", + "../../rtc_base:threading", + ] + + suppressed_configs += [ "//build/config/android:hide_all_but_jni_onload" ] + configs += [ "//build/config/android:hide_all_but_jni" ] + + output_extension = "so" + } +} diff --git a/third_party/libwebrtc/rtc_tools/network_tester/README b/third_party/libwebrtc/rtc_tools/network_tester/README new file mode 100644 index 0000000000..6680212e81 --- /dev/null +++ b/third_party/libwebrtc/rtc_tools/network_tester/README @@ -0,0 +1,35 @@ +This file explains how to run the network tester and how to analyze the results. + +create config files +=================== +use create_network_tester_config.py to create config files. +you can add or change the AddConfig call in the main function to create a +the desired network config. + +run network_tester_server +========================= +place the network config file next to the server binary and name it +"server_config.dat". + +the network_tester_server should run on a server with a public IP address. + +the log file of network_tester_server will be created next to the binary with +the name "server_packet_log.dat" + + +run NetworkTesterMobile (apk) +============================= +change the IP and the port in the jni.cpp file and set it to the port and IP +you run the network_tester_server on. + +place the network config file as "/mnt/sdcard/network_tester_client_config.dat" +on the tester android phone. + +The log file of network_tester_server will be created at +"/mnt/sdcard/network_tester_client_packet_log.dat" + + +analyze the results +==================== +run "python parse_packet_log.py -f " to analyze the +log results. diff --git a/third_party/libwebrtc/rtc_tools/network_tester/androidapp/AndroidManifest.xml b/third_party/libwebrtc/rtc_tools/network_tester/androidapp/AndroidManifest.xml new file mode 100755 index 0000000000..1ff519396b --- /dev/null +++ b/third_party/libwebrtc/rtc_tools/network_tester/androidapp/AndroidManifest.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + diff --git a/third_party/libwebrtc/rtc_tools/network_tester/androidapp/res/layout/activity_main.xml b/third_party/libwebrtc/rtc_tools/network_tester/androidapp/res/layout/activity_main.xml new file mode 100755 index 0000000000..8839a31003 --- /dev/null +++ b/third_party/libwebrtc/rtc_tools/network_tester/androidapp/res/layout/activity_main.xml @@ -0,0 +1,28 @@ + + +