OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 has_received_ack_ = true; | 104 has_received_ack_ = true; |
105 } | 105 } |
106 } | 106 } |
107 | 107 |
108 void SendSideBweSender::OnPacketsSent(const Packets& packets) { | 108 void SendSideBweSender::OnPacketsSent(const Packets& packets) { |
109 for (Packet* packet : packets) { | 109 for (Packet* packet : packets) { |
110 if (packet->GetPacketType() == Packet::kMedia) { | 110 if (packet->GetPacketType() == Packet::kMedia) { |
111 MediaPacket* media_packet = static_cast<MediaPacket*>(packet); | 111 MediaPacket* media_packet = static_cast<MediaPacket*>(packet); |
112 // TODO(philipel): Add probe_cluster_id to Packet class in order | 112 // TODO(philipel): Add probe_cluster_id to Packet class in order |
113 // to create tests for probing using cluster ids. | 113 // to create tests for probing using cluster ids. |
114 send_time_history_.AddAndRemoveOld(media_packet->header().sequenceNumber, | 114 PacketFeedback packet_feedback( |
115 media_packet->payload_size(), | 115 clock_->TimeInMilliseconds(), media_packet->header().sequenceNumber, |
116 PacedPacketInfo()); | 116 media_packet->payload_size(), 0, 0, PacedPacketInfo()); |
| 117 send_time_history_.AddAndRemoveOld(packet_feedback); |
117 send_time_history_.OnSentPacket(media_packet->header().sequenceNumber, | 118 send_time_history_.OnSentPacket(media_packet->header().sequenceNumber, |
118 media_packet->sender_timestamp_ms()); | 119 media_packet->sender_timestamp_ms()); |
119 } | 120 } |
120 } | 121 } |
121 } | 122 } |
122 | 123 |
123 void SendSideBweSender::OnReceiveBitrateChanged( | 124 void SendSideBweSender::OnReceiveBitrateChanged( |
124 const std::vector<uint32_t>& ssrcs, | 125 const std::vector<uint32_t>& ssrcs, |
125 uint32_t bitrate) { | 126 uint32_t bitrate) { |
126 feedback_observer_->OnReceivedEstimatedBitrate(bitrate); | 127 feedback_observer_->OnReceivedEstimatedBitrate(bitrate); |
(...skipping 12 matching lines...) Expand all Loading... |
139 } | 140 } |
140 | 141 |
141 SendSideBweReceiver::~SendSideBweReceiver() { | 142 SendSideBweReceiver::~SendSideBweReceiver() { |
142 } | 143 } |
143 | 144 |
144 void SendSideBweReceiver::ReceivePacket(int64_t arrival_time_ms, | 145 void SendSideBweReceiver::ReceivePacket(int64_t arrival_time_ms, |
145 const MediaPacket& media_packet) { | 146 const MediaPacket& media_packet) { |
146 packet_feedback_vector_.push_back( | 147 packet_feedback_vector_.push_back( |
147 PacketFeedback(-1, arrival_time_ms, media_packet.sender_timestamp_ms(), | 148 PacketFeedback(-1, arrival_time_ms, media_packet.sender_timestamp_ms(), |
148 media_packet.header().sequenceNumber, | 149 media_packet.header().sequenceNumber, |
149 media_packet.payload_size(), PacedPacketInfo())); | 150 media_packet.payload_size(), 0, 0, PacedPacketInfo())); |
150 | 151 |
151 // Log received packet information. | 152 // Log received packet information. |
152 BweReceiver::ReceivePacket(arrival_time_ms, media_packet); | 153 BweReceiver::ReceivePacket(arrival_time_ms, media_packet); |
153 } | 154 } |
154 | 155 |
155 FeedbackPacket* SendSideBweReceiver::GetFeedback(int64_t now_ms) { | 156 FeedbackPacket* SendSideBweReceiver::GetFeedback(int64_t now_ms) { |
156 if (now_ms - last_feedback_ms_ < kFeedbackIntervalMs) | 157 if (now_ms - last_feedback_ms_ < kFeedbackIntervalMs) |
157 return NULL; | 158 return NULL; |
158 last_feedback_ms_ = now_ms; | 159 last_feedback_ms_ = now_ms; |
159 int64_t corrected_send_time_ms = | 160 int64_t corrected_send_time_ms = |
160 packet_feedback_vector_.back().send_time_ms + now_ms - | 161 packet_feedback_vector_.back().send_time_ms + now_ms - |
161 packet_feedback_vector_.back().arrival_time_ms; | 162 packet_feedback_vector_.back().arrival_time_ms; |
162 FeedbackPacket* fb = new SendSideBweFeedback( | 163 FeedbackPacket* fb = new SendSideBweFeedback( |
163 flow_id_, now_ms * 1000, corrected_send_time_ms, packet_feedback_vector_); | 164 flow_id_, now_ms * 1000, corrected_send_time_ms, packet_feedback_vector_); |
164 packet_feedback_vector_.clear(); | 165 packet_feedback_vector_.clear(); |
165 return fb; | 166 return fb; |
166 } | 167 } |
167 | 168 |
168 } // namespace bwe | 169 } // namespace bwe |
169 } // namespace testing | 170 } // namespace testing |
170 } // namespace webrtc | 171 } // namespace webrtc |
OLD | NEW |