From 5eb8588a655e802d4407bfdbee8c1cdb97850a54 Mon Sep 17 00:00:00 2001 From: Fanny Linderborg Date: Mon, 2 Sep 2024 15:50:55 +0200 Subject: [PATCH] Move FrameInstrumentation*Data structs to common_video MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This enables usage in, e.g., `modules/rtp_rtcp`. R=sprang@webrtc.org Bug: webrtc:358039777 Change-Id: I0f8aafb75938d07f338bbf7acc4ff7c15a8b0baa Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361285 Commit-Queue: Fanny Linderborg Reviewed-by: Erik Språng Cr-Commit-Position: refs/heads/main@{#42920} --- common_video/BUILD.gn | 5 +++ common_video/frame_instrumentation_data.h | 35 +++++++++++++++++++ video/corruption_detection/BUILD.gn | 2 ++ .../frame_instrumentation_generator.cc | 1 + .../frame_instrumentation_generator.h | 17 +-------- ...rame_instrumentation_generator_unittest.cc | 1 + 6 files changed, 45 insertions(+), 16 deletions(-) create mode 100644 common_video/frame_instrumentation_data.h diff --git a/common_video/BUILD.gn b/common_video/BUILD.gn index 027064620b..54c346e10e 100644 --- a/common_video/BUILD.gn +++ b/common_video/BUILD.gn @@ -8,6 +8,10 @@ import("../webrtc.gni") +rtc_library("frame_instrumentation_data") { + sources = [ "frame_instrumentation_data.h" ] +} + rtc_library("common_video") { visibility = [ "*" ] @@ -56,6 +60,7 @@ rtc_library("common_video") { } deps = [ + ":frame_instrumentation_data", "../api:array_view", "../api:make_ref_counted", "../api:scoped_refptr", diff --git a/common_video/frame_instrumentation_data.h b/common_video/frame_instrumentation_data.h new file mode 100644 index 0000000000..e6d268a5e6 --- /dev/null +++ b/common_video/frame_instrumentation_data.h @@ -0,0 +1,35 @@ +/* + * Copyright 2024 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 COMMON_VIDEO_FRAME_INSTRUMENTATION_DATA_H_ +#define COMMON_VIDEO_FRAME_INSTRUMENTATION_DATA_H_ + +#include + +namespace webrtc { + +// TODO: b/358039777 - Error handling: negative values etc. +struct FrameInstrumentationSyncData { + int sequence_index; + bool is_key_frame; +}; + +struct FrameInstrumentationData { + int sequence_index; + bool is_key_frame; + double std_dev; + int luma_error_threshold; + int chroma_error_threshold; + std::vector sample_values; +}; + +} // namespace webrtc + +#endif // COMMON_VIDEO_FRAME_INSTRUMENTATION_DATA_H_ diff --git a/video/corruption_detection/BUILD.gn b/video/corruption_detection/BUILD.gn index 336e896491..fa6a6629fa 100644 --- a/video/corruption_detection/BUILD.gn +++ b/video/corruption_detection/BUILD.gn @@ -21,6 +21,7 @@ rtc_library("frame_instrumentation_generator") { "../../api/video:video_frame", "../../api/video:video_frame_type", "../../api/video_codecs:video_codecs_api", + "../../common_video:frame_instrumentation_data", "../../modules:module_api_public", "../../modules/video_coding:video_coding_utility", "../../rtc_base:logging", @@ -73,6 +74,7 @@ if (rtc_include_tests) { "../../api/video:encoded_image", "../../api/video:video_frame", "../../api/video:video_frame_type", + "../../common_video:frame_instrumentation_data", "../../test:test_support", "//third_party/abseil-cpp/absl/types:variant", ] diff --git a/video/corruption_detection/frame_instrumentation_generator.cc b/video/corruption_detection/frame_instrumentation_generator.cc index d0e659653f..e14782dcd0 100644 --- a/video/corruption_detection/frame_instrumentation_generator.cc +++ b/video/corruption_detection/frame_instrumentation_generator.cc @@ -25,6 +25,7 @@ #include "api/video/video_frame_buffer.h" #include "api/video/video_frame_type.h" #include "api/video_codecs/video_codec.h" +#include "common_video/frame_instrumentation_data.h" #include "modules/include/module_common_types_public.h" #include "modules/video_coding/utility/qp_parser.h" #include "rtc_base/logging.h" diff --git a/video/corruption_detection/frame_instrumentation_generator.h b/video/corruption_detection/frame_instrumentation_generator.h index 2e0f9092b4..b37f21f776 100644 --- a/video/corruption_detection/frame_instrumentation_generator.h +++ b/video/corruption_detection/frame_instrumentation_generator.h @@ -15,31 +15,16 @@ #include #include #include -#include #include "absl/types/variant.h" #include "api/video/encoded_image.h" #include "api/video/video_codec_type.h" #include "api/video/video_frame.h" +#include "common_video/frame_instrumentation_data.h" #include "video/corruption_detection/halton_frame_sampler.h" namespace webrtc { -// TODO: b/358039777 - Error handling: negative values etc. -struct FrameInstrumentationSyncData { - int sequence_index; - bool is_key_frame; -}; - -struct FrameInstrumentationData { - int sequence_index; - bool is_key_frame; - double std_dev; - int luma_error_threshold; - int chroma_error_threshold; - std::vector sample_values; -}; - class FrameInstrumentationGenerator { public: FrameInstrumentationGenerator() = delete; diff --git a/video/corruption_detection/frame_instrumentation_generator_unittest.cc b/video/corruption_detection/frame_instrumentation_generator_unittest.cc index 4af4af88e3..146a3f7840 100644 --- a/video/corruption_detection/frame_instrumentation_generator_unittest.cc +++ b/video/corruption_detection/frame_instrumentation_generator_unittest.cc @@ -21,6 +21,7 @@ #include "api/video/video_codec_type.h" #include "api/video/video_frame.h" #include "api/video/video_frame_type.h" +#include "common_video/frame_instrumentation_data.h" #include "test/gtest.h" namespace webrtc {