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