OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 |
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 | 983 |
984 auto NextProcessTime = [&]() { | 984 auto NextProcessTime = [&]() { |
985 if (rtcp_iterator != incoming_rtcp.end() || | 985 if (rtcp_iterator != incoming_rtcp.end() || |
986 rtp_iterator != outgoing_rtp.end()) { | 986 rtp_iterator != outgoing_rtp.end()) { |
987 return clock.TimeInMicroseconds() + | 987 return clock.TimeInMicroseconds() + |
988 std::max<int64_t>(cc.TimeUntilNextProcess() * 1000, 0); | 988 std::max<int64_t>(cc.TimeUntilNextProcess() * 1000, 0); |
989 } | 989 } |
990 return std::numeric_limits<int64_t>::max(); | 990 return std::numeric_limits<int64_t>::max(); |
991 }; | 991 }; |
992 | 992 |
993 RateStatistics acked_bitrate(1000, 8000); | 993 RateStatistics acked_bitrate(250, 8000); |
994 | 994 |
995 int64_t time_us = std::min(NextRtpTime(), NextRtcpTime()); | 995 int64_t time_us = std::min(NextRtpTime(), NextRtcpTime()); |
| 996 int64_t last_update_us = 0; |
996 while (time_us != std::numeric_limits<int64_t>::max()) { | 997 while (time_us != std::numeric_limits<int64_t>::max()) { |
997 clock.AdvanceTimeMicroseconds(time_us - clock.TimeInMicroseconds()); | 998 clock.AdvanceTimeMicroseconds(time_us - clock.TimeInMicroseconds()); |
998 if (clock.TimeInMicroseconds() >= NextRtcpTime()) { | 999 if (clock.TimeInMicroseconds() >= NextRtcpTime()) { |
999 RTC_DCHECK_EQ(clock.TimeInMicroseconds(), NextRtcpTime()); | 1000 RTC_DCHECK_EQ(clock.TimeInMicroseconds(), NextRtcpTime()); |
1000 const LoggedRtcpPacket& rtcp = *rtcp_iterator->second; | 1001 const LoggedRtcpPacket& rtcp = *rtcp_iterator->second; |
1001 if (rtcp.type == kRtcpTransportFeedback) { | 1002 if (rtcp.type == kRtcpTransportFeedback) { |
1002 TransportFeedbackObserver* observer = cc.GetTransportFeedbackObserver(); | 1003 TransportFeedbackObserver* observer = cc.GetTransportFeedbackObserver(); |
1003 observer->OnTransportFeedback(*static_cast<rtcp::TransportFeedback*>( | 1004 observer->OnTransportFeedback(*static_cast<rtcp::TransportFeedback*>( |
1004 rtcp.packet.get())); | 1005 rtcp.packet.get())); |
1005 std::vector<PacketInfo> feedback = | 1006 std::vector<PacketInfo> feedback = |
(...skipping 24 matching lines...) Expand all Loading... |
1030 rtc::SentPacket sent_packet( | 1031 rtc::SentPacket sent_packet( |
1031 rtp.header.extension.transportSequenceNumber, rtp.timestamp / 1000); | 1032 rtp.header.extension.transportSequenceNumber, rtp.timestamp / 1000); |
1032 cc.OnSentPacket(sent_packet); | 1033 cc.OnSentPacket(sent_packet); |
1033 } | 1034 } |
1034 ++rtp_iterator; | 1035 ++rtp_iterator; |
1035 } | 1036 } |
1036 if (clock.TimeInMicroseconds() >= NextProcessTime()) { | 1037 if (clock.TimeInMicroseconds() >= NextProcessTime()) { |
1037 RTC_DCHECK_EQ(clock.TimeInMicroseconds(), NextProcessTime()); | 1038 RTC_DCHECK_EQ(clock.TimeInMicroseconds(), NextProcessTime()); |
1038 cc.Process(); | 1039 cc.Process(); |
1039 } | 1040 } |
1040 if (observer.GetAndResetBitrateUpdated()) { | 1041 if (observer.GetAndResetBitrateUpdated() || |
| 1042 time_us - last_update_us >= 1e6) { |
1041 uint32_t y = observer.last_bitrate_bps() / 1000; | 1043 uint32_t y = observer.last_bitrate_bps() / 1000; |
1042 float x = static_cast<float>(clock.TimeInMicroseconds() - begin_time_) / | 1044 float x = static_cast<float>(clock.TimeInMicroseconds() - begin_time_) / |
1043 1000000; | 1045 1000000; |
1044 time_series.points.emplace_back(x, y); | 1046 time_series.points.emplace_back(x, y); |
| 1047 last_update_us = time_us; |
1045 } | 1048 } |
1046 time_us = std::min({NextRtpTime(), NextRtcpTime(), NextProcessTime()}); | 1049 time_us = std::min({NextRtpTime(), NextRtcpTime(), NextProcessTime()}); |
1047 } | 1050 } |
1048 // Add the data set to the plot. | 1051 // Add the data set to the plot. |
1049 plot->series_list_.push_back(std::move(time_series)); | 1052 plot->series_list_.push_back(std::move(time_series)); |
1050 plot->series_list_.push_back(std::move(acked_time_series)); | 1053 plot->series_list_.push_back(std::move(acked_time_series)); |
1051 | 1054 |
1052 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); | 1055 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); |
1053 plot->SetSuggestedYAxis(0, 10, "Bitrate (kbps)", kBottomMargin, kTopMargin); | 1056 plot->SetSuggestedYAxis(0, 10, "Bitrate (kbps)", kBottomMargin, kTopMargin); |
1054 plot->SetTitle("Simulated BWE behavior"); | 1057 plot->SetTitle("Simulated BWE behavior"); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 point.y -= estimated_base_delay_ms; | 1171 point.y -= estimated_base_delay_ms; |
1169 // Add the data set to the plot. | 1172 // Add the data set to the plot. |
1170 plot->series_list_.push_back(std::move(time_series)); | 1173 plot->series_list_.push_back(std::move(time_series)); |
1171 | 1174 |
1172 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); | 1175 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); |
1173 plot->SetSuggestedYAxis(0, 10, "Delay (ms)", kBottomMargin, kTopMargin); | 1176 plot->SetSuggestedYAxis(0, 10, "Delay (ms)", kBottomMargin, kTopMargin); |
1174 plot->SetTitle("Network Delay Change."); | 1177 plot->SetTitle("Network Delay Change."); |
1175 } | 1178 } |
1176 } // namespace plotting | 1179 } // namespace plotting |
1177 } // namespace webrtc | 1180 } // namespace webrtc |
OLD | NEW |