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_