pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2014 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 | |
| 11 | #include <stdio.h> |
| 12 | |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 13 | #include <fstream> |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 14 | #include <map> |
kwiberg | 27f982b | 2016-03-01 11:52:33 -0800 | [diff] [blame] | 15 | #include <memory> |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 16 | |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 17 | #include "absl/flags/flag.h" |
| 18 | #include "absl/flags/parse.h" |
Danil Chapovalov | 83bbe91 | 2019-08-07 12:24:53 +0200 | [diff] [blame] | 19 | #include "api/rtc_event_log/rtc_event_log.h" |
Sergey Silkin | 626f7ff | 2019-09-12 10:51:19 +0200 | [diff] [blame] | 20 | #include "api/task_queue/default_task_queue_factory.h" |
Danil Chapovalov | 99b71df | 2018-10-26 15:57:48 +0200 | [diff] [blame] | 21 | #include "api/test/video/function_video_decoder_factory.h" |
Ilya Nikolaevskiy | 33aaa35 | 2020-01-21 13:38:19 +0100 | [diff] [blame] | 22 | #include "api/transport/field_trial_based_config.h" |
Philipp Hancke | fae4fb1 | 2021-01-26 18:05:56 +0100 | [diff] [blame] | 23 | #include "api/video/video_codec_type.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 24 | #include "api/video_codecs/video_decoder.h" |
| 25 | #include "call/call.h" |
| 26 | #include "common_video/libyuv/include/webrtc_libyuv.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 27 | #include "media/engine/internal_decoder_factory.h" |
Danil Chapovalov | 76a35d9 | 2021-06-08 12:30:46 +0200 | [diff] [blame] | 28 | #include "modules/rtp_rtcp/source/rtp_packet.h" |
Philipp Hancke | fae4fb1 | 2021-01-26 18:05:56 +0100 | [diff] [blame] | 29 | #include "modules/video_coding/utility/ivf_file_writer.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 30 | #include "rtc_base/checks.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 31 | #include "rtc_base/string_to_number.h" |
Sam Zackrisson | b45bdb5 | 2018-10-02 16:25:59 +0200 | [diff] [blame] | 32 | #include "rtc_base/strings/json.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 33 | #include "rtc_base/time_utils.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 34 | #include "system_wrappers/include/clock.h" |
| 35 | #include "system_wrappers/include/sleep.h" |
Benjamin Wright | 8efafdf | 2019-01-11 10:48:42 -0800 | [diff] [blame] | 36 | #include "test/call_config_utils.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 37 | #include "test/call_test.h" |
| 38 | #include "test/encoder_settings.h" |
| 39 | #include "test/fake_decoder.h" |
| 40 | #include "test/gtest.h" |
| 41 | #include "test/null_transport.h" |
| 42 | #include "test/rtp_file_reader.h" |
| 43 | #include "test/run_loop.h" |
| 44 | #include "test/run_test.h" |
Sebastian Jansson | f1f363f | 2018-08-13 14:24:58 +0200 | [diff] [blame] | 45 | #include "test/test_video_capturer.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 46 | #include "test/testsupport/frame_writer.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 47 | #include "test/video_renderer.h" |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 48 | |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 49 | // Flag for payload type. |
| 50 | ABSL_FLAG(int, |
| 51 | media_payload_type, |
| 52 | webrtc::test::CallTest::kPayloadTypeVP8, |
| 53 | "Media payload type"); |
| 54 | |
| 55 | // Flag for RED payload type. |
| 56 | ABSL_FLAG(int, |
| 57 | red_payload_type, |
| 58 | webrtc::test::CallTest::kRedPayloadType, |
| 59 | "RED payload type"); |
| 60 | |
| 61 | // Flag for ULPFEC payload type. |
| 62 | ABSL_FLAG(int, |
| 63 | ulpfec_payload_type, |
| 64 | webrtc::test::CallTest::kUlpfecPayloadType, |
| 65 | "ULPFEC payload type"); |
| 66 | |
| 67 | ABSL_FLAG(int, |
| 68 | media_payload_type_rtx, |
| 69 | webrtc::test::CallTest::kSendRtxPayloadType, |
| 70 | "Media over RTX payload type"); |
| 71 | |
| 72 | ABSL_FLAG(int, |
| 73 | red_payload_type_rtx, |
| 74 | webrtc::test::CallTest::kRtxRedPayloadType, |
| 75 | "RED over RTX payload type"); |
| 76 | |
| 77 | // Flag for SSRC. |
| 78 | const std::string& DefaultSsrc() { |
| 79 | static const std::string ssrc = |
| 80 | std::to_string(webrtc::test::CallTest::kVideoSendSsrcs[0]); |
| 81 | return ssrc; |
| 82 | } |
| 83 | ABSL_FLAG(std::string, ssrc, DefaultSsrc().c_str(), "Incoming SSRC"); |
| 84 | |
| 85 | const std::string& DefaultSsrcRtx() { |
| 86 | static const std::string ssrc_rtx = |
| 87 | std::to_string(webrtc::test::CallTest::kSendRtxSsrcs[0]); |
| 88 | return ssrc_rtx; |
| 89 | } |
| 90 | ABSL_FLAG(std::string, ssrc_rtx, DefaultSsrcRtx().c_str(), "Incoming RTX SSRC"); |
| 91 | |
| 92 | // Flag for abs-send-time id. |
| 93 | ABSL_FLAG(int, abs_send_time_id, -1, "RTP extension ID for abs-send-time"); |
| 94 | |
| 95 | // Flag for transmission-offset id. |
| 96 | ABSL_FLAG(int, |
| 97 | transmission_offset_id, |
| 98 | -1, |
| 99 | "RTP extension ID for transmission-offset"); |
| 100 | |
| 101 | // Flag for rtpdump input file. |
| 102 | ABSL_FLAG(std::string, input_file, "", "input file"); |
| 103 | |
| 104 | ABSL_FLAG(std::string, config_file, "", "config file"); |
| 105 | |
| 106 | // Flag for raw output files. |
| 107 | ABSL_FLAG(std::string, |
| 108 | out_base, |
| 109 | "", |
| 110 | "Basename (excluding .jpg) for raw output"); |
| 111 | |
| 112 | ABSL_FLAG(std::string, |
| 113 | decoder_bitstream_filename, |
| 114 | "", |
| 115 | "Decoder bitstream output file"); |
| 116 | |
Philipp Hancke | fae4fb1 | 2021-01-26 18:05:56 +0100 | [diff] [blame] | 117 | ABSL_FLAG(std::string, decoder_ivf_filename, "", "Decoder ivf output file"); |
| 118 | |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 119 | // Flag for video codec. |
| 120 | ABSL_FLAG(std::string, codec, "VP8", "Video codec"); |
| 121 | |
Philipp Hancke | f3a687a | 2021-03-15 12:04:39 +0100 | [diff] [blame] | 122 | // Flags for rtp start and stop timestamp. |
| 123 | ABSL_FLAG(uint32_t, |
| 124 | start_timestamp, |
| 125 | 0, |
| 126 | "RTP start timestamp, packets with smaller timestamp will be ignored " |
| 127 | "(no wraparound)"); |
| 128 | ABSL_FLAG(uint32_t, |
| 129 | stop_timestamp, |
| 130 | 4294967295, |
| 131 | "RTP stop timestamp, packets with larger timestamp will be ignored " |
| 132 | "(no wraparound)"); |
| 133 | |
oprypin | 6e09d87 | 2017-08-31 03:21:39 -0700 | [diff] [blame] | 134 | namespace { |
| 135 | |
| 136 | static bool ValidatePayloadType(int32_t payload_type) { |
| 137 | return payload_type > 0 && payload_type <= 127; |
| 138 | } |
| 139 | |
| 140 | static bool ValidateSsrc(const char* ssrc_string) { |
| 141 | return rtc::StringToNumber<uint32_t>(ssrc_string).has_value(); |
| 142 | } |
| 143 | |
| 144 | static bool ValidateOptionalPayloadType(int32_t payload_type) { |
| 145 | return payload_type == -1 || ValidatePayloadType(payload_type); |
| 146 | } |
| 147 | |
| 148 | static bool ValidateRtpHeaderExtensionId(int32_t extension_id) { |
| 149 | return extension_id >= -1 && extension_id < 15; |
| 150 | } |
| 151 | |
| 152 | bool ValidateInputFilenameNotEmpty(const std::string& string) { |
| 153 | return !string.empty(); |
| 154 | } |
| 155 | |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 156 | static int MediaPayloadType() { |
| 157 | return absl::GetFlag(FLAGS_media_payload_type); |
| 158 | } |
| 159 | |
| 160 | static int RedPayloadType() { |
| 161 | return absl::GetFlag(FLAGS_red_payload_type); |
| 162 | } |
| 163 | |
| 164 | static int UlpfecPayloadType() { |
| 165 | return absl::GetFlag(FLAGS_ulpfec_payload_type); |
| 166 | } |
| 167 | |
| 168 | static int MediaPayloadTypeRtx() { |
| 169 | return absl::GetFlag(FLAGS_media_payload_type_rtx); |
| 170 | } |
| 171 | |
| 172 | static int RedPayloadTypeRtx() { |
| 173 | return absl::GetFlag(FLAGS_red_payload_type_rtx); |
| 174 | } |
| 175 | |
| 176 | static uint32_t Ssrc() { |
| 177 | return rtc::StringToNumber<uint32_t>(absl::GetFlag(FLAGS_ssrc)).value(); |
| 178 | } |
| 179 | |
| 180 | static uint32_t SsrcRtx() { |
| 181 | return rtc::StringToNumber<uint32_t>(absl::GetFlag(FLAGS_ssrc_rtx)).value(); |
| 182 | } |
| 183 | |
| 184 | static int AbsSendTimeId() { |
| 185 | return absl::GetFlag(FLAGS_abs_send_time_id); |
| 186 | } |
| 187 | |
| 188 | static int TransmissionOffsetId() { |
| 189 | return absl::GetFlag(FLAGS_transmission_offset_id); |
| 190 | } |
| 191 | |
| 192 | static std::string InputFile() { |
| 193 | return absl::GetFlag(FLAGS_input_file); |
| 194 | } |
| 195 | |
| 196 | static std::string ConfigFile() { |
| 197 | return absl::GetFlag(FLAGS_config_file); |
| 198 | } |
| 199 | |
| 200 | static std::string OutBase() { |
| 201 | return absl::GetFlag(FLAGS_out_base); |
| 202 | } |
| 203 | |
| 204 | static std::string DecoderBitstreamFilename() { |
| 205 | return absl::GetFlag(FLAGS_decoder_bitstream_filename); |
| 206 | } |
| 207 | |
Philipp Hancke | fae4fb1 | 2021-01-26 18:05:56 +0100 | [diff] [blame] | 208 | static std::string IVFFilename() { |
| 209 | return absl::GetFlag(FLAGS_decoder_ivf_filename); |
| 210 | } |
| 211 | |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 212 | static std::string Codec() { |
| 213 | return absl::GetFlag(FLAGS_codec); |
| 214 | } |
| 215 | |
oprypin | 6e09d87 | 2017-08-31 03:21:39 -0700 | [diff] [blame] | 216 | } // namespace |
| 217 | |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 218 | namespace webrtc { |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 219 | |
| 220 | static const uint32_t kReceiverLocalSsrc = 0x123456; |
| 221 | |
nisse | 7ade7b3 | 2016-03-23 04:48:10 -0700 | [diff] [blame] | 222 | class FileRenderPassthrough : public rtc::VideoSinkInterface<VideoFrame> { |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 223 | public: |
nisse | 7ade7b3 | 2016-03-23 04:48:10 -0700 | [diff] [blame] | 224 | FileRenderPassthrough(const std::string& basename, |
| 225 | rtc::VideoSinkInterface<VideoFrame>* renderer) |
philipel | 99b6345 | 2017-08-25 07:24:21 -0700 | [diff] [blame] | 226 | : basename_(basename), renderer_(renderer), file_(nullptr), count_(0) {} |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 227 | |
Mirko Bonadei | fe055c1 | 2019-01-29 22:53:28 +0100 | [diff] [blame] | 228 | ~FileRenderPassthrough() override { |
Peter Boström | 74f6e9e | 2016-04-04 17:56:10 +0200 | [diff] [blame] | 229 | if (file_) |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 230 | fclose(file_); |
| 231 | } |
| 232 | |
| 233 | private: |
nisse | eb83a1a | 2016-03-21 01:27:56 -0700 | [diff] [blame] | 234 | void OnFrame(const VideoFrame& video_frame) override { |
Peter Boström | 74f6e9e | 2016-04-04 17:56:10 +0200 | [diff] [blame] | 235 | if (renderer_) |
nisse | eb83a1a | 2016-03-21 01:27:56 -0700 | [diff] [blame] | 236 | renderer_->OnFrame(video_frame); |
philipel | 99b6345 | 2017-08-25 07:24:21 -0700 | [diff] [blame] | 237 | |
pbos | bb36fdf | 2015-07-09 07:48:14 -0700 | [diff] [blame] | 238 | if (basename_.empty()) |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 239 | return; |
philipel | 99b6345 | 2017-08-25 07:24:21 -0700 | [diff] [blame] | 240 | |
| 241 | std::stringstream filename; |
| 242 | filename << basename_ << count_++ << "_" << video_frame.timestamp() |
| 243 | << ".jpg"; |
| 244 | |
philipel | 99b6345 | 2017-08-25 07:24:21 -0700 | [diff] [blame] | 245 | test::JpegFrameWriter frame_writer(filename.str()); |
| 246 | RTC_CHECK(frame_writer.WriteFrame(video_frame, 100)); |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 247 | } |
| 248 | |
| 249 | const std::string basename_; |
nisse | 7ade7b3 | 2016-03-23 04:48:10 -0700 | [diff] [blame] | 250 | rtc::VideoSinkInterface<VideoFrame>* const renderer_; |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 251 | FILE* file_; |
| 252 | size_t count_; |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 253 | }; |
| 254 | |
Niels Möller | f88a22c | 2018-06-19 17:05:03 +0200 | [diff] [blame] | 255 | class DecoderBitstreamFileWriter : public test::FakeDecoder { |
stefan@webrtc.org | 48ac226 | 2015-03-02 16:18:56 +0000 | [diff] [blame] | 256 | public: |
| 257 | explicit DecoderBitstreamFileWriter(const char* filename) |
| 258 | : file_(fopen(filename, "wb")) { |
Peter Boström | 74f6e9e | 2016-04-04 17:56:10 +0200 | [diff] [blame] | 259 | RTC_DCHECK(file_); |
stefan@webrtc.org | 48ac226 | 2015-03-02 16:18:56 +0000 | [diff] [blame] | 260 | } |
Mirko Bonadei | fe055c1 | 2019-01-29 22:53:28 +0100 | [diff] [blame] | 261 | ~DecoderBitstreamFileWriter() override { fclose(file_); } |
stefan@webrtc.org | 48ac226 | 2015-03-02 16:18:56 +0000 | [diff] [blame] | 262 | |
Niels Möller | f88a22c | 2018-06-19 17:05:03 +0200 | [diff] [blame] | 263 | int32_t Decode(const EncodedImage& encoded_frame, |
Benjamin Wright | 8efafdf | 2019-01-11 10:48:42 -0800 | [diff] [blame] | 264 | bool /* missing_frames */, |
Benjamin Wright | 8efafdf | 2019-01-11 10:48:42 -0800 | [diff] [blame] | 265 | int64_t /* render_time_ms */) override { |
Niels Möller | 77536a2 | 2019-01-15 08:50:01 +0100 | [diff] [blame] | 266 | if (fwrite(encoded_frame.data(), 1, encoded_frame.size(), file_) < |
| 267 | encoded_frame.size()) { |
Niels Möller | f88a22c | 2018-06-19 17:05:03 +0200 | [diff] [blame] | 268 | RTC_LOG_ERR(LS_ERROR) << "fwrite of encoded frame failed."; |
| 269 | return WEBRTC_VIDEO_CODEC_ERROR; |
| 270 | } |
| 271 | return WEBRTC_VIDEO_CODEC_OK; |
stefan@webrtc.org | 48ac226 | 2015-03-02 16:18:56 +0000 | [diff] [blame] | 272 | } |
| 273 | |
| 274 | private: |
| 275 | FILE* file_; |
| 276 | }; |
| 277 | |
Philipp Hancke | fae4fb1 | 2021-01-26 18:05:56 +0100 | [diff] [blame] | 278 | class DecoderIvfFileWriter : public test::FakeDecoder { |
| 279 | public: |
| 280 | explicit DecoderIvfFileWriter(const char* filename, const std::string& codec) |
| 281 | : file_writer_( |
| 282 | IvfFileWriter::Wrap(FileWrapper::OpenWriteOnly(filename), 0)) { |
| 283 | RTC_DCHECK(file_writer_.get()); |
| 284 | if (codec == "VP8") { |
| 285 | video_codec_type_ = VideoCodecType::kVideoCodecVP8; |
| 286 | } else if (codec == "VP9") { |
| 287 | video_codec_type_ = VideoCodecType::kVideoCodecVP9; |
| 288 | } else if (codec == "H264") { |
| 289 | video_codec_type_ = VideoCodecType::kVideoCodecH264; |
| 290 | } else { |
| 291 | RTC_LOG(LS_ERROR) << "Unsupported video codec " << codec; |
| 292 | RTC_DCHECK(false); |
| 293 | } |
| 294 | } |
| 295 | ~DecoderIvfFileWriter() override { file_writer_->Close(); } |
| 296 | |
| 297 | int32_t Decode(const EncodedImage& encoded_frame, |
| 298 | bool /* missing_frames */, |
| 299 | int64_t render_time_ms) override { |
| 300 | if (!file_writer_->WriteFrame(encoded_frame, video_codec_type_)) { |
| 301 | return WEBRTC_VIDEO_CODEC_ERROR; |
| 302 | } |
| 303 | return WEBRTC_VIDEO_CODEC_OK; |
| 304 | } |
| 305 | |
| 306 | private: |
| 307 | std::unique_ptr<IvfFileWriter> file_writer_; |
| 308 | VideoCodecType video_codec_type_; |
| 309 | }; |
| 310 | |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 311 | // The RtpReplayer is responsible for parsing the configuration provided by the |
| 312 | // user, setting up the windows, recieve streams and decoders and then replaying |
| 313 | // the provided RTP dump. |
| 314 | class RtpReplayer final { |
| 315 | public: |
| 316 | // Replay a rtp dump with an optional json configuration. |
| 317 | static void Replay(const std::string& replay_config_path, |
| 318 | const std::string& rtp_dump_path) { |
Sergey Silkin | 626f7ff | 2019-09-12 10:51:19 +0200 | [diff] [blame] | 319 | std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory = |
| 320 | webrtc::CreateDefaultTaskQueueFactory(); |
Ilya Nikolaevskiy | 6a64690 | 2020-12-11 11:07:01 +0100 | [diff] [blame] | 321 | auto worker_thread = task_queue_factory->CreateTaskQueue( |
| 322 | "worker_thread", TaskQueueFactory::Priority::NORMAL); |
| 323 | rtc::Event sync_event(/*manual_reset=*/false, |
| 324 | /*initially_signalled=*/false); |
Danil Chapovalov | 83bbe91 | 2019-08-07 12:24:53 +0200 | [diff] [blame] | 325 | webrtc::RtcEventLogNull event_log; |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 326 | Call::Config call_config(&event_log); |
Sergey Silkin | 626f7ff | 2019-09-12 10:51:19 +0200 | [diff] [blame] | 327 | call_config.task_queue_factory = task_queue_factory.get(); |
Ilya Nikolaevskiy | 33aaa35 | 2020-01-21 13:38:19 +0100 | [diff] [blame] | 328 | call_config.trials = new FieldTrialBasedConfig(); |
Ilya Nikolaevskiy | 6a64690 | 2020-12-11 11:07:01 +0100 | [diff] [blame] | 329 | std::unique_ptr<Call> call; |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 330 | std::unique_ptr<StreamState> stream_state; |
Ilya Nikolaevskiy | 6a64690 | 2020-12-11 11:07:01 +0100 | [diff] [blame] | 331 | |
| 332 | // Creation of the streams must happen inside a task queue because it is |
| 333 | // resued as a worker thread. |
| 334 | worker_thread->PostTask(ToQueuedTask([&]() { |
| 335 | call.reset(Call::Create(call_config)); |
| 336 | |
| 337 | // Attempt to load the configuration |
| 338 | if (replay_config_path.empty()) { |
| 339 | stream_state = ConfigureFromFlags(rtp_dump_path, call.get()); |
| 340 | } else { |
| 341 | stream_state = ConfigureFromFile(replay_config_path, call.get()); |
| 342 | } |
| 343 | |
| 344 | if (stream_state == nullptr) { |
| 345 | return; |
| 346 | } |
| 347 | // Start replaying the provided stream now that it has been configured. |
| 348 | // VideoReceiveStreams must be started on the same thread as they were |
| 349 | // created on. |
| 350 | for (const auto& receive_stream : stream_state->receive_streams) { |
| 351 | receive_stream->Start(); |
| 352 | } |
| 353 | sync_event.Set(); |
| 354 | })); |
| 355 | |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 356 | // Attempt to create an RtpReader from the input file. |
| 357 | std::unique_ptr<test::RtpFileReader> rtp_reader = |
| 358 | CreateRtpReader(rtp_dump_path); |
Ilya Nikolaevskiy | 6a64690 | 2020-12-11 11:07:01 +0100 | [diff] [blame] | 359 | |
| 360 | // Wait for streams creation. |
| 361 | sync_event.Wait(/*give_up_after_ms=*/10000); |
| 362 | |
| 363 | if (stream_state == nullptr || rtp_reader == nullptr) { |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 364 | return; |
| 365 | } |
Ilya Nikolaevskiy | 6a64690 | 2020-12-11 11:07:01 +0100 | [diff] [blame] | 366 | |
| 367 | ReplayPackets(call.get(), rtp_reader.get(), worker_thread.get()); |
| 368 | |
| 369 | // Destruction of streams and the call must happen on the same thread as |
| 370 | // their creation. |
| 371 | worker_thread->PostTask(ToQueuedTask([&]() { |
| 372 | for (const auto& receive_stream : stream_state->receive_streams) { |
| 373 | call->DestroyVideoReceiveStream(receive_stream); |
| 374 | } |
| 375 | call.reset(); |
| 376 | sync_event.Set(); |
| 377 | })); |
| 378 | sync_event.Wait(/*give_up_after_ms=*/10000); |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 379 | } |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 380 | |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 381 | private: |
| 382 | // Holds all the shared memory structures required for a recieve stream. This |
| 383 | // structure is used to prevent members being deallocated before the replay |
| 384 | // has been finished. |
| 385 | struct StreamState { |
| 386 | test::NullTransport transport; |
| 387 | std::vector<std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>>> sinks; |
| 388 | std::vector<VideoReceiveStream*> receive_streams; |
Niels Möller | cbcbc22 | 2018-09-28 09:07:24 +0200 | [diff] [blame] | 389 | std::unique_ptr<VideoDecoderFactory> decoder_factory; |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 390 | }; |
| 391 | |
| 392 | // Loads multiple configurations from the provided configuration file. |
| 393 | static std::unique_ptr<StreamState> ConfigureFromFile( |
| 394 | const std::string& config_path, |
| 395 | Call* call) { |
Mirko Bonadei | 317a1f0 | 2019-09-17 17:06:18 +0200 | [diff] [blame] | 396 | auto stream_state = std::make_unique<StreamState>(); |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 397 | // Parse the configuration file. |
| 398 | std::ifstream config_file(config_path); |
| 399 | std::stringstream raw_json_buffer; |
| 400 | raw_json_buffer << config_file.rdbuf(); |
| 401 | std::string raw_json = raw_json_buffer.str(); |
Mirko Bonadei | e99f687 | 2021-06-24 15:24:59 +0200 | [diff] [blame] | 402 | Json::CharReaderBuilder builder; |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 403 | Json::Value json_configs; |
Mirko Bonadei | e99f687 | 2021-06-24 15:24:59 +0200 | [diff] [blame] | 404 | std::string error_message; |
| 405 | std::unique_ptr<Json::CharReader> json_reader(builder.newCharReader()); |
| 406 | if (!json_reader->parse(raw_json.data(), raw_json.data() + raw_json.size(), |
| 407 | &json_configs, &error_message)) { |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 408 | fprintf(stderr, "Error parsing JSON config\n"); |
Mirko Bonadei | e99f687 | 2021-06-24 15:24:59 +0200 | [diff] [blame] | 409 | fprintf(stderr, "%s\n", error_message.c_str()); |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 410 | return nullptr; |
| 411 | } |
| 412 | |
Mirko Bonadei | 317a1f0 | 2019-09-17 17:06:18 +0200 | [diff] [blame] | 413 | stream_state->decoder_factory = std::make_unique<InternalDecoderFactory>(); |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 414 | size_t config_count = 0; |
| 415 | for (const auto& json : json_configs) { |
| 416 | // Create the configuration and parse the JSON into the config. |
Benjamin Wright | 8efafdf | 2019-01-11 10:48:42 -0800 | [diff] [blame] | 417 | auto receive_config = |
| 418 | ParseVideoReceiveStreamJsonConfig(&(stream_state->transport), json); |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 419 | // Instantiate the underlying decoder. |
| 420 | for (auto& decoder : receive_config.decoders) { |
Niels Möller | cbcbc22 | 2018-09-28 09:07:24 +0200 | [diff] [blame] | 421 | decoder = test::CreateMatchingDecoder(decoder.payload_type, |
| 422 | decoder.video_format.name); |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 423 | } |
| 424 | // Create a window for this config. |
| 425 | std::stringstream window_title; |
| 426 | window_title << "Playback Video (" << config_count++ << ")"; |
| 427 | stream_state->sinks.emplace_back( |
| 428 | test::VideoRenderer::Create(window_title.str().c_str(), 640, 480)); |
| 429 | // Create a receive stream for this config. |
| 430 | receive_config.renderer = stream_state->sinks.back().get(); |
Philip Eliasson | 2b068ce | 2020-08-03 15:55:10 +0000 | [diff] [blame] | 431 | receive_config.decoder_factory = stream_state->decoder_factory.get(); |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 432 | stream_state->receive_streams.emplace_back( |
| 433 | call->CreateVideoReceiveStream(std::move(receive_config))); |
| 434 | } |
| 435 | return stream_state; |
stefan@webrtc.org | 48ac226 | 2015-03-02 16:18:56 +0000 | [diff] [blame] | 436 | } |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 437 | |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 438 | // Loads the base configuration from flags passed in on the commandline. |
| 439 | static std::unique_ptr<StreamState> ConfigureFromFlags( |
| 440 | const std::string& rtp_dump_path, |
| 441 | Call* call) { |
Mirko Bonadei | 317a1f0 | 2019-09-17 17:06:18 +0200 | [diff] [blame] | 442 | auto stream_state = std::make_unique<StreamState>(); |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 443 | // Create the video renderers. We must add both to the stream state to keep |
| 444 | // them from deallocating. |
| 445 | std::stringstream window_title; |
| 446 | window_title << "Playback Video (" << rtp_dump_path << ")"; |
| 447 | std::unique_ptr<test::VideoRenderer> playback_video( |
| 448 | test::VideoRenderer::Create(window_title.str().c_str(), 640, 480)); |
Mirko Bonadei | 317a1f0 | 2019-09-17 17:06:18 +0200 | [diff] [blame] | 449 | auto file_passthrough = std::make_unique<FileRenderPassthrough>( |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 450 | OutBase(), playback_video.get()); |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 451 | stream_state->sinks.push_back(std::move(playback_video)); |
| 452 | stream_state->sinks.push_back(std::move(file_passthrough)); |
| 453 | // Setup the configuration from the flags. |
| 454 | VideoReceiveStream::Config receive_config(&(stream_state->transport)); |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 455 | receive_config.rtp.remote_ssrc = Ssrc(); |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 456 | receive_config.rtp.local_ssrc = kReceiverLocalSsrc; |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 457 | receive_config.rtp.rtx_ssrc = SsrcRtx(); |
| 458 | receive_config.rtp.rtx_associated_payload_types[MediaPayloadTypeRtx()] = |
| 459 | MediaPayloadType(); |
| 460 | receive_config.rtp.rtx_associated_payload_types[RedPayloadTypeRtx()] = |
| 461 | RedPayloadType(); |
| 462 | receive_config.rtp.ulpfec_payload_type = UlpfecPayloadType(); |
| 463 | receive_config.rtp.red_payload_type = RedPayloadType(); |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 464 | receive_config.rtp.nack.rtp_history_ms = 1000; |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 465 | if (TransmissionOffsetId() != -1) { |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 466 | receive_config.rtp.extensions.push_back(RtpExtension( |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 467 | RtpExtension::kTimestampOffsetUri, TransmissionOffsetId())); |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 468 | } |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 469 | if (AbsSendTimeId() != -1) { |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 470 | receive_config.rtp.extensions.push_back( |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 471 | RtpExtension(RtpExtension::kAbsSendTimeUri, AbsSendTimeId())); |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 472 | } |
| 473 | receive_config.renderer = stream_state->sinks.back().get(); |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 474 | |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 475 | // Setup the receiving stream |
| 476 | VideoReceiveStream::Decoder decoder; |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 477 | decoder = test::CreateMatchingDecoder(MediaPayloadType(), Codec()); |
Philipp Hancke | fae4fb1 | 2021-01-26 18:05:56 +0100 | [diff] [blame] | 478 | if (!DecoderBitstreamFilename().empty()) { |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 479 | // Replace decoder with file writer if we're writing the bitstream to a |
| 480 | // file instead. |
Niels Möller | cbcbc22 | 2018-09-28 09:07:24 +0200 | [diff] [blame] | 481 | stream_state->decoder_factory = |
Mirko Bonadei | 317a1f0 | 2019-09-17 17:06:18 +0200 | [diff] [blame] | 482 | std::make_unique<test::FunctionVideoDecoderFactory>([]() { |
| 483 | return std::make_unique<DecoderBitstreamFileWriter>( |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 484 | DecoderBitstreamFilename().c_str()); |
Niels Möller | cbcbc22 | 2018-09-28 09:07:24 +0200 | [diff] [blame] | 485 | }); |
Philipp Hancke | fae4fb1 | 2021-01-26 18:05:56 +0100 | [diff] [blame] | 486 | } else if (!IVFFilename().empty()) { |
| 487 | // Replace decoder with file writer if we're writing the ivf to a |
| 488 | // file instead. |
| 489 | stream_state->decoder_factory = |
| 490 | std::make_unique<test::FunctionVideoDecoderFactory>([]() { |
| 491 | return std::make_unique<DecoderIvfFileWriter>(IVFFilename().c_str(), |
| 492 | Codec()); |
| 493 | }); |
| 494 | } else { |
| 495 | stream_state->decoder_factory = |
| 496 | std::make_unique<InternalDecoderFactory>(); |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 497 | } |
Philip Eliasson | 2b068ce | 2020-08-03 15:55:10 +0000 | [diff] [blame] | 498 | receive_config.decoder_factory = stream_state->decoder_factory.get(); |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 499 | receive_config.decoders.push_back(decoder); |
| 500 | |
| 501 | stream_state->receive_streams.emplace_back( |
| 502 | call->CreateVideoReceiveStream(std::move(receive_config))); |
| 503 | return stream_state; |
| 504 | } |
| 505 | |
| 506 | static std::unique_ptr<test::RtpFileReader> CreateRtpReader( |
| 507 | const std::string& rtp_dump_path) { |
| 508 | std::unique_ptr<test::RtpFileReader> rtp_reader(test::RtpFileReader::Create( |
| 509 | test::RtpFileReader::kRtpDump, rtp_dump_path)); |
Peter Boström | 74f6e9e | 2016-04-04 17:56:10 +0200 | [diff] [blame] | 510 | if (!rtp_reader) { |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 511 | rtp_reader.reset(test::RtpFileReader::Create(test::RtpFileReader::kPcap, |
| 512 | rtp_dump_path)); |
Peter Boström | 74f6e9e | 2016-04-04 17:56:10 +0200 | [diff] [blame] | 513 | if (!rtp_reader) { |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 514 | fprintf( |
| 515 | stderr, |
| 516 | "Couldn't open input file as either a rtpdump or .pcap. Note " |
| 517 | "that .pcapng is not supported.\nTrying to interpret the file as " |
| 518 | "length/packet interleaved.\n"); |
| 519 | rtp_reader.reset(test::RtpFileReader::Create( |
| 520 | test::RtpFileReader::kLengthPacketInterleaved, rtp_dump_path)); |
| 521 | if (!rtp_reader) { |
| 522 | fprintf(stderr, |
| 523 | "Unable to open input file with any supported format\n"); |
| 524 | return nullptr; |
| 525 | } |
stefan@webrtc.org | 48ac226 | 2015-03-02 16:18:56 +0000 | [diff] [blame] | 526 | } |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 527 | } |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 528 | return rtp_reader; |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 529 | } |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 530 | |
Ilya Nikolaevskiy | 6a64690 | 2020-12-11 11:07:01 +0100 | [diff] [blame] | 531 | static void ReplayPackets(Call* call, |
| 532 | test::RtpFileReader* rtp_reader, |
| 533 | TaskQueueBase* worker_thread) { |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 534 | int64_t replay_start_ms = -1; |
| 535 | int num_packets = 0; |
| 536 | std::map<uint32_t, int> unknown_packets; |
Ilya Nikolaevskiy | 6a64690 | 2020-12-11 11:07:01 +0100 | [diff] [blame] | 537 | rtc::Event event(/*manual_reset=*/false, /*initially_signalled=*/false); |
Philipp Hancke | f3a687a | 2021-03-15 12:04:39 +0100 | [diff] [blame] | 538 | uint32_t start_timestamp = absl::GetFlag(FLAGS_start_timestamp); |
| 539 | uint32_t stop_timestamp = absl::GetFlag(FLAGS_stop_timestamp); |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 540 | while (true) { |
| 541 | int64_t now_ms = rtc::TimeMillis(); |
| 542 | if (replay_start_ms == -1) { |
| 543 | replay_start_ms = now_ms; |
| 544 | } |
philipel | 02f0396 | 2018-01-11 17:28:35 +0100 | [diff] [blame] | 545 | |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 546 | test::RtpPacket packet; |
| 547 | if (!rtp_reader->NextPacket(&packet)) { |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 548 | break; |
| 549 | } |
Danil Chapovalov | 76a35d9 | 2021-06-08 12:30:46 +0200 | [diff] [blame] | 550 | rtc::CopyOnWriteBuffer packet_buffer(packet.data, packet.length); |
| 551 | RtpPacket header; |
| 552 | header.Parse(packet_buffer); |
| 553 | if (header.Timestamp() < start_timestamp || |
| 554 | header.Timestamp() > stop_timestamp) { |
Philipp Hancke | f3a687a | 2021-03-15 12:04:39 +0100 | [diff] [blame] | 555 | continue; |
| 556 | } |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 557 | |
| 558 | int64_t deliver_in_ms = replay_start_ms + packet.time_ms - now_ms; |
| 559 | if (deliver_in_ms > 0) { |
| 560 | SleepMs(deliver_in_ms); |
| 561 | } |
| 562 | |
| 563 | ++num_packets; |
Ilya Nikolaevskiy | 6a64690 | 2020-12-11 11:07:01 +0100 | [diff] [blame] | 564 | PacketReceiver::DeliveryStatus result = PacketReceiver::DELIVERY_OK; |
| 565 | worker_thread->PostTask(ToQueuedTask([&]() { |
Danil Chapovalov | 76a35d9 | 2021-06-08 12:30:46 +0200 | [diff] [blame] | 566 | result = call->Receiver()->DeliverPacket(webrtc::MediaType::VIDEO, |
| 567 | std::move(packet_buffer), |
| 568 | /* packet_time_us */ -1); |
Ilya Nikolaevskiy | 6a64690 | 2020-12-11 11:07:01 +0100 | [diff] [blame] | 569 | event.Set(); |
| 570 | })); |
| 571 | event.Wait(/*give_up_after_ms=*/10000); |
| 572 | switch (result) { |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 573 | case PacketReceiver::DELIVERY_OK: |
| 574 | break; |
| 575 | case PacketReceiver::DELIVERY_UNKNOWN_SSRC: { |
Danil Chapovalov | 76a35d9 | 2021-06-08 12:30:46 +0200 | [diff] [blame] | 576 | if (unknown_packets[header.Ssrc()] == 0) |
| 577 | fprintf(stderr, "Unknown SSRC: %u!\n", header.Ssrc()); |
| 578 | ++unknown_packets[header.Ssrc()]; |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 579 | break; |
| 580 | } |
| 581 | case PacketReceiver::DELIVERY_PACKET_ERROR: { |
| 582 | fprintf(stderr, |
| 583 | "Packet error, corrupt packets or incorrect setup?\n"); |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 584 | fprintf(stderr, "Packet len=%zu pt=%u seq=%u ts=%u ssrc=0x%8x\n", |
Danil Chapovalov | 76a35d9 | 2021-06-08 12:30:46 +0200 | [diff] [blame] | 585 | packet.length, header.PayloadType(), header.SequenceNumber(), |
| 586 | header.Timestamp(), header.Ssrc()); |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 587 | break; |
| 588 | } |
philipp.hancke | 7b58960 | 2017-01-26 04:54:04 -0800 | [diff] [blame] | 589 | } |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 590 | } |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 591 | fprintf(stderr, "num_packets: %d\n", num_packets); |
| 592 | |
| 593 | for (std::map<uint32_t, int>::const_iterator it = unknown_packets.begin(); |
| 594 | it != unknown_packets.end(); ++it) { |
| 595 | fprintf(stderr, "Packets for unknown ssrc '%u': %d\n", it->first, |
| 596 | it->second); |
| 597 | } |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 598 | } |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 599 | }; // class RtpReplayer |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 600 | |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 601 | void RtpReplay() { |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 602 | RtpReplayer::Replay(ConfigFile(), InputFile()); |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 603 | } |
Benjamin Wright | 90ab76d | 2018-08-23 11:33:29 -0700 | [diff] [blame] | 604 | |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 605 | } // namespace webrtc |
| 606 | |
| 607 | int main(int argc, char* argv[]) { |
| 608 | ::testing::InitGoogleTest(&argc, argv); |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 609 | absl::ParseCommandLine(argc, argv); |
oprypin | 6e09d87 | 2017-08-31 03:21:39 -0700 | [diff] [blame] | 610 | |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 611 | RTC_CHECK(ValidatePayloadType(absl::GetFlag(FLAGS_media_payload_type))); |
| 612 | RTC_CHECK(ValidatePayloadType(absl::GetFlag(FLAGS_media_payload_type_rtx))); |
| 613 | RTC_CHECK(ValidateOptionalPayloadType(absl::GetFlag(FLAGS_red_payload_type))); |
philipel | 752968e | 2017-12-05 12:40:28 +0100 | [diff] [blame] | 614 | RTC_CHECK( |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 615 | ValidateOptionalPayloadType(absl::GetFlag(FLAGS_red_payload_type_rtx))); |
philipel | 752968e | 2017-12-05 12:40:28 +0100 | [diff] [blame] | 616 | RTC_CHECK( |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 617 | ValidateOptionalPayloadType(absl::GetFlag(FLAGS_ulpfec_payload_type))); |
| 618 | RTC_CHECK(ValidateSsrc(absl::GetFlag(FLAGS_ssrc).c_str())); |
| 619 | RTC_CHECK(ValidateSsrc(absl::GetFlag(FLAGS_ssrc_rtx).c_str())); |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 620 | RTC_CHECK( |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 621 | ValidateRtpHeaderExtensionId(absl::GetFlag(FLAGS_abs_send_time_id))); |
| 622 | RTC_CHECK(ValidateRtpHeaderExtensionId( |
| 623 | absl::GetFlag(FLAGS_transmission_offset_id))); |
| 624 | RTC_CHECK(ValidateInputFilenameNotEmpty(absl::GetFlag(FLAGS_input_file))); |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 625 | |
Philipp Hancke | 07b7dec | 2020-07-28 12:34:48 +0200 | [diff] [blame] | 626 | rtc::ThreadManager::Instance()->WrapCurrentThread(); |
pbos@webrtc.org | 4b5625e | 2014-08-06 16:26:56 +0000 | [diff] [blame] | 627 | webrtc::test::RunTest(webrtc::RtpReplay); |
| 628 | return 0; |
| 629 | } |