aboutsummaryrefslogtreecommitdiff
path: root/api/test
diff options
context:
space:
mode:
Diffstat (limited to 'api/test')
-rw-r--r--api/test/compile_all_headers.cc1
-rw-r--r--api/test/create_time_controller.cc41
-rw-r--r--api/test/create_time_controller.h12
-rw-r--r--api/test/create_video_codec_tester.cc27
-rw-r--r--api/test/create_video_codec_tester.h26
-rw-r--r--api/test/mock_transformable_audio_frame.h3
-rw-r--r--api/test/mock_transformable_frame.h45
-rw-r--r--api/test/mock_transformable_video_frame.h2
-rw-r--r--api/test/pclf/BUILD.gn4
-rw-r--r--api/test/pclf/media_quality_test_params.h6
-rw-r--r--api/test/pclf/peer_configurer.cc13
-rw-r--r--api/test/pclf/peer_configurer.h8
-rw-r--r--api/test/video_codec_stats.cc97
-rw-r--r--api/test/video_codec_stats.h120
-rw-r--r--api/test/video_codec_tester.h148
15 files changed, 102 insertions, 451 deletions
diff --git a/api/test/compile_all_headers.cc b/api/test/compile_all_headers.cc
index 1fcf63e97b..9d375a19f2 100644
--- a/api/test/compile_all_headers.cc
+++ b/api/test/compile_all_headers.cc
@@ -43,6 +43,7 @@
#include "api/test/mock_rtpreceiver.h"
#include "api/test/mock_rtpsender.h"
#include "api/test/mock_session_description_interface.h"
+#include "api/test/mock_transformable_frame.h"
#include "api/test/mock_transformable_video_frame.h"
#include "api/test/mock_video_bitrate_allocator.h"
#include "api/test/mock_video_bitrate_allocator_factory.h"
diff --git a/api/test/create_time_controller.cc b/api/test/create_time_controller.cc
index d198f2b0fe..3378805088 100644
--- a/api/test/create_time_controller.cc
+++ b/api/test/create_time_controller.cc
@@ -11,10 +11,17 @@
#include "api/test/create_time_controller.h"
#include <memory>
+#include <utility>
+#include "absl/base/nullability.h"
+#include "api/enable_media_with_defaults.h"
+#include "api/peer_connection_interface.h"
#include "call/call.h"
#include "call/rtp_transport_config.h"
#include "call/rtp_transport_controller_send_factory_interface.h"
+#include "pc/media_factory.h"
+#include "rtc_base/checks.h"
+#include "system_wrappers/include/clock.h"
#include "test/time_controller/external_time_controller.h"
#include "test/time_controller/simulated_time_controller.h"
@@ -36,7 +43,7 @@ std::unique_ptr<CallFactoryInterface> CreateTimeControllerBasedCallFactory(
public:
explicit TimeControllerBasedCallFactory(TimeController* time_controller)
: time_controller_(time_controller) {}
- Call* CreateCall(const Call::Config& config) override {
+ std::unique_ptr<Call> CreateCall(const CallConfig& config) override {
RtpTransportConfig transportConfig = config.ExtractTransportConfig();
return Call::Create(config, time_controller_->GetClock(),
@@ -50,4 +57,36 @@ std::unique_ptr<CallFactoryInterface> CreateTimeControllerBasedCallFactory(
return std::make_unique<TimeControllerBasedCallFactory>(time_controller);
}
+void EnableMediaWithDefaultsAndTimeController(
+ TimeController& time_controller,
+ PeerConnectionFactoryDependencies& deps) {
+ class TimeControllerBasedFactory : public MediaFactory {
+ public:
+ TimeControllerBasedFactory(
+ absl::Nonnull<Clock*> clock,
+ absl::Nonnull<std::unique_ptr<MediaFactory>> media_factory)
+ : clock_(clock), media_factory_(std::move(media_factory)) {}
+
+ std::unique_ptr<Call> CreateCall(const CallConfig& config) override {
+ return Call::Create(config, clock_,
+ config.rtp_transport_controller_send_factory->Create(
+ config.ExtractTransportConfig(), clock_));
+ }
+
+ std::unique_ptr<cricket::MediaEngineInterface> CreateMediaEngine(
+ PeerConnectionFactoryDependencies& dependencies) override {
+ return media_factory_->CreateMediaEngine(dependencies);
+ }
+
+ private:
+ absl::Nonnull<Clock*> clock_;
+ absl::Nonnull<std::unique_ptr<MediaFactory>> media_factory_;
+ };
+
+ EnableMediaWithDefaults(deps);
+ RTC_CHECK(deps.media_factory);
+ deps.media_factory = std::make_unique<TimeControllerBasedFactory>(
+ time_controller.GetClock(), std::move(deps.media_factory));
+}
+
} // namespace webrtc
diff --git a/api/test/create_time_controller.h b/api/test/create_time_controller.h
index e7bc9cb465..9d0e7dde21 100644
--- a/api/test/create_time_controller.h
+++ b/api/test/create_time_controller.h
@@ -13,6 +13,7 @@
#include <memory>
#include "api/call/call_factory_interface.h"
+#include "api/peer_connection_interface.h"
#include "api/test/time_controller.h"
namespace webrtc {
@@ -26,8 +27,15 @@ std::unique_ptr<TimeController> CreateSimulatedTimeController();
// This is creates a call factory that creates Call instances that are backed by
// a time controller.
-std::unique_ptr<CallFactoryInterface> CreateTimeControllerBasedCallFactory(
- TimeController* time_controller);
+[[deprecated("bugs.webrtc.org/15574")]] std::unique_ptr<CallFactoryInterface>
+CreateTimeControllerBasedCallFactory(TimeController* time_controller);
+
+// Adjusts media `deps` to use clock `time_controller` provides, fills media
+// related dependencies, and enables media support for a PeerConnectionFactory
+// created from `deps`.
+void EnableMediaWithDefaultsAndTimeController(
+ TimeController& time_controller,
+ PeerConnectionFactoryDependencies& deps);
} // namespace webrtc
diff --git a/api/test/create_video_codec_tester.cc b/api/test/create_video_codec_tester.cc
deleted file mode 100644
index a1efefdb48..0000000000
--- a/api/test/create_video_codec_tester.cc
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2022 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 "api/test/create_video_codec_tester.h"
-
-#include <memory>
-#include <utility>
-
-#include "api/test/video_codec_tester.h"
-#include "modules/video_coding/codecs/test/video_codec_tester_impl.h"
-
-namespace webrtc {
-namespace test {
-
-std::unique_ptr<VideoCodecTester> CreateVideoCodecTester() {
- return std::make_unique<VideoCodecTesterImpl>();
-}
-
-} // namespace test
-} // namespace webrtc
diff --git a/api/test/create_video_codec_tester.h b/api/test/create_video_codec_tester.h
deleted file mode 100644
index c68864ce85..0000000000
--- a/api/test/create_video_codec_tester.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2022 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 API_TEST_CREATE_VIDEO_CODEC_TESTER_H_
-#define API_TEST_CREATE_VIDEO_CODEC_TESTER_H_
-
-#include <memory>
-
-#include "api/test/video_codec_tester.h"
-
-namespace webrtc {
-namespace test {
-
-std::unique_ptr<VideoCodecTester> CreateVideoCodecTester();
-
-} // namespace test
-} // namespace webrtc
-
-#endif // API_TEST_CREATE_VIDEO_CODEC_TESTER_H_
diff --git a/api/test/mock_transformable_audio_frame.h b/api/test/mock_transformable_audio_frame.h
index be703006ea..584c77fa54 100644
--- a/api/test/mock_transformable_audio_frame.h
+++ b/api/test/mock_transformable_audio_frame.h
@@ -11,6 +11,8 @@
#ifndef API_TEST_MOCK_TRANSFORMABLE_AUDIO_FRAME_H_
#define API_TEST_MOCK_TRANSFORMABLE_AUDIO_FRAME_H_
+#include <string>
+
#include "api/frame_transformer_interface.h"
#include "test/gmock.h"
@@ -24,6 +26,7 @@ class MockTransformableAudioFrame : public TransformableAudioFrameInterface {
MOCK_METHOD(uint8_t, GetPayloadType, (), (const, override));
MOCK_METHOD(uint32_t, GetSsrc, (), (const, override));
MOCK_METHOD(uint32_t, GetTimestamp, (), (const, override));
+ MOCK_METHOD(std::string, GetMimeType, (), (const, override));
MOCK_METHOD(rtc::ArrayView<const uint32_t>,
GetContributingSources,
(),
diff --git a/api/test/mock_transformable_frame.h b/api/test/mock_transformable_frame.h
new file mode 100644
index 0000000000..df20b62295
--- /dev/null
+++ b/api/test/mock_transformable_frame.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 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 API_TEST_MOCK_TRANSFORMABLE_FRAME_H_
+#define API_TEST_MOCK_TRANSFORMABLE_FRAME_H_
+
+#include <stdint.h>
+
+#include <optional>
+#include <string>
+
+#include "api/array_view.h"
+#include "api/frame_transformer_interface.h"
+#include "api/units/timestamp.h"
+#include "test/gmock.h"
+
+namespace webrtc {
+
+class MockTransformableFrame : public webrtc::TransformableFrameInterface {
+ public:
+ MOCK_METHOD(rtc::ArrayView<const uint8_t>, GetData, (), (const, override));
+ MOCK_METHOD(void, SetData, (rtc::ArrayView<const uint8_t>), (override));
+ MOCK_METHOD(uint8_t, GetPayloadType, (), (const, override));
+ MOCK_METHOD(uint32_t, GetSsrc, (), (const, override));
+ MOCK_METHOD(uint32_t, GetTimestamp, (), (const, override));
+ MOCK_METHOD(void, SetRTPTimestamp, (uint32_t), (override));
+ MOCK_METHOD(std::optional<webrtc::Timestamp>,
+ GetCaptureTimeIdentifier,
+ (),
+ (const, override));
+ MOCK_METHOD(std::string, GetMimeType, (), (const, override));
+};
+
+static_assert(!std::is_abstract_v<MockTransformableFrame>, "");
+
+} // namespace webrtc
+
+#endif // API_TEST_MOCK_TRANSFORMABLE_FRAME_H_
diff --git a/api/test/mock_transformable_video_frame.h b/api/test/mock_transformable_video_frame.h
index 21c4dc2b69..b3825ddf48 100644
--- a/api/test/mock_transformable_video_frame.h
+++ b/api/test/mock_transformable_video_frame.h
@@ -11,6 +11,7 @@
#ifndef API_TEST_MOCK_TRANSFORMABLE_VIDEO_FRAME_H_
#define API_TEST_MOCK_TRANSFORMABLE_VIDEO_FRAME_H_
+#include <string>
#include <vector>
#include "api/frame_transformer_interface.h"
@@ -36,6 +37,7 @@ class MockTransformableVideoFrame
GetDirection,
(),
(const, override));
+ MOCK_METHOD(std::string, GetMimeType, (), (const, override));
MOCK_METHOD(VideoFrameMetadata, Metadata, (), (const, override));
MOCK_METHOD(absl::optional<Timestamp>,
GetCaptureTimeIdentifier,
diff --git a/api/test/pclf/BUILD.gn b/api/test/pclf/BUILD.gn
index f94150f36b..372ff51f49 100644
--- a/api/test/pclf/BUILD.gn
+++ b/api/test/pclf/BUILD.gn
@@ -66,14 +66,12 @@ rtc_library("media_quality_test_params") {
deps = [
":media_configuration",
"../..:async_dns_resolver",
- "../../../api:callfactory_api",
"../../../api:fec_controller_api",
"../../../api:field_trials_view",
"../../../api:libjingle_peerconnection_api",
"../../../api:packet_socket_factory",
"../../../api/audio:audio_mixer_api",
"../../../api/rtc_event_log",
- "../../../api/task_queue",
"../../../api/transport:network_control",
"../../../api/video_codecs:video_codecs_api",
"../../../modules/audio_processing:api",
@@ -96,7 +94,6 @@ rtc_library("peer_configurer") {
":media_configuration",
":media_quality_test_params",
"../..:async_dns_resolver",
- "../../../api:callfactory_api",
"../../../api:create_peer_connection_quality_test_frame_generator",
"../../../api:fec_controller_api",
"../../../api:field_trials_view",
@@ -109,7 +106,6 @@ rtc_library("peer_configurer") {
"../../../api/audio_codecs:audio_codecs_api",
"../../../api/neteq:neteq_api",
"../../../api/rtc_event_log",
- "../../../api/task_queue",
"../../../api/transport:bitrate_settings",
"../../../api/transport:network_control",
"../../../api/video_codecs:video_codecs_api",
diff --git a/api/test/pclf/media_quality_test_params.h b/api/test/pclf/media_quality_test_params.h
index a247f342b0..aad04c3eb6 100644
--- a/api/test/pclf/media_quality_test_params.h
+++ b/api/test/pclf/media_quality_test_params.h
@@ -17,11 +17,9 @@
#include "api/async_dns_resolver.h"
#include "api/audio/audio_mixer.h"
-#include "api/call/call_factory_interface.h"
#include "api/fec_controller.h"
#include "api/field_trials_view.h"
#include "api/rtc_event_log/rtc_event_log_factory_interface.h"
-#include "api/task_queue/task_queue_factory.h"
#include "api/test/pclf/media_configuration.h"
#include "api/transport/network_control.h"
#include "api/video_codecs/video_decoder_factory.h"
@@ -46,15 +44,11 @@ namespace webrtc_pc_e2e {
// can override only some parts of media engine like video encoder/decoder
// factories.
struct PeerConnectionFactoryComponents {
- std::unique_ptr<TaskQueueFactory> task_queue_factory;
- std::unique_ptr<CallFactoryInterface> call_factory;
std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory;
std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory;
std::unique_ptr<NetworkControllerFactoryInterface> network_controller_factory;
std::unique_ptr<NetEqFactory> neteq_factory;
- // Will be passed to MediaEngineInterface, that will be used in
- // PeerConnectionFactory.
std::unique_ptr<VideoEncoderFactory> video_encoder_factory;
std::unique_ptr<VideoDecoderFactory> video_decoder_factory;
rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory;
diff --git a/api/test/pclf/peer_configurer.cc b/api/test/pclf/peer_configurer.cc
index 949dbd347c..5e385452b1 100644
--- a/api/test/pclf/peer_configurer.cc
+++ b/api/test/pclf/peer_configurer.cc
@@ -22,7 +22,6 @@
#include "api/audio/audio_mixer.h"
#include "api/audio_codecs/audio_decoder_factory.h"
#include "api/audio_codecs/audio_encoder_factory.h"
-#include "api/call/call_factory_interface.h"
#include "api/fec_controller.h"
#include "api/field_trials_view.h"
#include "api/ice_transport_interface.h"
@@ -30,7 +29,6 @@
#include "api/peer_connection_interface.h"
#include "api/rtc_event_log/rtc_event_log_factory_interface.h"
#include "api/scoped_refptr.h"
-#include "api/task_queue/task_queue_factory.h"
#include "api/test/create_peer_connection_quality_test_frame_generator.h"
#include "api/test/frame_generator_interface.h"
#include "api/test/pclf/media_configuration.h"
@@ -62,17 +60,6 @@ PeerConfigurer* PeerConfigurer::SetName(absl::string_view name) {
return this;
}
-PeerConfigurer* PeerConfigurer::SetTaskQueueFactory(
- std::unique_ptr<TaskQueueFactory> task_queue_factory) {
- components_->pcf_dependencies->task_queue_factory =
- std::move(task_queue_factory);
- return this;
-}
-PeerConfigurer* PeerConfigurer::SetCallFactory(
- std::unique_ptr<CallFactoryInterface> call_factory) {
- components_->pcf_dependencies->call_factory = std::move(call_factory);
- return this;
-}
PeerConfigurer* PeerConfigurer::SetEventLogFactory(
std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory) {
components_->pcf_dependencies->event_log_factory =
diff --git a/api/test/pclf/peer_configurer.h b/api/test/pclf/peer_configurer.h
index 2012ebc28c..c0faf8573a 100644
--- a/api/test/pclf/peer_configurer.h
+++ b/api/test/pclf/peer_configurer.h
@@ -21,7 +21,6 @@
#include "api/audio/audio_mixer.h"
#include "api/audio_codecs/audio_decoder_factory.h"
#include "api/audio_codecs/audio_encoder_factory.h"
-#include "api/call/call_factory_interface.h"
#include "api/fec_controller.h"
#include "api/field_trials_view.h"
#include "api/ice_transport_interface.h"
@@ -29,7 +28,6 @@
#include "api/peer_connection_interface.h"
#include "api/rtc_event_log/rtc_event_log_factory_interface.h"
#include "api/scoped_refptr.h"
-#include "api/task_queue/task_queue_factory.h"
#include "api/test/frame_generator_interface.h"
#include "api/test/pclf/media_configuration.h"
#include "api/test/pclf/media_quality_test_params.h"
@@ -59,13 +57,9 @@ class PeerConfigurer {
// unique.
PeerConfigurer* SetName(absl::string_view name);
- // The parameters of the following 9 methods will be passed to the
+ // The parameters of the following 7 methods will be passed to the
// PeerConnectionFactoryInterface implementation that will be created for
// this peer.
- PeerConfigurer* SetTaskQueueFactory(
- std::unique_ptr<TaskQueueFactory> task_queue_factory);
- PeerConfigurer* SetCallFactory(
- std::unique_ptr<CallFactoryInterface> call_factory);
PeerConfigurer* SetEventLogFactory(
std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory);
PeerConfigurer* SetFecControllerFactory(
diff --git a/api/test/video_codec_stats.cc b/api/test/video_codec_stats.cc
deleted file mode 100644
index fb7226701e..0000000000
--- a/api/test/video_codec_stats.cc
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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 "api/test/video_codec_stats.h"
-
-namespace webrtc {
-namespace test {
-
-void VideoCodecStats::Stream::LogMetrics(
- MetricsLogger* logger,
- std::string test_case_name,
- std::map<std::string, std::string> metadata) const {
- logger->LogMetric("width", test_case_name, width, Unit::kCount,
- webrtc::test::ImprovementDirection::kBiggerIsBetter,
- metadata);
-
- logger->LogMetric("height", test_case_name, height, Unit::kCount,
- webrtc::test::ImprovementDirection::kBiggerIsBetter,
- metadata);
-
- logger->LogMetric(
- "frame_size_bytes", test_case_name, frame_size_bytes, Unit::kBytes,
- webrtc::test::ImprovementDirection::kNeitherIsBetter, metadata);
-
- logger->LogMetric("keyframe", test_case_name, keyframe, Unit::kCount,
- webrtc::test::ImprovementDirection::kSmallerIsBetter,
- metadata);
-
- logger->LogMetric("qp", test_case_name, qp, Unit::kUnitless,
- webrtc::test::ImprovementDirection::kSmallerIsBetter,
- metadata);
-
- logger->LogMetric(
- "encode_time_ms", test_case_name, encode_time_ms, Unit::kMilliseconds,
- webrtc::test::ImprovementDirection::kSmallerIsBetter, metadata);
-
- logger->LogMetric(
- "decode_time_ms", test_case_name, decode_time_ms, Unit::kMilliseconds,
- webrtc::test::ImprovementDirection::kSmallerIsBetter, metadata);
-
- logger->LogMetric("target_bitrate_kbps", test_case_name, target_bitrate_kbps,
- Unit::kKilobitsPerSecond,
- webrtc::test::ImprovementDirection::kBiggerIsBetter,
- metadata);
-
- logger->LogMetric("target_framerate_fps", test_case_name,
- target_framerate_fps, Unit::kHertz,
- webrtc::test::ImprovementDirection::kBiggerIsBetter,
- metadata);
-
- logger->LogMetric("encoded_bitrate_kbps", test_case_name,
- encoded_bitrate_kbps, Unit::kKilobitsPerSecond,
- webrtc::test::ImprovementDirection::kBiggerIsBetter,
- metadata);
-
- logger->LogMetric("encoded_framerate_fps", test_case_name,
- encoded_framerate_fps, Unit::kHertz,
- webrtc::test::ImprovementDirection::kBiggerIsBetter,
- metadata);
-
- logger->LogMetric("bitrate_mismatch_pct", test_case_name,
- bitrate_mismatch_pct, Unit::kPercent,
- webrtc::test::ImprovementDirection::kSmallerIsBetter,
- metadata);
-
- logger->LogMetric("framerate_mismatch_pct", test_case_name,
- framerate_mismatch_pct, Unit::kPercent,
- webrtc::test::ImprovementDirection::kSmallerIsBetter,
- metadata);
-
- logger->LogMetric("transmission_time_ms", test_case_name,
- transmission_time_ms, Unit::kMilliseconds,
- webrtc::test::ImprovementDirection::kSmallerIsBetter,
- metadata);
-
- logger->LogMetric("psnr_y_db", test_case_name, psnr.y, Unit::kUnitless,
- webrtc::test::ImprovementDirection::kBiggerIsBetter,
- metadata);
-
- logger->LogMetric("psnr_u_db", test_case_name, psnr.u, Unit::kUnitless,
- webrtc::test::ImprovementDirection::kBiggerIsBetter,
- metadata);
-
- logger->LogMetric("psnr_v_db", test_case_name, psnr.v, Unit::kUnitless,
- webrtc::test::ImprovementDirection::kBiggerIsBetter,
- metadata);
-}
-
-} // namespace test
-} // namespace webrtc
diff --git a/api/test/video_codec_stats.h b/api/test/video_codec_stats.h
deleted file mode 100644
index 80f8287848..0000000000
--- a/api/test/video_codec_stats.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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 API_TEST_VIDEO_CODEC_STATS_H_
-#define API_TEST_VIDEO_CODEC_STATS_H_
-
-#include <map>
-#include <string>
-#include <vector>
-
-#include "absl/types/optional.h"
-#include "api/numerics/samples_stats_counter.h"
-#include "api/test/metrics/metric.h"
-#include "api/test/metrics/metrics_logger.h"
-#include "api/units/data_rate.h"
-#include "api/units/data_size.h"
-#include "api/units/frequency.h"
-
-namespace webrtc {
-namespace test {
-
-// Interface for encoded and/or decoded video frame and stream statistics.
-class VideoCodecStats {
- public:
- // Filter for slicing frames.
- struct Filter {
- absl::optional<int> first_frame;
- absl::optional<int> last_frame;
- absl::optional<int> spatial_idx;
- absl::optional<int> temporal_idx;
- };
-
- struct Frame {
- int frame_num = 0;
- uint32_t timestamp_rtp = 0;
-
- int spatial_idx = 0;
- int temporal_idx = 0;
-
- int width = 0;
- int height = 0;
- DataSize frame_size = DataSize::Zero();
- bool keyframe = false;
- absl::optional<int> qp;
- absl::optional<int> base_spatial_idx;
-
- Timestamp encode_start = Timestamp::Zero();
- TimeDelta encode_time = TimeDelta::Zero();
- Timestamp decode_start = Timestamp::Zero();
- TimeDelta decode_time = TimeDelta::Zero();
-
- struct Psnr {
- double y = 0.0;
- double u = 0.0;
- double v = 0.0;
- };
- absl::optional<Psnr> psnr;
-
- absl::optional<DataRate> target_bitrate;
- absl::optional<Frequency> target_framerate;
-
- bool encoded = false;
- bool decoded = false;
- };
-
- struct Stream {
- SamplesStatsCounter width;
- SamplesStatsCounter height;
- SamplesStatsCounter frame_size_bytes;
- SamplesStatsCounter keyframe;
- SamplesStatsCounter qp;
-
- SamplesStatsCounter encode_time_ms;
- SamplesStatsCounter decode_time_ms;
-
- SamplesStatsCounter target_bitrate_kbps;
- SamplesStatsCounter target_framerate_fps;
-
- SamplesStatsCounter encoded_bitrate_kbps;
- SamplesStatsCounter encoded_framerate_fps;
-
- SamplesStatsCounter bitrate_mismatch_pct;
- SamplesStatsCounter framerate_mismatch_pct;
-
- SamplesStatsCounter transmission_time_ms;
-
- struct Psnr {
- SamplesStatsCounter y;
- SamplesStatsCounter u;
- SamplesStatsCounter v;
- } psnr;
-
- // Logs `Stream` metrics to provided `MetricsLogger`.
- void LogMetrics(MetricsLogger* logger,
- std::string test_case_name,
- std::map<std::string, std::string> metadata = {}) const;
- };
-
- virtual ~VideoCodecStats() = default;
-
- // Returns frames from interval, spatial and temporal layer specified by given
- // `filter`.
- virtual std::vector<Frame> Slice(
- absl::optional<Filter> filter = absl::nullopt) const = 0;
-
- // Returns video statistics aggregated for given `frames`.
- virtual Stream Aggregate(const std::vector<Frame>& frames) const = 0;
-};
-
-} // namespace test
-} // namespace webrtc
-
-#endif // API_TEST_VIDEO_CODEC_STATS_H_
diff --git a/api/test/video_codec_tester.h b/api/test/video_codec_tester.h
deleted file mode 100644
index c2fb89e2cb..0000000000
--- a/api/test/video_codec_tester.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2022 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 API_TEST_VIDEO_CODEC_TESTER_H_
-#define API_TEST_VIDEO_CODEC_TESTER_H_
-
-#include <memory>
-#include <string>
-
-#include "absl/functional/any_invocable.h"
-#include "absl/types/optional.h"
-#include "api/test/video_codec_stats.h"
-#include "api/video/encoded_image.h"
-#include "api/video/resolution.h"
-#include "api/video/video_frame.h"
-
-namespace webrtc {
-namespace test {
-
-// Interface for a video codec tester. The interface provides minimalistic set
-// of data structures that enables implementation of decode-only, encode-only
-// and encode-decode tests.
-class VideoCodecTester {
- public:
- // Pacing settings for codec input.
- struct PacingSettings {
- enum PacingMode {
- // Pacing is not used. Frames are sent to codec back-to-back.
- kNoPacing,
- // Pace with the rate equal to the target video frame rate. Pacing time is
- // derived from RTP timestamp.
- kRealTime,
- // Pace with the explicitly provided rate.
- kConstantRate,
- };
- PacingMode mode = PacingMode::kNoPacing;
- // Pacing rate for `kConstantRate` mode.
- Frequency constant_rate = Frequency::Zero();
- };
-
- struct DecoderSettings {
- PacingSettings pacing;
- absl::optional<std::string> decoder_input_base_path;
- absl::optional<std::string> decoder_output_base_path;
- };
-
- struct EncoderSettings {
- PacingSettings pacing;
- absl::optional<std::string> encoder_input_base_path;
- absl::optional<std::string> encoder_output_base_path;
- };
-
- virtual ~VideoCodecTester() = default;
-
- // Interface for a raw video frames source.
- class RawVideoSource {
- public:
- virtual ~RawVideoSource() = default;
-
- // Returns next frame. If no more frames to pull, returns `absl::nullopt`.
- // For analysis and pacing purposes, frame must have RTP timestamp set. The
- // timestamp must represent the target video frame rate and be unique.
- virtual absl::optional<VideoFrame> PullFrame() = 0;
-
- // Returns early pulled frame with RTP timestamp equal to `timestamp_rtp`.
- virtual VideoFrame GetFrame(uint32_t timestamp_rtp,
- Resolution resolution) = 0;
- };
-
- // Interface for a coded video frames source.
- class CodedVideoSource {
- public:
- virtual ~CodedVideoSource() = default;
-
- // Returns next frame. If no more frames to pull, returns `absl::nullopt`.
- // For analysis and pacing purposes, frame must have RTP timestamp set. The
- // timestamp must represent the target video frame rate and be unique.
- virtual absl::optional<EncodedImage> PullFrame() = 0;
- };
-
- // Interface for a video encoder.
- class Encoder {
- public:
- using EncodeCallback =
- absl::AnyInvocable<void(const EncodedImage& encoded_frame)>;
-
- virtual ~Encoder() = default;
-
- virtual void Initialize() = 0;
-
- virtual void Encode(const VideoFrame& frame, EncodeCallback callback) = 0;
-
- virtual void Flush() = 0;
- };
-
- // Interface for a video decoder.
- class Decoder {
- public:
- using DecodeCallback =
- absl::AnyInvocable<void(const VideoFrame& decoded_frame)>;
-
- virtual ~Decoder() = default;
-
- virtual void Initialize() = 0;
-
- virtual void Decode(const EncodedImage& frame, DecodeCallback callback) = 0;
-
- virtual void Flush() = 0;
- };
-
- // Pulls coded video frames from `video_source` and passes them to `decoder`.
- // Returns `VideoCodecTestStats` object that contains collected per-frame
- // metrics.
- virtual std::unique_ptr<VideoCodecStats> RunDecodeTest(
- CodedVideoSource* video_source,
- Decoder* decoder,
- const DecoderSettings& decoder_settings) = 0;
-
- // Pulls raw video frames from `video_source` and passes them to `encoder`.
- // Returns `VideoCodecTestStats` object that contains collected per-frame
- // metrics.
- virtual std::unique_ptr<VideoCodecStats> RunEncodeTest(
- RawVideoSource* video_source,
- Encoder* encoder,
- const EncoderSettings& encoder_settings) = 0;
-
- // Pulls raw video frames from `video_source`, passes them to `encoder` and
- // then passes encoded frames to `decoder`. Returns `VideoCodecTestStats`
- // object that contains collected per-frame metrics.
- virtual std::unique_ptr<VideoCodecStats> RunEncodeDecodeTest(
- RawVideoSource* video_source,
- Encoder* encoder,
- Decoder* decoder,
- const EncoderSettings& encoder_settings,
- const DecoderSettings& decoder_settings) = 0;
-};
-
-} // namespace test
-} // namespace webrtc
-
-#endif // API_TEST_VIDEO_CODEC_TESTER_H_