Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 RTC_DCHECK(video_receiver_); | 284 RTC_DCHECK(video_receiver_); |
| 285 if (video_receiver_->IncomingPacket(payload_data, payload_size, | 285 if (video_receiver_->IncomingPacket(payload_data, payload_size, |
| 286 rtp_header_with_ntp) != 0) { | 286 rtp_header_with_ntp) != 0) { |
| 287 // Check this... | 287 // Check this... |
| 288 return -1; | 288 return -1; |
| 289 } | 289 } |
| 290 } | 290 } |
| 291 return 0; | 291 return 0; |
| 292 } | 292 } |
| 293 | 293 |
| 294 // TODO(nisse): Try to delete this method. Obstacles: It is used by | |
| 295 // ParseAndHandleEncapsulatingHeader, for handling Rtx packets. And | |
| 296 // it's part of the RtpData interface which we implement. | |
| 294 bool RtpStreamReceiver::OnRecoveredPacket(const uint8_t* rtp_packet, | 297 bool RtpStreamReceiver::OnRecoveredPacket(const uint8_t* rtp_packet, |
|
nisse-webrtc
2017/02/14 10:24:33
Is there any easy way to get rid of this method an
brandtr
2017/02/15 12:20:50
No, RTX, RED, and ULPFEC should not go back to Cal
nisse-webrtc
2017/02/15 13:59:15
This is tricky. Parsing extensions logically belon
| |
| 295 size_t rtp_packet_length) { | 298 size_t rtp_packet_length) { |
| 296 RTPHeader header; | 299 RTPHeader header; |
| 297 if (!rtp_header_parser_->Parse(rtp_packet, rtp_packet_length, &header)) { | 300 if (!rtp_header_parser_->Parse(rtp_packet, rtp_packet_length, &header)) { |
| 298 return false; | 301 return false; |
| 299 } | 302 } |
| 300 header.payload_type_frequency = kVideoPayloadTypeFrequency; | 303 header.payload_type_frequency = kVideoPayloadTypeFrequency; |
| 301 bool in_order = IsPacketInOrder(header); | 304 bool in_order = IsPacketInOrder(header); |
| 302 return ReceivePacket(rtp_packet, rtp_packet_length, header, in_order); | 305 return ReceivePacket(rtp_packet, rtp_packet_length, header, in_order); |
| 303 } | 306 } |
| 304 | 307 |
| 305 // TODO(pbos): Remove as soon as audio can handle a changing payload type | 308 // TODO(pbos): Remove as soon as audio can handle a changing payload type |
| 306 // without this callback. | 309 // without this callback. |
| 307 int32_t RtpStreamReceiver::OnInitializeDecoder( | 310 int32_t RtpStreamReceiver::OnInitializeDecoder( |
| 308 const int8_t payload_type, | 311 const int8_t payload_type, |
| 309 const char payload_name[RTP_PAYLOAD_NAME_SIZE], | 312 const char payload_name[RTP_PAYLOAD_NAME_SIZE], |
| 310 const int frequency, | 313 const int frequency, |
| 311 const size_t channels, | 314 const size_t channels, |
| 312 const uint32_t rate) { | 315 const uint32_t rate) { |
| 313 RTC_NOTREACHED(); | 316 RTC_NOTREACHED(); |
| 314 return 0; | 317 return 0; |
| 315 } | 318 } |
| 316 | 319 |
| 317 void RtpStreamReceiver::OnIncomingSSRCChanged(const uint32_t ssrc) { | 320 void RtpStreamReceiver::OnIncomingSSRCChanged(const uint32_t ssrc) { |
| 318 rtp_rtcp_->SetRemoteSSRC(ssrc); | 321 rtp_rtcp_->SetRemoteSSRC(ssrc); |
| 319 } | 322 } |
| 320 | 323 |
| 324 // This method handles both regular Rtp packets and packets recovered | |
|
brandtr
2017/02/15 12:20:50
Nits: "RTP packets". "FlexFEC".
nisse-webrtc
2017/02/15 13:59:15
Done.
| |
| 325 // via Flexfec. | |
| 321 void RtpStreamReceiver::OnRtpPacket(const RtpPacketReceived& packet) { | 326 void RtpStreamReceiver::OnRtpPacket(const RtpPacketReceived& packet) { |
| 322 { | 327 { |
| 323 rtc::CritScope lock(&receive_cs_); | 328 rtc::CritScope lock(&receive_cs_); |
| 324 if (!receiving_) { | 329 if (!receiving_) { |
| 325 return; | 330 return; |
| 326 } | 331 } |
| 327 } | 332 } |
| 333 if (!packet.recovered()) { | |
| 334 int64_t now_ms = clock_->TimeInMilliseconds(); | |
| 328 | 335 |
| 329 int64_t now_ms = clock_->TimeInMilliseconds(); | 336 { |
| 330 | 337 // Periodically log the RTP header of incoming packets. |
| 331 { | 338 rtc::CritScope lock(&receive_cs_); |
| 332 // Periodically log the RTP header of incoming packets. | 339 if (now_ms - last_packet_log_ms_ > kPacketLogIntervalMs) { |
| 333 rtc::CritScope lock(&receive_cs_); | 340 std::stringstream ss; |
| 334 if (now_ms - last_packet_log_ms_ > kPacketLogIntervalMs) { | 341 ss << "Packet received on SSRC: " << packet.Ssrc() |
| 335 std::stringstream ss; | 342 << " with payload type: " << static_cast<int>(packet.PayloadType()) |
| 336 ss << "Packet received on SSRC: " << packet.Ssrc() | 343 << ", timestamp: " << packet.Timestamp() |
| 337 << " with payload type: " << static_cast<int>(packet.PayloadType()) | 344 << ", sequence number: " << packet.SequenceNumber() |
| 338 << ", timestamp: " << packet.Timestamp() | 345 << ", arrival time: " << packet.arrival_time_ms(); |
| 339 << ", sequence number: " << packet.SequenceNumber() | 346 int32_t time_offset; |
| 340 << ", arrival time: " << packet.arrival_time_ms(); | 347 if (packet.GetExtension<TransmissionOffset>(&time_offset)) { |
| 341 int32_t time_offset; | 348 ss << ", toffset: " << time_offset; |
| 342 if (packet.GetExtension<TransmissionOffset>(&time_offset)) { | 349 } |
| 343 ss << ", toffset: " << time_offset; | 350 uint32_t send_time; |
| 351 if (packet.GetExtension<AbsoluteSendTime>(&send_time)) { | |
| 352 ss << ", abs send time: " << send_time; | |
| 353 } | |
| 354 LOG(LS_INFO) << ss.str(); | |
| 355 last_packet_log_ms_ = now_ms; | |
| 344 } | 356 } |
| 345 uint32_t send_time; | |
| 346 if (packet.GetExtension<AbsoluteSendTime>(&send_time)) { | |
| 347 ss << ", abs send time: " << send_time; | |
| 348 } | |
| 349 LOG(LS_INFO) << ss.str(); | |
| 350 last_packet_log_ms_ = now_ms; | |
| 351 } | 357 } |
| 352 } | 358 } |
| 353 | 359 |
| 354 // TODO(nisse): Delete use of GetHeader, but needs refactoring of | 360 // TODO(nisse): Delete use of GetHeader, but needs refactoring of |
| 355 // ReceivePacket and IncomingPacket methods below. | 361 // ReceivePacket and IncomingPacket methods below. |
| 356 RTPHeader header; | 362 RTPHeader header; |
| 357 packet.GetHeader(&header); | 363 packet.GetHeader(&header); |
| 358 | 364 |
| 359 header.payload_type_frequency = kVideoPayloadTypeFrequency; | 365 header.payload_type_frequency = kVideoPayloadTypeFrequency; |
| 360 | 366 |
| 361 bool in_order = IsPacketInOrder(header); | 367 bool in_order = IsPacketInOrder(header); |
| 362 rtp_payload_registry_.SetIncomingPayloadType(header); | 368 if (!packet.recovered()) { |
|
brandtr
2017/02/15 12:20:50
Could you reorder the lines in this method, so tha
nisse-webrtc
2017/02/15 13:59:15
I'm not sure how order matters. And I'd prefer to
| |
| 369 // TODO(nisse): Why isn't this done for recovered packets? | |
| 370 rtp_payload_registry_.SetIncomingPayloadType(header); | |
| 371 } | |
| 363 ReceivePacket(packet.data(), packet.size(), header, in_order); | 372 ReceivePacket(packet.data(), packet.size(), header, in_order); |
| 364 // Update receive statistics after ReceivePacket. | 373 // Update receive statistics after ReceivePacket. |
| 365 // Receive statistics will be reset if the payload type changes (make sure | 374 // Receive statistics will be reset if the payload type changes (make sure |
| 366 // that the first packet is included in the stats). | 375 // that the first packet is included in the stats). |
| 367 rtp_receive_statistics_->IncomingPacket( | 376 if (!packet.recovered()) { |
| 368 header, packet.size(), IsPacketRetransmitted(header, in_order)); | 377 // TODO(nisse): Should we pass a recovered flag to stats? |
|
brandtr
2017/02/15 12:20:50
That would be one way of implementing bugs.webrtc.
nisse-webrtc
2017/02/15 13:59:15
I'm adding a TODO and bug reference.
| |
| 378 rtp_receive_statistics_->IncomingPacket( | |
| 379 header, packet.size(), IsPacketRetransmitted(header, in_order)); | |
| 380 } | |
| 369 } | 381 } |
| 370 | 382 |
| 371 int32_t RtpStreamReceiver::RequestKeyFrame() { | 383 int32_t RtpStreamReceiver::RequestKeyFrame() { |
| 372 return rtp_rtcp_->RequestKeyFrame(); | 384 return rtp_rtcp_->RequestKeyFrame(); |
| 373 } | 385 } |
| 374 | 386 |
| 375 int32_t RtpStreamReceiver::SliceLossIndicationRequest( | 387 int32_t RtpStreamReceiver::SliceLossIndicationRequest( |
| 376 const uint64_t picture_id) { | 388 const uint64_t picture_id) { |
| 377 return rtp_rtcp_->SendRTCPSliceLossIndication( | 389 return rtp_rtcp_->SendRTCPSliceLossIndication( |
| 378 static_cast<uint8_t>(picture_id)); | 390 static_cast<uint8_t>(picture_id)); |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 668 return; | 680 return; |
| 669 | 681 |
| 670 if (!sprop_decoder.DecodeSprop(sprop_base64_it->second.c_str())) | 682 if (!sprop_decoder.DecodeSprop(sprop_base64_it->second.c_str())) |
| 671 return; | 683 return; |
| 672 | 684 |
| 673 tracker_.InsertSpsPpsNalus(sprop_decoder.sps_nalu(), | 685 tracker_.InsertSpsPpsNalus(sprop_decoder.sps_nalu(), |
| 674 sprop_decoder.pps_nalu()); | 686 sprop_decoder.pps_nalu()); |
| 675 } | 687 } |
| 676 | 688 |
| 677 } // namespace webrtc | 689 } // namespace webrtc |
| OLD | NEW |