Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Mirko Bonadei | 317a1f0 | 2019-09-17 15:06:18 | [diff] [blame] | 11 | #include <memory> |
Artem Titov | 8a9f3a8 | 2023-04-25 07:56:49 | [diff] [blame] | 12 | |
Johannes Kron | f7f13e0 | 2018-12-12 10:17:43 | [diff] [blame] | 13 | #include "absl/types/optional.h" |
Danil Chapovalov | 99b71df | 2018-10-26 13:57:48 | [diff] [blame] | 14 | #include "api/test/video/function_video_encoder_factory.h" |
Johannes Kron | f7f13e0 | 2018-12-12 10:17:43 | [diff] [blame] | 15 | #include "api/video/color_space.h" |
| 16 | #include "api/video/video_rotation.h" |
Johannes Kron | f1ab9b9 | 2018-12-14 09:14:07 | [diff] [blame] | 17 | #include "common_video/test/utilities.h" |
Florent Castelli | 5278b39 | 2023-05-31 12:44:32 | [diff] [blame] | 18 | #include "media/base/codec.h" |
| 19 | #include "media/base/media_constants.h" |
Steve Anton | 10542f2 | 2019-01-11 17:11:00 | [diff] [blame] | 20 | #include "media/engine/internal_decoder_factory.h" |
| 21 | #include "media/engine/internal_encoder_factory.h" |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 22 | #include "modules/video_coding/codecs/h264/include/h264.h" |
Emircan Uysaler | ef76e5a | 2018-02-12 21:36:41 | [diff] [blame] | 23 | #include "modules/video_coding/codecs/multiplex/include/multiplex_decoder_adapter.h" |
| 24 | #include "modules/video_coding/codecs/multiplex/include/multiplex_encoder_adapter.h" |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 25 | #include "modules/video_coding/codecs/vp8/include/vp8.h" |
| 26 | #include "modules/video_coding/codecs/vp9/include/vp9.h" |
| 27 | #include "test/call_test.h" |
| 28 | #include "test/encoder_settings.h" |
| 29 | #include "test/field_trial.h" |
| 30 | #include "test/gtest.h" |
Artem Titov | 8a9f3a8 | 2023-04-25 07:56:49 | [diff] [blame] | 31 | #include "test/video_test_constants.h" |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 32 | |
| 33 | namespace webrtc { |
Elad Alon | d8d3248 | 2019-02-18 22:45:57 | [diff] [blame] | 34 | namespace { |
| 35 | enum : int { // The first valid value is 1. |
| 36 | kColorSpaceExtensionId = 1, |
| 37 | kVideoRotationExtensionId, |
| 38 | }; |
| 39 | } // namespace |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 40 | |
Danil Chapovalov | 636865e | 2020-06-03 12:11:26 | [diff] [blame] | 41 | class CodecEndToEndTest : public test::CallTest { |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 42 | public: |
Danil Chapovalov | 636865e | 2020-06-03 12:11:26 | [diff] [blame] | 43 | CodecEndToEndTest() { |
Elad Alon | d8d3248 | 2019-02-18 22:45:57 | [diff] [blame] | 44 | RegisterRtpExtension( |
| 45 | RtpExtension(RtpExtension::kColorSpaceUri, kColorSpaceExtensionId)); |
| 46 | RegisterRtpExtension(RtpExtension(RtpExtension::kVideoRotationUri, |
| 47 | kVideoRotationExtensionId)); |
| 48 | } |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 49 | }; |
| 50 | |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 51 | class CodecObserver : public test::EndToEndTest, |
| 52 | public rtc::VideoSinkInterface<VideoFrame> { |
| 53 | public: |
| 54 | CodecObserver(int no_frames_to_wait_for, |
| 55 | VideoRotation rotation_to_test, |
Johannes Kron | f7f13e0 | 2018-12-12 10:17:43 | [diff] [blame] | 56 | absl::optional<ColorSpace> color_space_to_test, |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 57 | const std::string& payload_name, |
Niels Möller | 4db138e | 2018-04-19 07:04:13 | [diff] [blame] | 58 | VideoEncoderFactory* encoder_factory, |
Niels Möller | cbcbc22 | 2018-09-28 07:07:24 | [diff] [blame] | 59 | VideoDecoderFactory* decoder_factory) |
Artem Titov | 8a9f3a8 | 2023-04-25 07:56:49 | [diff] [blame] | 60 | : EndToEndTest(4 * test::VideoTestConstants::kDefaultTimeout), |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 61 | // TODO(hta): This timeout (120 seconds) is excessive. |
| 62 | // https://bugs.webrtc.org/6830 |
| 63 | no_frames_to_wait_for_(no_frames_to_wait_for), |
| 64 | expected_rotation_(rotation_to_test), |
Johannes Kron | f7f13e0 | 2018-12-12 10:17:43 | [diff] [blame] | 65 | expected_color_space_(color_space_to_test), |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 66 | payload_name_(payload_name), |
Niels Möller | 4db138e | 2018-04-19 07:04:13 | [diff] [blame] | 67 | encoder_factory_(encoder_factory), |
Niels Möller | cbcbc22 | 2018-09-28 07:07:24 | [diff] [blame] | 68 | decoder_factory_(decoder_factory), |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 69 | frame_counter_(0) {} |
| 70 | |
| 71 | void PerformTest() override { |
| 72 | EXPECT_TRUE(Wait()) |
| 73 | << "Timed out while waiting for enough frames to be decoded."; |
| 74 | } |
| 75 | |
| 76 | void ModifyVideoConfigs( |
| 77 | VideoSendStream::Config* send_config, |
Tommi | f6f4543 | 2022-05-20 13:21:20 | [diff] [blame] | 78 | std::vector<VideoReceiveStreamInterface::Config>* receive_configs, |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 79 | VideoEncoderConfig* encoder_config) override { |
Niels Möller | 259a497 | 2018-04-05 13:36:51 | [diff] [blame] | 80 | encoder_config->codec_type = PayloadStringToCodecType(payload_name_); |
Niels Möller | 4db138e | 2018-04-19 07:04:13 | [diff] [blame] | 81 | send_config->encoder_settings.encoder_factory = encoder_factory_; |
Niels Möller | 259a497 | 2018-04-05 13:36:51 | [diff] [blame] | 82 | send_config->rtp.payload_name = payload_name_; |
Artem Titov | 8a9f3a8 | 2023-04-25 07:56:49 | [diff] [blame] | 83 | send_config->rtp.payload_type = |
| 84 | test::VideoTestConstants::kVideoSendPayloadType; |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 85 | |
| 86 | (*receive_configs)[0].renderer = this; |
| 87 | (*receive_configs)[0].decoders.resize(1); |
| 88 | (*receive_configs)[0].decoders[0].payload_type = |
Niels Möller | 259a497 | 2018-04-05 13:36:51 | [diff] [blame] | 89 | send_config->rtp.payload_type; |
Niels Möller | cb7e1d2 | 2018-09-11 13:56:04 | [diff] [blame] | 90 | (*receive_configs)[0].decoders[0].video_format = |
| 91 | SdpVideoFormat(send_config->rtp.payload_name); |
Philip Eliasson | 2b068ce | 2020-08-03 15:55:10 | [diff] [blame] | 92 | (*receive_configs)[0].decoder_factory = decoder_factory_; |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 93 | } |
| 94 | |
| 95 | void OnFrame(const VideoFrame& video_frame) override { |
| 96 | EXPECT_EQ(expected_rotation_, video_frame.rotation()); |
Johannes Kron | f7f13e0 | 2018-12-12 10:17:43 | [diff] [blame] | 97 | // Test only if explicit color space has been specified since otherwise the |
| 98 | // color space is codec dependent. |
| 99 | if (expected_color_space_) { |
| 100 | EXPECT_EQ(expected_color_space_, |
| 101 | video_frame.color_space() |
| 102 | ? absl::make_optional(*video_frame.color_space()) |
| 103 | : absl::nullopt); |
| 104 | } |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 105 | if (++frame_counter_ == no_frames_to_wait_for_) |
| 106 | observation_complete_.Set(); |
| 107 | } |
| 108 | |
| 109 | void OnFrameGeneratorCapturerCreated( |
| 110 | test::FrameGeneratorCapturer* frame_generator_capturer) override { |
| 111 | frame_generator_capturer->SetFakeRotation(expected_rotation_); |
Johannes Kron | f7f13e0 | 2018-12-12 10:17:43 | [diff] [blame] | 112 | frame_generator_capturer->SetFakeColorSpace(expected_color_space_); |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | private: |
| 116 | int no_frames_to_wait_for_; |
| 117 | VideoRotation expected_rotation_; |
Johannes Kron | f7f13e0 | 2018-12-12 10:17:43 | [diff] [blame] | 118 | absl::optional<ColorSpace> expected_color_space_; |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 119 | std::string payload_name_; |
Niels Möller | 4db138e | 2018-04-19 07:04:13 | [diff] [blame] | 120 | VideoEncoderFactory* encoder_factory_; |
Niels Möller | cbcbc22 | 2018-09-28 07:07:24 | [diff] [blame] | 121 | VideoDecoderFactory* decoder_factory_; |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 122 | int frame_counter_; |
| 123 | }; |
| 124 | |
Danil Chapovalov | 636865e | 2020-06-03 12:11:26 | [diff] [blame] | 125 | TEST_F(CodecEndToEndTest, SendsAndReceivesVP8) { |
Niels Möller | 4db138e | 2018-04-19 07:04:13 | [diff] [blame] | 126 | test::FunctionVideoEncoderFactory encoder_factory( |
| 127 | []() { return VP8Encoder::Create(); }); |
Niels Möller | cbcbc22 | 2018-09-28 07:07:24 | [diff] [blame] | 128 | test::FunctionVideoDecoderFactory decoder_factory( |
| 129 | []() { return VP8Decoder::Create(); }); |
Johannes Kron | f7f13e0 | 2018-12-12 10:17:43 | [diff] [blame] | 130 | CodecObserver test(5, kVideoRotation_0, absl::nullopt, "VP8", |
| 131 | &encoder_factory, &decoder_factory); |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 132 | RunBaseTest(&test); |
| 133 | } |
| 134 | |
Danil Chapovalov | 636865e | 2020-06-03 12:11:26 | [diff] [blame] | 135 | TEST_F(CodecEndToEndTest, SendsAndReceivesVP8Rotation90) { |
Niels Möller | 4db138e | 2018-04-19 07:04:13 | [diff] [blame] | 136 | test::FunctionVideoEncoderFactory encoder_factory( |
| 137 | []() { return VP8Encoder::Create(); }); |
Niels Möller | cbcbc22 | 2018-09-28 07:07:24 | [diff] [blame] | 138 | test::FunctionVideoDecoderFactory decoder_factory( |
| 139 | []() { return VP8Decoder::Create(); }); |
Johannes Kron | f7f13e0 | 2018-12-12 10:17:43 | [diff] [blame] | 140 | CodecObserver test(5, kVideoRotation_90, absl::nullopt, "VP8", |
| 141 | &encoder_factory, &decoder_factory); |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 142 | RunBaseTest(&test); |
| 143 | } |
| 144 | |
Mirko Bonadei | 8ef5793 | 2018-11-16 13:38:03 | [diff] [blame] | 145 | #if defined(RTC_ENABLE_VP9) |
Danil Chapovalov | 636865e | 2020-06-03 12:11:26 | [diff] [blame] | 146 | TEST_F(CodecEndToEndTest, SendsAndReceivesVP9) { |
Niels Möller | 4db138e | 2018-04-19 07:04:13 | [diff] [blame] | 147 | test::FunctionVideoEncoderFactory encoder_factory( |
| 148 | []() { return VP9Encoder::Create(); }); |
Niels Möller | cbcbc22 | 2018-09-28 07:07:24 | [diff] [blame] | 149 | test::FunctionVideoDecoderFactory decoder_factory( |
| 150 | []() { return VP9Decoder::Create(); }); |
Johannes Kron | f7f13e0 | 2018-12-12 10:17:43 | [diff] [blame] | 151 | CodecObserver test(500, kVideoRotation_0, absl::nullopt, "VP9", |
| 152 | &encoder_factory, &decoder_factory); |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 153 | RunBaseTest(&test); |
| 154 | } |
| 155 | |
Danil Chapovalov | 636865e | 2020-06-03 12:11:26 | [diff] [blame] | 156 | TEST_F(CodecEndToEndTest, SendsAndReceivesVP9VideoRotation90) { |
Niels Möller | 4db138e | 2018-04-19 07:04:13 | [diff] [blame] | 157 | test::FunctionVideoEncoderFactory encoder_factory( |
| 158 | []() { return VP9Encoder::Create(); }); |
Niels Möller | cbcbc22 | 2018-09-28 07:07:24 | [diff] [blame] | 159 | test::FunctionVideoDecoderFactory decoder_factory( |
| 160 | []() { return VP9Decoder::Create(); }); |
Johannes Kron | f7f13e0 | 2018-12-12 10:17:43 | [diff] [blame] | 161 | CodecObserver test(5, kVideoRotation_90, absl::nullopt, "VP9", |
| 162 | &encoder_factory, &decoder_factory); |
| 163 | RunBaseTest(&test); |
| 164 | } |
| 165 | |
Danil Chapovalov | 636865e | 2020-06-03 12:11:26 | [diff] [blame] | 166 | TEST_F(CodecEndToEndTest, SendsAndReceivesVP9ExplicitColorSpace) { |
Johannes Kron | f7f13e0 | 2018-12-12 10:17:43 | [diff] [blame] | 167 | test::FunctionVideoEncoderFactory encoder_factory( |
| 168 | []() { return VP9Encoder::Create(); }); |
| 169 | test::FunctionVideoDecoderFactory decoder_factory( |
| 170 | []() { return VP9Decoder::Create(); }); |
| 171 | CodecObserver test(5, kVideoRotation_90, |
| 172 | CreateTestColorSpace(/*with_hdr_metadata=*/false), "VP9", |
| 173 | &encoder_factory, &decoder_factory); |
| 174 | RunBaseTest(&test); |
| 175 | } |
| 176 | |
Danil Chapovalov | 636865e | 2020-06-03 12:11:26 | [diff] [blame] | 177 | TEST_F(CodecEndToEndTest, |
Johannes Kron | f7f13e0 | 2018-12-12 10:17:43 | [diff] [blame] | 178 | SendsAndReceivesVP9ExplicitColorSpaceWithHdrMetadata) { |
| 179 | test::FunctionVideoEncoderFactory encoder_factory( |
| 180 | []() { return VP9Encoder::Create(); }); |
| 181 | test::FunctionVideoDecoderFactory decoder_factory( |
| 182 | []() { return VP9Decoder::Create(); }); |
| 183 | CodecObserver test(5, kVideoRotation_90, |
| 184 | CreateTestColorSpace(/*with_hdr_metadata=*/true), "VP9", |
| 185 | &encoder_factory, &decoder_factory); |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 186 | RunBaseTest(&test); |
| 187 | } |
Emircan Uysaler | ef76e5a | 2018-02-12 21:36:41 | [diff] [blame] | 188 | |
| 189 | // Mutiplex tests are using VP9 as the underlying implementation. |
Danil Chapovalov | 636865e | 2020-06-03 12:11:26 | [diff] [blame] | 190 | TEST_F(CodecEndToEndTest, SendsAndReceivesMultiplex) { |
Niels Möller | 4db138e | 2018-04-19 07:04:13 | [diff] [blame] | 191 | InternalEncoderFactory internal_encoder_factory; |
Niels Möller | cbcbc22 | 2018-09-28 07:07:24 | [diff] [blame] | 192 | InternalDecoderFactory internal_decoder_factory; |
Niels Möller | 4db138e | 2018-04-19 07:04:13 | [diff] [blame] | 193 | test::FunctionVideoEncoderFactory encoder_factory( |
| 194 | [&internal_encoder_factory]() { |
Mirko Bonadei | 317a1f0 | 2019-09-17 15:06:18 | [diff] [blame] | 195 | return std::make_unique<MultiplexEncoderAdapter>( |
Niels Möller | 4db138e | 2018-04-19 07:04:13 | [diff] [blame] | 196 | &internal_encoder_factory, SdpVideoFormat(cricket::kVp9CodecName)); |
| 197 | }); |
Niels Möller | cbcbc22 | 2018-09-28 07:07:24 | [diff] [blame] | 198 | test::FunctionVideoDecoderFactory decoder_factory( |
| 199 | [&internal_decoder_factory]() { |
Mirko Bonadei | 317a1f0 | 2019-09-17 15:06:18 | [diff] [blame] | 200 | return std::make_unique<MultiplexDecoderAdapter>( |
Niels Möller | cbcbc22 | 2018-09-28 07:07:24 | [diff] [blame] | 201 | &internal_decoder_factory, SdpVideoFormat(cricket::kVp9CodecName)); |
| 202 | }); |
| 203 | |
Johannes Kron | f7f13e0 | 2018-12-12 10:17:43 | [diff] [blame] | 204 | CodecObserver test(5, kVideoRotation_0, absl::nullopt, "multiplex", |
| 205 | &encoder_factory, &decoder_factory); |
Emircan Uysaler | ef76e5a | 2018-02-12 21:36:41 | [diff] [blame] | 206 | RunBaseTest(&test); |
| 207 | } |
| 208 | |
Danil Chapovalov | 636865e | 2020-06-03 12:11:26 | [diff] [blame] | 209 | TEST_F(CodecEndToEndTest, SendsAndReceivesMultiplexVideoRotation90) { |
Niels Möller | 4db138e | 2018-04-19 07:04:13 | [diff] [blame] | 210 | InternalEncoderFactory internal_encoder_factory; |
Niels Möller | cbcbc22 | 2018-09-28 07:07:24 | [diff] [blame] | 211 | InternalDecoderFactory internal_decoder_factory; |
Niels Möller | 4db138e | 2018-04-19 07:04:13 | [diff] [blame] | 212 | test::FunctionVideoEncoderFactory encoder_factory( |
| 213 | [&internal_encoder_factory]() { |
Mirko Bonadei | 317a1f0 | 2019-09-17 15:06:18 | [diff] [blame] | 214 | return std::make_unique<MultiplexEncoderAdapter>( |
Niels Möller | 4db138e | 2018-04-19 07:04:13 | [diff] [blame] | 215 | &internal_encoder_factory, SdpVideoFormat(cricket::kVp9CodecName)); |
| 216 | }); |
Niels Möller | cbcbc22 | 2018-09-28 07:07:24 | [diff] [blame] | 217 | test::FunctionVideoDecoderFactory decoder_factory( |
| 218 | [&internal_decoder_factory]() { |
Mirko Bonadei | 317a1f0 | 2019-09-17 15:06:18 | [diff] [blame] | 219 | return std::make_unique<MultiplexDecoderAdapter>( |
Niels Möller | cbcbc22 | 2018-09-28 07:07:24 | [diff] [blame] | 220 | &internal_decoder_factory, SdpVideoFormat(cricket::kVp9CodecName)); |
| 221 | }); |
Johannes Kron | f7f13e0 | 2018-12-12 10:17:43 | [diff] [blame] | 222 | CodecObserver test(5, kVideoRotation_90, absl::nullopt, "multiplex", |
| 223 | &encoder_factory, &decoder_factory); |
Emircan Uysaler | ef76e5a | 2018-02-12 21:36:41 | [diff] [blame] | 224 | RunBaseTest(&test); |
| 225 | } |
| 226 | |
Mirko Bonadei | 8ef5793 | 2018-11-16 13:38:03 | [diff] [blame] | 227 | #endif // defined(RTC_ENABLE_VP9) |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 228 | |
| 229 | #if defined(WEBRTC_USE_H264) |
Ilya Nikolaevskiy | cb96062 | 2018-09-04 09:07:31 | [diff] [blame] | 230 | class EndToEndTestH264 : public test::CallTest, |
Mirko Bonadei | 6a489f2 | 2019-04-09 13:11:12 | [diff] [blame] | 231 | public ::testing::WithParamInterface<std::string> { |
Ilya Nikolaevskiy | cb96062 | 2018-09-04 09:07:31 | [diff] [blame] | 232 | public: |
Erik Språng | eb3307f | 2022-08-22 09:06:06 | [diff] [blame] | 233 | EndToEndTestH264() : field_trial_(GetParam()) { |
Elad Alon | d8d3248 | 2019-02-18 22:45:57 | [diff] [blame] | 234 | RegisterRtpExtension(RtpExtension(RtpExtension::kVideoRotationUri, |
| 235 | kVideoRotationExtensionId)); |
| 236 | } |
Erik Språng | eb3307f | 2022-08-22 09:06:06 | [diff] [blame] | 237 | |
| 238 | private: |
| 239 | test::ScopedFieldTrials field_trial_; |
Ilya Nikolaevskiy | cb96062 | 2018-09-04 09:07:31 | [diff] [blame] | 240 | }; |
| 241 | |
Erik Språng | eb3307f | 2022-08-22 09:06:06 | [diff] [blame] | 242 | INSTANTIATE_TEST_SUITE_P( |
| 243 | SpsPpsIdrIsKeyframe, |
| 244 | EndToEndTestH264, |
| 245 | ::testing::Values("WebRTC-SpsPpsIdrIsH264Keyframe/Disabled/", |
| 246 | "WebRTC-SpsPpsIdrIsH264Keyframe/Enabled/")); |
| 247 | |
| 248 | TEST_P(EndToEndTestH264, SendsAndReceivesH264) { |
Niels Möller | 4db138e | 2018-04-19 07:04:13 | [diff] [blame] | 249 | test::FunctionVideoEncoderFactory encoder_factory( |
Florent Castelli | 5278b39 | 2023-05-31 12:44:32 | [diff] [blame] | 250 | []() { return H264Encoder::Create(); }); |
Niels Möller | cbcbc22 | 2018-09-28 07:07:24 | [diff] [blame] | 251 | test::FunctionVideoDecoderFactory decoder_factory( |
| 252 | []() { return H264Decoder::Create(); }); |
Johannes Kron | f7f13e0 | 2018-12-12 10:17:43 | [diff] [blame] | 253 | CodecObserver test(500, kVideoRotation_0, absl::nullopt, "H264", |
| 254 | &encoder_factory, &decoder_factory); |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 255 | RunBaseTest(&test); |
| 256 | } |
| 257 | |
Erik Språng | eb3307f | 2022-08-22 09:06:06 | [diff] [blame] | 258 | TEST_P(EndToEndTestH264, SendsAndReceivesH264VideoRotation90) { |
Niels Möller | 4db138e | 2018-04-19 07:04:13 | [diff] [blame] | 259 | test::FunctionVideoEncoderFactory encoder_factory( |
Florent Castelli | 5278b39 | 2023-05-31 12:44:32 | [diff] [blame] | 260 | []() { return H264Encoder::Create(); }); |
Niels Möller | cbcbc22 | 2018-09-28 07:07:24 | [diff] [blame] | 261 | test::FunctionVideoDecoderFactory decoder_factory( |
| 262 | []() { return H264Decoder::Create(); }); |
Johannes Kron | f7f13e0 | 2018-12-12 10:17:43 | [diff] [blame] | 263 | CodecObserver test(5, kVideoRotation_90, absl::nullopt, "H264", |
| 264 | &encoder_factory, &decoder_factory); |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 265 | RunBaseTest(&test); |
| 266 | } |
| 267 | |
Erik Språng | eb3307f | 2022-08-22 09:06:06 | [diff] [blame] | 268 | TEST_P(EndToEndTestH264, SendsAndReceivesH264PacketizationMode0) { |
Florent Castelli | 5278b39 | 2023-05-31 12:44:32 | [diff] [blame] | 269 | cricket::VideoCodec codec = |
| 270 | cricket::CreateVideoCodec(cricket::kH264CodecName); |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 271 | codec.SetParam(cricket::kH264FmtpPacketizationMode, "0"); |
Niels Möller | 4db138e | 2018-04-19 07:04:13 | [diff] [blame] | 272 | test::FunctionVideoEncoderFactory encoder_factory( |
| 273 | [codec]() { return H264Encoder::Create(codec); }); |
Niels Möller | cbcbc22 | 2018-09-28 07:07:24 | [diff] [blame] | 274 | test::FunctionVideoDecoderFactory decoder_factory( |
| 275 | []() { return H264Decoder::Create(); }); |
Johannes Kron | f7f13e0 | 2018-12-12 10:17:43 | [diff] [blame] | 276 | CodecObserver test(500, kVideoRotation_0, absl::nullopt, "H264", |
| 277 | &encoder_factory, &decoder_factory); |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 278 | RunBaseTest(&test); |
| 279 | } |
| 280 | |
Erik Språng | eb3307f | 2022-08-22 09:06:06 | [diff] [blame] | 281 | TEST_P(EndToEndTestH264, SendsAndReceivesH264PacketizationMode1) { |
Florent Castelli | 5278b39 | 2023-05-31 12:44:32 | [diff] [blame] | 282 | cricket::VideoCodec codec = |
| 283 | cricket::CreateVideoCodec(cricket::kH264CodecName); |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 284 | codec.SetParam(cricket::kH264FmtpPacketizationMode, "1"); |
Niels Möller | 4db138e | 2018-04-19 07:04:13 | [diff] [blame] | 285 | test::FunctionVideoEncoderFactory encoder_factory( |
| 286 | [codec]() { return H264Encoder::Create(codec); }); |
Niels Möller | cbcbc22 | 2018-09-28 07:07:24 | [diff] [blame] | 287 | test::FunctionVideoDecoderFactory decoder_factory( |
| 288 | []() { return H264Decoder::Create(); }); |
Johannes Kron | f7f13e0 | 2018-12-12 10:17:43 | [diff] [blame] | 289 | CodecObserver test(500, kVideoRotation_0, absl::nullopt, "H264", |
| 290 | &encoder_factory, &decoder_factory); |
Sebastian Jansson | c501713 | 2018-02-02 15:24:16 | [diff] [blame] | 291 | RunBaseTest(&test); |
| 292 | } |
| 293 | #endif // defined(WEBRTC_USE_H264) |
| 294 | |
| 295 | } // namespace webrtc |