OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 const PacketTime& packet_time); | 170 const PacketTime& packet_time); |
171 void ConfigureSync(const std::string& sync_group) | 171 void ConfigureSync(const std::string& sync_group) |
172 EXCLUSIVE_LOCKS_REQUIRED(receive_crit_); | 172 EXCLUSIVE_LOCKS_REQUIRED(receive_crit_); |
173 | 173 |
174 void NotifyBweOfReceivedPacket(const RtpPacketReceived& packet, | 174 void NotifyBweOfReceivedPacket(const RtpPacketReceived& packet, |
175 MediaType media_type) | 175 MediaType media_type) |
176 SHARED_LOCKS_REQUIRED(receive_crit_); | 176 SHARED_LOCKS_REQUIRED(receive_crit_); |
177 | 177 |
178 rtc::Optional<RtpPacketReceived> ParseRtpPacket(const uint8_t* packet, | 178 rtc::Optional<RtpPacketReceived> ParseRtpPacket(const uint8_t* packet, |
179 size_t length, | 179 size_t length, |
180 const PacketTime& packet_time) | 180 const PacketTime* packet_time) |
181 SHARED_LOCKS_REQUIRED(receive_crit_); | 181 SHARED_LOCKS_REQUIRED(receive_crit_); |
182 | 182 |
183 void UpdateSendHistograms() EXCLUSIVE_LOCKS_REQUIRED(&bitrate_crit_); | 183 void UpdateSendHistograms() EXCLUSIVE_LOCKS_REQUIRED(&bitrate_crit_); |
184 void UpdateReceiveHistograms(); | 184 void UpdateReceiveHistograms(); |
185 void UpdateHistograms(); | 185 void UpdateHistograms(); |
186 void UpdateAggregateNetworkState(); | 186 void UpdateAggregateNetworkState(); |
187 | 187 |
188 Clock* const clock_; | 188 Clock* const clock_; |
189 | 189 |
190 const int num_cpu_cores_; | 190 const int num_cpu_cores_; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
391 } | 391 } |
392 UpdateReceiveHistograms(); | 392 UpdateReceiveHistograms(); |
393 UpdateHistograms(); | 393 UpdateHistograms(); |
394 | 394 |
395 Trace::ReturnTrace(); | 395 Trace::ReturnTrace(); |
396 } | 396 } |
397 | 397 |
398 rtc::Optional<RtpPacketReceived> Call::ParseRtpPacket( | 398 rtc::Optional<RtpPacketReceived> Call::ParseRtpPacket( |
399 const uint8_t* packet, | 399 const uint8_t* packet, |
400 size_t length, | 400 size_t length, |
401 const PacketTime& packet_time) { | 401 const PacketTime* packet_time) { |
402 RtpPacketReceived parsed_packet; | 402 RtpPacketReceived parsed_packet; |
403 if (!parsed_packet.Parse(packet, length)) | 403 if (!parsed_packet.Parse(packet, length)) |
404 return rtc::Optional<RtpPacketReceived>(); | 404 return rtc::Optional<RtpPacketReceived>(); |
405 | 405 |
406 auto it = receive_rtp_config_.find(parsed_packet.Ssrc()); | 406 auto it = receive_rtp_config_.find(parsed_packet.Ssrc()); |
407 if (it != receive_rtp_config_.end()) | 407 if (it != receive_rtp_config_.end()) |
408 parsed_packet.IdentifyExtensions(it->second.extensions); | 408 parsed_packet.IdentifyExtensions(it->second.extensions); |
409 | 409 |
410 int64_t arrival_time_ms; | 410 int64_t arrival_time_ms; |
411 if (packet_time.timestamp != -1) { | 411 if (packet_time && packet_time->timestamp != -1) { |
412 arrival_time_ms = (packet_time.timestamp + 500) / 1000; | 412 arrival_time_ms = (packet_time->timestamp + 500) / 1000; |
413 } else { | 413 } else { |
414 arrival_time_ms = clock_->TimeInMilliseconds(); | 414 arrival_time_ms = clock_->TimeInMilliseconds(); |
415 } | 415 } |
416 parsed_packet.set_arrival_time_ms(arrival_time_ms); | 416 parsed_packet.set_arrival_time_ms(arrival_time_ms); |
417 | 417 |
418 return rtc::Optional<RtpPacketReceived>(std::move(parsed_packet)); | 418 return rtc::Optional<RtpPacketReceived>(std::move(parsed_packet)); |
419 } | 419 } |
420 | 420 |
421 void Call::UpdateHistograms() { | 421 void Call::UpdateHistograms() { |
422 RTC_HISTOGRAM_COUNTS_100000( | 422 RTC_HISTOGRAM_COUNTS_100000( |
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1177 PacketReceiver::DeliveryStatus Call::DeliverRtp(MediaType media_type, | 1177 PacketReceiver::DeliveryStatus Call::DeliverRtp(MediaType media_type, |
1178 const uint8_t* packet, | 1178 const uint8_t* packet, |
1179 size_t length, | 1179 size_t length, |
1180 const PacketTime& packet_time) { | 1180 const PacketTime& packet_time) { |
1181 TRACE_EVENT0("webrtc", "Call::DeliverRtp"); | 1181 TRACE_EVENT0("webrtc", "Call::DeliverRtp"); |
1182 | 1182 |
1183 ReadLockScoped read_lock(*receive_crit_); | 1183 ReadLockScoped read_lock(*receive_crit_); |
1184 // TODO(nisse): We should parse the RTP header only here, and pass | 1184 // TODO(nisse): We should parse the RTP header only here, and pass |
1185 // on parsed_packet to the receive streams. | 1185 // on parsed_packet to the receive streams. |
1186 rtc::Optional<RtpPacketReceived> parsed_packet = | 1186 rtc::Optional<RtpPacketReceived> parsed_packet = |
1187 ParseRtpPacket(packet, length, packet_time); | 1187 ParseRtpPacket(packet, length, &packet_time); |
1188 | 1188 |
1189 if (!parsed_packet) | 1189 if (!parsed_packet) |
1190 return DELIVERY_PACKET_ERROR; | 1190 return DELIVERY_PACKET_ERROR; |
1191 | 1191 |
1192 NotifyBweOfReceivedPacket(*parsed_packet, media_type); | 1192 NotifyBweOfReceivedPacket(*parsed_packet, media_type); |
1193 | 1193 |
1194 uint32_t ssrc = parsed_packet->Ssrc(); | 1194 uint32_t ssrc = parsed_packet->Ssrc(); |
1195 | 1195 |
1196 if (media_type == MediaType::ANY || media_type == MediaType::AUDIO) { | 1196 if (media_type == MediaType::ANY || media_type == MediaType::AUDIO) { |
1197 auto it = audio_receive_ssrcs_.find(ssrc); | 1197 auto it = audio_receive_ssrcs_.find(ssrc); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1246 // thread. Then this check can be enabled. | 1246 // thread. Then this check can be enabled. |
1247 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); | 1247 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); |
1248 if (RtpHeaderParser::IsRtcp(packet, length)) | 1248 if (RtpHeaderParser::IsRtcp(packet, length)) |
1249 return DeliverRtcp(media_type, packet, length); | 1249 return DeliverRtcp(media_type, packet, length); |
1250 | 1250 |
1251 return DeliverRtp(media_type, packet, length, packet_time); | 1251 return DeliverRtp(media_type, packet, length, packet_time); |
1252 } | 1252 } |
1253 | 1253 |
1254 // TODO(brandtr): Update this member function when we support protecting | 1254 // TODO(brandtr): Update this member function when we support protecting |
1255 // audio packets with FlexFEC. | 1255 // audio packets with FlexFEC. |
1256 bool Call::OnRecoveredPacket(const uint8_t* packet, size_t length) { | 1256 bool Call::OnRecoveredPacket(const uint8_t* packet, size_t length) { |
brandtr
2017/02/15 12:20:50
could the return value be turned into void here as
nisse-webrtc
2017/02/15 13:59:14
That's a change of the RecoveredPacketReceiver int
| |
1257 uint32_t ssrc = ByteReader<uint32_t>::ReadBigEndian(&packet[8]); | |
1258 ReadLockScoped read_lock(*receive_crit_); | 1257 ReadLockScoped read_lock(*receive_crit_); |
1259 auto it = video_receive_ssrcs_.find(ssrc); | 1258 rtc::Optional<RtpPacketReceived> parsed_packet = |
1259 ParseRtpPacket(packet, length, nullptr); | |
1260 if (!parsed_packet) | |
1261 return false; | |
1262 | |
1263 parsed_packet->set_recovered(true); | |
1264 | |
1265 auto it = video_receive_ssrcs_.find(parsed_packet->Ssrc()); | |
1260 if (it == video_receive_ssrcs_.end()) | 1266 if (it == video_receive_ssrcs_.end()) |
1261 return false; | 1267 return false; |
1262 return it->second->OnRecoveredPacket(packet, length); | 1268 |
1269 it->second->OnRtpPacket(*parsed_packet); | |
1270 return true; | |
1263 } | 1271 } |
1264 | 1272 |
1265 void Call::NotifyBweOfReceivedPacket(const RtpPacketReceived& packet, | 1273 void Call::NotifyBweOfReceivedPacket(const RtpPacketReceived& packet, |
1266 MediaType media_type) { | 1274 MediaType media_type) { |
1267 auto it = receive_rtp_config_.find(packet.Ssrc()); | 1275 auto it = receive_rtp_config_.find(packet.Ssrc()); |
1268 bool use_send_side_bwe = | 1276 bool use_send_side_bwe = |
1269 (it != receive_rtp_config_.end()) && it->second.use_send_side_bwe; | 1277 (it != receive_rtp_config_.end()) && it->second.use_send_side_bwe; |
1270 | 1278 |
1271 RTPHeader header; | 1279 RTPHeader header; |
1272 packet.GetHeader(&header); | 1280 packet.GetHeader(&header); |
(...skipping 15 matching lines...) Expand all Loading... | |
1288 if (media_type != MediaType::AUDIO || | 1296 if (media_type != MediaType::AUDIO || |
1289 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { | 1297 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { |
1290 congestion_controller_->OnReceivedPacket( | 1298 congestion_controller_->OnReceivedPacket( |
1291 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), | 1299 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), |
1292 header); | 1300 header); |
1293 } | 1301 } |
1294 } | 1302 } |
1295 | 1303 |
1296 } // namespace internal | 1304 } // namespace internal |
1297 } // namespace webrtc | 1305 } // namespace webrtc |
OLD | NEW |