| OLD | NEW |
| 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 <memory> |
| 14 |
| 13 #include "webrtc/base/format_macros.h" | 15 #include "webrtc/base/format_macros.h" |
| 14 #include "webrtc/base/scoped_ptr.h" | |
| 15 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" | 16 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" |
| 16 #include "webrtc/modules/remote_bitrate_estimator/tools/bwe_rtp.h" | 17 #include "webrtc/modules/remote_bitrate_estimator/tools/bwe_rtp.h" |
| 17 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 18 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
| 18 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h" | 19 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h" |
| 19 #include "webrtc/test/rtp_file_reader.h" | 20 #include "webrtc/test/rtp_file_reader.h" |
| 20 | 21 |
| 21 class Observer : public webrtc::RemoteBitrateObserver { | 22 class Observer : public webrtc::RemoteBitrateObserver { |
| 22 public: | 23 public: |
| 23 explicit Observer(webrtc::Clock* clock) : clock_(clock) {} | 24 explicit Observer(webrtc::Clock* clock) : clock_(clock) {} |
| 24 | 25 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 41 webrtc::test::RtpFileReader* reader; | 42 webrtc::test::RtpFileReader* reader; |
| 42 webrtc::RemoteBitrateEstimator* estimator; | 43 webrtc::RemoteBitrateEstimator* estimator; |
| 43 webrtc::RtpHeaderParser* parser; | 44 webrtc::RtpHeaderParser* parser; |
| 44 std::string estimator_used; | 45 std::string estimator_used; |
| 45 webrtc::SimulatedClock clock(0); | 46 webrtc::SimulatedClock clock(0); |
| 46 Observer observer(&clock); | 47 Observer observer(&clock); |
| 47 if (!ParseArgsAndSetupEstimator(argc, argv, &clock, &observer, &reader, | 48 if (!ParseArgsAndSetupEstimator(argc, argv, &clock, &observer, &reader, |
| 48 &parser, &estimator, &estimator_used)) { | 49 &parser, &estimator, &estimator_used)) { |
| 49 return -1; | 50 return -1; |
| 50 } | 51 } |
| 51 rtc::scoped_ptr<webrtc::test::RtpFileReader> rtp_reader(reader); | 52 std::unique_ptr<webrtc::test::RtpFileReader> rtp_reader(reader); |
| 52 rtc::scoped_ptr<webrtc::RtpHeaderParser> rtp_parser(parser); | 53 std::unique_ptr<webrtc::RtpHeaderParser> rtp_parser(parser); |
| 53 rtc::scoped_ptr<webrtc::RemoteBitrateEstimator> rbe(estimator); | 54 std::unique_ptr<webrtc::RemoteBitrateEstimator> rbe(estimator); |
| 54 | 55 |
| 55 // Process the file. | 56 // Process the file. |
| 56 int packet_counter = 0; | 57 int packet_counter = 0; |
| 57 int64_t next_rtp_time_ms = 0; | 58 int64_t next_rtp_time_ms = 0; |
| 58 int64_t first_rtp_time_ms = -1; | 59 int64_t first_rtp_time_ms = -1; |
| 59 int abs_send_time_count = 0; | 60 int abs_send_time_count = 0; |
| 60 int ts_offset_count = 0; | 61 int ts_offset_count = 0; |
| 61 webrtc::test::RtpPacket packet; | 62 webrtc::test::RtpPacket packet; |
| 62 if (!rtp_reader->NextPacket(&packet)) { | 63 if (!rtp_reader->NextPacket(&packet)) { |
| 63 printf("No RTP packet found\n"); | 64 printf("No RTP packet found\n"); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 clock.TimeInMilliseconds()); | 105 clock.TimeInMilliseconds()); |
| 105 printf("Estimator used: %s\n", estimator_used.c_str()); | 106 printf("Estimator used: %s\n", estimator_used.c_str()); |
| 106 printf("Packets with absolute send time: %d\n", | 107 printf("Packets with absolute send time: %d\n", |
| 107 abs_send_time_count); | 108 abs_send_time_count); |
| 108 printf("Packets with timestamp offset: %d\n", | 109 printf("Packets with timestamp offset: %d\n", |
| 109 ts_offset_count); | 110 ts_offset_count); |
| 110 printf("Packets with no extension: %d\n", | 111 printf("Packets with no extension: %d\n", |
| 111 packet_counter - ts_offset_count - abs_send_time_count); | 112 packet_counter - ts_offset_count - abs_send_time_count); |
| 112 return 0; | 113 return 0; |
| 113 } | 114 } |
| OLD | NEW |