From ad69832b7f2b71c08ab62737b8000b680b5bd415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Terelius?= Date: Mon, 23 Oct 2023 12:13:58 +0200 Subject: [PATCH] C-style bindings around RTC event log analyzer. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is currently a stub. The analysis will be added in a followup CL. No-Try: True Bug: None Change-Id: Ief381d0c30ec29a0ef170523d31f1f902d0e6b09 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/324620 Reviewed-by: Mirko Bonadei Reviewed-by: Björn Terelius Commit-Queue: Björn Terelius Cr-Commit-Position: refs/heads/main@{#40989} --- rtc_tools/BUILD.gn | 9 +++++++ .../analyzer_bindings.cc | 27 +++++++++++++++++++ .../analyzer_bindings.h | 23 ++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 rtc_tools/rtc_event_log_visualizer/analyzer_bindings.cc create mode 100644 rtc_tools/rtc_event_log_visualizer/analyzer_bindings.h diff --git a/rtc_tools/BUILD.gn b/rtc_tools/BUILD.gn index 5ead8a0506..27a9a9d0ae 100644 --- a/rtc_tools/BUILD.gn +++ b/rtc_tools/BUILD.gn @@ -423,6 +423,15 @@ if (!build_with_chromium) { "//third_party/abseil-cpp/absl/types:optional", ] } + + rtc_library("event_log_visualizer_bindings") { + visibility = [ "*" ] + sources = [ + "rtc_event_log_visualizer/analyzer_bindings.cc", + "rtc_event_log_visualizer/analyzer_bindings.h", + ] + deps = [ ":event_log_visualizer_utils" ] + } } rtc_executable("video_encoder") { diff --git a/rtc_tools/rtc_event_log_visualizer/analyzer_bindings.cc b/rtc_tools/rtc_event_log_visualizer/analyzer_bindings.cc new file mode 100644 index 0000000000..ab5035e62c --- /dev/null +++ b/rtc_tools/rtc_event_log_visualizer/analyzer_bindings.cc @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2023 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 "rtc_tools/rtc_event_log_visualizer/analyzer_bindings.h" + +#include +#include + +void analyze_rtc_event_log(const char* log, + size_t log_size, + const char* selection, + size_t selection_size, + char* output, + size_t* output_size) { + size_t size = std::min(log_size, *output_size); + for (size_t i = 0; i < size; ++i) { + output[i] = log[i]; + } + *output_size = size; +} diff --git a/rtc_tools/rtc_event_log_visualizer/analyzer_bindings.h b/rtc_tools/rtc_event_log_visualizer/analyzer_bindings.h new file mode 100644 index 0000000000..d24d6bd028 --- /dev/null +++ b/rtc_tools/rtc_event_log_visualizer/analyzer_bindings.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2023 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. + */ + +#ifndef RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_ANALYZER_BINDINGS_H_ +#define RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_ANALYZER_BINDINGS_H_ + +#include + +void analyze_rtc_event_log(const char* log, + size_t log_size, + const char* selection, + size_t selection_size, + char* output, + size_t* output_size); + +#endif // RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_ANALYZER_BINDINGS_H_