| 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(clock_->TimeInMilliseconds(), -1, -1, |
| 115 media_packet->payload_size(), | 115 media_packet->header().sequenceNumber, |
| 116 PacedPacketInfo()); | 116 media_packet->payload_size(), 0, 0, |
| 117 PacedPacketInfo()); |
| 118 send_time_history_.AddAndRemoveOld(packet_feedback); |
| 117 send_time_history_.OnSentPacket(media_packet->header().sequenceNumber, | 119 send_time_history_.OnSentPacket(media_packet->header().sequenceNumber, |
| 118 media_packet->sender_timestamp_ms()); | 120 media_packet->sender_timestamp_ms()); |
| 119 } | 121 } |
| 120 } | 122 } |
| 121 } | 123 } |
| 122 | 124 |
| 123 void SendSideBweSender::OnReceiveBitrateChanged( | 125 void SendSideBweSender::OnReceiveBitrateChanged( |
| 124 const std::vector<uint32_t>& ssrcs, | 126 const std::vector<uint32_t>& ssrcs, |
| 125 uint32_t bitrate) { | 127 uint32_t bitrate) { |
| 126 feedback_observer_->OnReceivedEstimatedBitrate(bitrate); | 128 feedback_observer_->OnReceivedEstimatedBitrate(bitrate); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 139 } | 141 } |
| 140 | 142 |
| 141 SendSideBweReceiver::~SendSideBweReceiver() { | 143 SendSideBweReceiver::~SendSideBweReceiver() { |
| 142 } | 144 } |
| 143 | 145 |
| 144 void SendSideBweReceiver::ReceivePacket(int64_t arrival_time_ms, | 146 void SendSideBweReceiver::ReceivePacket(int64_t arrival_time_ms, |
| 145 const MediaPacket& media_packet) { | 147 const MediaPacket& media_packet) { |
| 146 packet_feedback_vector_.push_back( | 148 packet_feedback_vector_.push_back( |
| 147 PacketFeedback(-1, arrival_time_ms, media_packet.sender_timestamp_ms(), | 149 PacketFeedback(-1, arrival_time_ms, media_packet.sender_timestamp_ms(), |
| 148 media_packet.header().sequenceNumber, | 150 media_packet.header().sequenceNumber, |
| 149 media_packet.payload_size(), PacedPacketInfo())); | 151 media_packet.payload_size(), 0, 0, PacedPacketInfo())); |
| 150 | 152 |
| 151 // Log received packet information. | 153 // Log received packet information. |
| 152 BweReceiver::ReceivePacket(arrival_time_ms, media_packet); | 154 BweReceiver::ReceivePacket(arrival_time_ms, media_packet); |
| 153 } | 155 } |
| 154 | 156 |
| 155 FeedbackPacket* SendSideBweReceiver::GetFeedback(int64_t now_ms) { | 157 FeedbackPacket* SendSideBweReceiver::GetFeedback(int64_t now_ms) { |
| 156 if (now_ms - last_feedback_ms_ < kFeedbackIntervalMs) | 158 if (now_ms - last_feedback_ms_ < kFeedbackIntervalMs) |
| 157 return NULL; | 159 return NULL; |
| 158 last_feedback_ms_ = now_ms; | 160 last_feedback_ms_ = now_ms; |
| 159 int64_t corrected_send_time_ms = | 161 int64_t corrected_send_time_ms = |
| 160 packet_feedback_vector_.back().send_time_ms + now_ms - | 162 packet_feedback_vector_.back().send_time_ms + now_ms - |
| 161 packet_feedback_vector_.back().arrival_time_ms; | 163 packet_feedback_vector_.back().arrival_time_ms; |
| 162 FeedbackPacket* fb = new SendSideBweFeedback( | 164 FeedbackPacket* fb = new SendSideBweFeedback( |
| 163 flow_id_, now_ms * 1000, corrected_send_time_ms, packet_feedback_vector_); | 165 flow_id_, now_ms * 1000, corrected_send_time_ms, packet_feedback_vector_); |
| 164 packet_feedback_vector_.clear(); | 166 packet_feedback_vector_.clear(); |
| 165 return fb; | 167 return fb; |
| 166 } | 168 } |
| 167 | 169 |
| 168 } // namespace bwe | 170 } // namespace bwe |
| 169 } // namespace testing | 171 } // namespace testing |
| 170 } // namespace webrtc | 172 } // namespace webrtc |
| OLD | NEW |