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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 // Return DELIVERY_UNKNOWN_SSRC if it can be determined that | 659 // Return DELIVERY_UNKNOWN_SSRC if it can be determined that |
660 // there's no receiver of the packet. | 660 // there's no receiver of the packet. |
661 received_rtcp_bytes_ += length; | 661 received_rtcp_bytes_ += length; |
662 bool rtcp_delivered = false; | 662 bool rtcp_delivered = false; |
663 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { | 663 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { |
664 ReadLockScoped read_lock(*receive_crit_); | 664 ReadLockScoped read_lock(*receive_crit_); |
665 for (VideoReceiveStream* stream : video_receive_streams_) { | 665 for (VideoReceiveStream* stream : video_receive_streams_) { |
666 if (stream->DeliverRtcp(packet, length)) { | 666 if (stream->DeliverRtcp(packet, length)) { |
667 rtcp_delivered = true; | 667 rtcp_delivered = true; |
668 if (event_log_) | 668 if (event_log_) |
669 event_log_->LogRtcpPacket(true, media_type, packet, length); | 669 event_log_->LogRtcpPacket(kIncomingPacket, media_type, packet, |
| 670 length); |
670 } | 671 } |
671 } | 672 } |
672 } | 673 } |
673 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { | 674 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { |
674 ReadLockScoped read_lock(*send_crit_); | 675 ReadLockScoped read_lock(*send_crit_); |
675 for (VideoSendStream* stream : video_send_streams_) { | 676 for (VideoSendStream* stream : video_send_streams_) { |
676 if (stream->DeliverRtcp(packet, length)) { | 677 if (stream->DeliverRtcp(packet, length)) { |
677 rtcp_delivered = true; | 678 rtcp_delivered = true; |
678 if (event_log_) | 679 if (event_log_) |
679 event_log_->LogRtcpPacket(false, media_type, packet, length); | 680 event_log_->LogRtcpPacket(kIncomingPacket, media_type, packet, |
| 681 length); |
680 } | 682 } |
681 } | 683 } |
682 } | 684 } |
683 return rtcp_delivered ? DELIVERY_OK : DELIVERY_PACKET_ERROR; | 685 return rtcp_delivered ? DELIVERY_OK : DELIVERY_PACKET_ERROR; |
684 } | 686 } |
685 | 687 |
686 PacketReceiver::DeliveryStatus Call::DeliverRtp(MediaType media_type, | 688 PacketReceiver::DeliveryStatus Call::DeliverRtp(MediaType media_type, |
687 const uint8_t* packet, | 689 const uint8_t* packet, |
688 size_t length, | 690 size_t length, |
689 const PacketTime& packet_time) { | 691 const PacketTime& packet_time) { |
690 TRACE_EVENT0("webrtc", "Call::DeliverRtp"); | 692 TRACE_EVENT0("webrtc", "Call::DeliverRtp"); |
691 // Minimum RTP header size. | 693 // Minimum RTP header size. |
692 if (length < 12) | 694 if (length < 12) |
693 return DELIVERY_PACKET_ERROR; | 695 return DELIVERY_PACKET_ERROR; |
694 | 696 |
695 last_rtp_packet_received_ms_ = clock_->TimeInMilliseconds(); | 697 last_rtp_packet_received_ms_ = clock_->TimeInMilliseconds(); |
696 if (first_rtp_packet_received_ms_ == -1) | 698 if (first_rtp_packet_received_ms_ == -1) |
697 first_rtp_packet_received_ms_ = last_rtp_packet_received_ms_; | 699 first_rtp_packet_received_ms_ = last_rtp_packet_received_ms_; |
698 | 700 |
699 uint32_t ssrc = ByteReader<uint32_t>::ReadBigEndian(&packet[8]); | 701 uint32_t ssrc = ByteReader<uint32_t>::ReadBigEndian(&packet[8]); |
700 ReadLockScoped read_lock(*receive_crit_); | 702 ReadLockScoped read_lock(*receive_crit_); |
701 if (media_type == MediaType::ANY || media_type == MediaType::AUDIO) { | 703 if (media_type == MediaType::ANY || media_type == MediaType::AUDIO) { |
702 auto it = audio_receive_ssrcs_.find(ssrc); | 704 auto it = audio_receive_ssrcs_.find(ssrc); |
703 if (it != audio_receive_ssrcs_.end()) { | 705 if (it != audio_receive_ssrcs_.end()) { |
704 received_audio_bytes_ += length; | 706 received_audio_bytes_ += length; |
705 auto status = it->second->DeliverRtp(packet, length, packet_time) | 707 auto status = it->second->DeliverRtp(packet, length, packet_time) |
706 ? DELIVERY_OK | 708 ? DELIVERY_OK |
707 : DELIVERY_PACKET_ERROR; | 709 : DELIVERY_PACKET_ERROR; |
708 if (status == DELIVERY_OK && event_log_) | 710 if (status == DELIVERY_OK && event_log_) |
709 event_log_->LogRtpHeader(true, media_type, packet, length); | 711 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); |
710 return status; | 712 return status; |
711 } | 713 } |
712 } | 714 } |
713 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { | 715 if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) { |
714 auto it = video_receive_ssrcs_.find(ssrc); | 716 auto it = video_receive_ssrcs_.find(ssrc); |
715 if (it != video_receive_ssrcs_.end()) { | 717 if (it != video_receive_ssrcs_.end()) { |
716 received_video_bytes_ += length; | 718 received_video_bytes_ += length; |
717 auto status = it->second->DeliverRtp(packet, length, packet_time) | 719 auto status = it->second->DeliverRtp(packet, length, packet_time) |
718 ? DELIVERY_OK | 720 ? DELIVERY_OK |
719 : DELIVERY_PACKET_ERROR; | 721 : DELIVERY_PACKET_ERROR; |
720 if (status == DELIVERY_OK && event_log_) | 722 if (status == DELIVERY_OK && event_log_) |
721 event_log_->LogRtpHeader(true, media_type, packet, length); | 723 event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length); |
722 return status; | 724 return status; |
723 } | 725 } |
724 } | 726 } |
725 return DELIVERY_UNKNOWN_SSRC; | 727 return DELIVERY_UNKNOWN_SSRC; |
726 } | 728 } |
727 | 729 |
728 PacketReceiver::DeliveryStatus Call::DeliverPacket( | 730 PacketReceiver::DeliveryStatus Call::DeliverPacket( |
729 MediaType media_type, | 731 MediaType media_type, |
730 const uint8_t* packet, | 732 const uint8_t* packet, |
731 size_t length, | 733 size_t length, |
732 const PacketTime& packet_time) { | 734 const PacketTime& packet_time) { |
733 // TODO(solenberg): Tests call this function on a network thread, libjingle | 735 // TODO(solenberg): Tests call this function on a network thread, libjingle |
734 // calls on the worker thread. We should move towards always using a network | 736 // calls on the worker thread. We should move towards always using a network |
735 // thread. Then this check can be enabled. | 737 // thread. Then this check can be enabled. |
736 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); | 738 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); |
737 if (RtpHeaderParser::IsRtcp(packet, length)) | 739 if (RtpHeaderParser::IsRtcp(packet, length)) |
738 return DeliverRtcp(media_type, packet, length); | 740 return DeliverRtcp(media_type, packet, length); |
739 | 741 |
740 return DeliverRtp(media_type, packet, length, packet_time); | 742 return DeliverRtp(media_type, packet, length, packet_time); |
741 } | 743 } |
742 | 744 |
743 } // namespace internal | 745 } // namespace internal |
744 } // namespace webrtc | 746 } // namespace webrtc |
OLD | NEW |