Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: webrtc/video/replay.cc

Issue 2972423002: Fix video_replay tool to respect RTX stream and fix default parameters. (Closed)
Patch Set: Fix format Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/test/call_test.cc ('k') | webrtc/video/video_quality_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include <stdio.h> 11 #include <stdio.h>
12 12
13 #include <map> 13 #include <map>
14 #include <memory> 14 #include <memory>
15 #include <sstream> 15 #include <sstream>
16 16
17 #include "gflags/gflags.h" 17 #include "gflags/gflags.h"
18 #include "webrtc/api/video_codecs/video_decoder.h" 18 #include "webrtc/api/video_codecs/video_decoder.h"
19 #include "webrtc/call/call.h" 19 #include "webrtc/call/call.h"
20 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" 20 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
21 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" 21 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
22 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" 22 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
23 #include "webrtc/rtc_base/checks.h" 23 #include "webrtc/rtc_base/checks.h"
24 #include "webrtc/system_wrappers/include/clock.h" 24 #include "webrtc/system_wrappers/include/clock.h"
25 #include "webrtc/system_wrappers/include/sleep.h" 25 #include "webrtc/system_wrappers/include/sleep.h"
26 #include "webrtc/test/call_test.h"
26 #include "webrtc/test/encoder_settings.h" 27 #include "webrtc/test/encoder_settings.h"
27 #include "webrtc/test/fake_decoder.h" 28 #include "webrtc/test/fake_decoder.h"
28 #include "webrtc/test/gtest.h" 29 #include "webrtc/test/gtest.h"
29 #include "webrtc/test/null_transport.h" 30 #include "webrtc/test/null_transport.h"
30 #include "webrtc/test/rtp_file_reader.h" 31 #include "webrtc/test/rtp_file_reader.h"
31 #include "webrtc/test/run_loop.h" 32 #include "webrtc/test/run_loop.h"
32 #include "webrtc/test/run_test.h" 33 #include "webrtc/test/run_test.h"
33 #include "webrtc/test/video_capturer.h" 34 #include "webrtc/test/video_capturer.h"
34 #include "webrtc/test/video_renderer.h" 35 #include "webrtc/test/video_renderer.h"
35 #include "webrtc/typedefs.h" 36 #include "webrtc/typedefs.h"
36 37
37 namespace webrtc { 38 namespace webrtc {
38 namespace flags { 39 namespace flags {
39 40
40 // TODO(pbos): Multiple receivers. 41 // TODO(pbos): Multiple receivers.
41 42
42 // Flag for payload type. 43 // Flag for payload type.
43 static bool ValidatePayloadType(const char* flagname, int32_t payload_type) { 44 static bool ValidatePayloadType(const char* flagname, int32_t payload_type) {
44 return payload_type > 0 && payload_type <= 127; 45 return payload_type > 0 && payload_type <= 127;
45 } 46 }
46 DEFINE_int32(payload_type, 0, "Payload type"); 47 DEFINE_int32(payload_type, test::CallTest::kPayloadTypeVP8, "Payload type");
47 static int PayloadType() { return static_cast<int>(FLAGS_payload_type); } 48 static int PayloadType() { return static_cast<int>(FLAGS_payload_type); }
48 static const bool payload_dummy = 49 static const bool payload_dummy =
49 google::RegisterFlagValidator(&FLAGS_payload_type, &ValidatePayloadType); 50 google::RegisterFlagValidator(&FLAGS_payload_type, &ValidatePayloadType);
50 51
52 DEFINE_int32(payload_type_rtx,
53 test::CallTest::kSendRtxPayloadType,
54 "RTX payload type");
55 static int PayloadTypeRtx() {
56 return static_cast<int>(FLAGS_payload_type_rtx);
57 }
58 static const bool payload_rtx_dummy =
59 google::RegisterFlagValidator(&FLAGS_payload_type_rtx,
60 &ValidatePayloadType);
61
51 // Flag for SSRC. 62 // Flag for SSRC.
52 static bool ValidateSsrc(const char* flagname, uint64_t ssrc) { 63 static bool ValidateSsrc(const char* flagname, uint64_t ssrc) {
53 return ssrc > 0 && ssrc <= 0xFFFFFFFFu; 64 return ssrc > 0 && ssrc <= 0xFFFFFFFFu;
54 } 65 }
55 66
56 DEFINE_uint64(ssrc, 0, "Incoming SSRC"); 67 DEFINE_uint64(ssrc, test::CallTest::kVideoSendSsrcs[0], "Incoming SSRC");
57 static uint32_t Ssrc() { return static_cast<uint32_t>(FLAGS_ssrc); } 68 static uint32_t Ssrc() { return static_cast<uint32_t>(FLAGS_ssrc); }
58 static const bool ssrc_dummy = 69 static const bool ssrc_dummy =
59 google::RegisterFlagValidator(&FLAGS_ssrc, &ValidateSsrc); 70 google::RegisterFlagValidator(&FLAGS_ssrc, &ValidateSsrc);
60 71
72 DEFINE_uint64(ssrc_rtx, test::CallTest::kSendRtxSsrcs[0], "Incoming RTX SSRC");
73 static uint32_t SsrcRtx() {
74 return static_cast<uint32_t>(FLAGS_ssrc_rtx);
75 }
76 static const bool ssrc_rtx_dummy =
77 google::RegisterFlagValidator(&FLAGS_ssrc_rtx, &ValidateSsrc);
78
61 static bool ValidateOptionalPayloadType(const char* flagname, 79 static bool ValidateOptionalPayloadType(const char* flagname,
62 int32_t payload_type) { 80 int32_t payload_type) {
63 return payload_type == -1 || ValidatePayloadType(flagname, payload_type); 81 return payload_type == -1 || ValidatePayloadType(flagname, payload_type);
64 } 82 }
65 83
66 // Flag for RED payload type. 84 // Flag for RED payload type.
67 DEFINE_int32(red_payload_type, -1, "RED payload type"); 85 DEFINE_int32(red_payload_type, -1, "RED payload type");
68 static int RedPayloadType() { 86 static int RedPayloadType() {
69 return static_cast<int>(FLAGS_red_payload_type); 87 return static_cast<int>(FLAGS_red_payload_type);
70 } 88 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 FileRenderPassthrough file_passthrough(flags::OutBase(), 230 FileRenderPassthrough file_passthrough(flags::OutBase(),
213 playback_video.get()); 231 playback_video.get());
214 232
215 webrtc::RtcEventLogNullImpl event_log; 233 webrtc::RtcEventLogNullImpl event_log;
216 std::unique_ptr<Call> call(Call::Create(Call::Config(&event_log))); 234 std::unique_ptr<Call> call(Call::Create(Call::Config(&event_log)));
217 235
218 test::NullTransport transport; 236 test::NullTransport transport;
219 VideoReceiveStream::Config receive_config(&transport); 237 VideoReceiveStream::Config receive_config(&transport);
220 receive_config.rtp.remote_ssrc = flags::Ssrc(); 238 receive_config.rtp.remote_ssrc = flags::Ssrc();
221 receive_config.rtp.local_ssrc = kReceiverLocalSsrc; 239 receive_config.rtp.local_ssrc = kReceiverLocalSsrc;
240 receive_config.rtp.rtx_ssrc = flags::SsrcRtx();
241 receive_config.rtp.rtx_payload_types[flags::PayloadType()] =
242 flags::PayloadTypeRtx();
222 receive_config.rtp.ulpfec.ulpfec_payload_type = flags::FecPayloadType(); 243 receive_config.rtp.ulpfec.ulpfec_payload_type = flags::FecPayloadType();
223 receive_config.rtp.ulpfec.red_payload_type = flags::RedPayloadType(); 244 receive_config.rtp.ulpfec.red_payload_type = flags::RedPayloadType();
224 receive_config.rtp.nack.rtp_history_ms = 1000; 245 receive_config.rtp.nack.rtp_history_ms = 1000;
225 if (flags::TransmissionOffsetId() != -1) { 246 if (flags::TransmissionOffsetId() != -1) {
226 receive_config.rtp.extensions.push_back(RtpExtension( 247 receive_config.rtp.extensions.push_back(RtpExtension(
227 RtpExtension::kTimestampOffsetUri, flags::TransmissionOffsetId())); 248 RtpExtension::kTimestampOffsetUri, flags::TransmissionOffsetId()));
228 } 249 }
229 if (flags::AbsSendTimeId() != -1) { 250 if (flags::AbsSendTimeId() != -1) {
230 receive_config.rtp.extensions.push_back( 251 receive_config.rtp.extensions.push_back(
231 RtpExtension(RtpExtension::kAbsSendTimeUri, flags::AbsSendTimeId())); 252 RtpExtension(RtpExtension::kAbsSendTimeUri, flags::AbsSendTimeId()));
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 } 348 }
328 } // namespace webrtc 349 } // namespace webrtc
329 350
330 int main(int argc, char* argv[]) { 351 int main(int argc, char* argv[]) {
331 ::testing::InitGoogleTest(&argc, argv); 352 ::testing::InitGoogleTest(&argc, argv);
332 google::ParseCommandLineFlags(&argc, &argv, true); 353 google::ParseCommandLineFlags(&argc, &argv, true);
333 354
334 webrtc::test::RunTest(webrtc::RtpReplay); 355 webrtc::test::RunTest(webrtc::RtpReplay);
335 return 0; 356 return 0;
336 } 357 }
OLDNEW
« no previous file with comments | « webrtc/test/call_test.cc ('k') | webrtc/video/video_quality_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698