2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
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.
11 #include "webrtc/modules/remote_bitrate_estimator/tools/bwe_rtp.h"
16 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
17 #include "webrtc/modules/rtp_rtcp/interface/rtp_header_parser.h"
18 #include "webrtc/modules/rtp_rtcp/interface/rtp_payload_registry.h"
19 #include "webrtc/test/rtp_file_reader.h"
21 const int kMinBitrateBps = 30000;
23 bool ParseArgsAndSetupEstimator(int argc,
26 webrtc::RemoteBitrateObserver* observer,
27 webrtc::test::RtpFileReader** rtp_reader,
28 webrtc::RtpHeaderParser** parser,
29 webrtc::RemoteBitrateEstimator** estimator,
30 std::string* estimator_used) {
31 *rtp_reader = webrtc::test::RtpFileReader::Create(
32 webrtc::test::RtpFileReader::kRtpDump, argv[3]);
34 fprintf(stderr, "Cannot open input file %s\n", argv[3]);
37 fprintf(stderr, "Input file: %s\n\n", argv[3]);
38 webrtc::RTPExtensionType extension = webrtc::kRtpExtensionAbsoluteSendTime;
40 if (strncmp("tsoffset", argv[1], 8) == 0) {
41 extension = webrtc::kRtpExtensionTransmissionTimeOffset;
42 fprintf(stderr, "Extension: toffset\n");
44 fprintf(stderr, "Extension: abs\n");
46 int id = atoi(argv[2]);
48 // Setup the RTP header parser and the bitrate estimator.
49 *parser = webrtc::RtpHeaderParser::Create();
50 (*parser)->RegisterRtpHeaderExtension(extension, id);
53 case webrtc::kRtpExtensionAbsoluteSendTime: {
54 webrtc::AbsoluteSendTimeRemoteBitrateEstimatorFactory factory;
55 *estimator = factory.Create(observer, clock, webrtc::kAimdControl,
57 *estimator_used = "AbsoluteSendTimeRemoteBitrateEstimator";
60 case webrtc::kRtpExtensionTransmissionTimeOffset: {
61 webrtc::RemoteBitrateEstimatorFactory factory;
62 *estimator = factory.Create(observer, clock, webrtc::kAimdControl,
64 *estimator_used = "RemoteBitrateEstimator";