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 |
11 #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h" | 11 #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h" |
12 | 12 |
13 #include <assert.h> | 13 #include <assert.h> |
14 #include <string.h> | 14 #include <string.h> |
15 | 15 |
16 #include <limits> | 16 #include <limits> |
17 #include <map> | 17 #include <map> |
18 #include <memory> | 18 #include <memory> |
19 #include <utility> | 19 #include <utility> |
20 #include <vector> | 20 #include <vector> |
21 | 21 |
22 #include "webrtc/base/checks.h" | 22 #include "webrtc/base/checks.h" |
23 #include "webrtc/base/logging.h" | 23 #include "webrtc/base/logging.h" |
24 #include "webrtc/base/trace_event.h" | 24 #include "webrtc/base/trace_event.h" |
| 25 #include "webrtc/common_video/include/video_bitrate_allocator.h" |
25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h" | 26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h" |
26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h" | 27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h" |
27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/compound_packet.h" | 28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/compound_packet.h" |
28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h" | 29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h" |
29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/fir.h" | 30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/fir.h" |
30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h" | 31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h" |
31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h" | 32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h" |
32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rapid_resync_request.h" | 33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rapid_resync_request.h" |
33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" | 34 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" |
34 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.h" | 35 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.h" |
(...skipping 25 matching lines...) Expand all Loading... |
60 uint32_t packet_type_flags = 0; // RTCPPacketTypeFlags bit field. | 61 uint32_t packet_type_flags = 0; // RTCPPacketTypeFlags bit field. |
61 | 62 |
62 uint32_t remote_ssrc = 0; | 63 uint32_t remote_ssrc = 0; |
63 std::vector<uint16_t> nack_sequence_numbers; | 64 std::vector<uint16_t> nack_sequence_numbers; |
64 ReportBlockList report_blocks; | 65 ReportBlockList report_blocks; |
65 int64_t rtt_ms = 0; | 66 int64_t rtt_ms = 0; |
66 uint8_t sli_picture_id = 0; | 67 uint8_t sli_picture_id = 0; |
67 uint64_t rpsi_picture_id = 0; | 68 uint64_t rpsi_picture_id = 0; |
68 uint32_t receiver_estimated_max_bitrate_bps = 0; | 69 uint32_t receiver_estimated_max_bitrate_bps = 0; |
69 std::unique_ptr<rtcp::TransportFeedback> transport_feedback; | 70 std::unique_ptr<rtcp::TransportFeedback> transport_feedback; |
| 71 rtc::Optional<BitrateAllocation> target_bitrate_allocation; |
70 }; | 72 }; |
71 | 73 |
72 struct RTCPReceiver::ReceiveInformation { | 74 struct RTCPReceiver::ReceiveInformation { |
73 struct TimedTmmbrItem { | 75 struct TimedTmmbrItem { |
74 rtcp::TmmbItem tmmbr_item; | 76 rtcp::TmmbItem tmmbr_item; |
75 int64_t last_updated_ms; | 77 int64_t last_updated_ms; |
76 }; | 78 }; |
77 | 79 |
78 int64_t last_time_received_ms = 0; | 80 int64_t last_time_received_ms = 0; |
79 | 81 |
(...skipping 16 matching lines...) Expand all Loading... |
96 size_t num_rtts = 0; | 98 size_t num_rtts = 0; |
97 }; | 99 }; |
98 | 100 |
99 RTCPReceiver::RTCPReceiver( | 101 RTCPReceiver::RTCPReceiver( |
100 Clock* clock, | 102 Clock* clock, |
101 bool receiver_only, | 103 bool receiver_only, |
102 RtcpPacketTypeCounterObserver* packet_type_counter_observer, | 104 RtcpPacketTypeCounterObserver* packet_type_counter_observer, |
103 RtcpBandwidthObserver* rtcp_bandwidth_observer, | 105 RtcpBandwidthObserver* rtcp_bandwidth_observer, |
104 RtcpIntraFrameObserver* rtcp_intra_frame_observer, | 106 RtcpIntraFrameObserver* rtcp_intra_frame_observer, |
105 TransportFeedbackObserver* transport_feedback_observer, | 107 TransportFeedbackObserver* transport_feedback_observer, |
| 108 VideoBitrateAllocationObserver* bitrate_allocation_observer, |
106 ModuleRtpRtcp* owner) | 109 ModuleRtpRtcp* owner) |
107 : _clock(clock), | 110 : _clock(clock), |
108 receiver_only_(receiver_only), | 111 receiver_only_(receiver_only), |
109 _rtpRtcp(*owner), | 112 _rtpRtcp(*owner), |
110 _cbRtcpBandwidthObserver(rtcp_bandwidth_observer), | 113 rtcp_bandwidth_observer_(rtcp_bandwidth_observer), |
111 _cbRtcpIntraFrameObserver(rtcp_intra_frame_observer), | 114 rtcp_intra_frame_observer_(rtcp_intra_frame_observer), |
112 _cbTransportFeedbackObserver(transport_feedback_observer), | 115 transport_feedback_observer_(transport_feedback_observer), |
| 116 bitrate_allocation_observer_(bitrate_allocation_observer), |
113 main_ssrc_(0), | 117 main_ssrc_(0), |
114 _remoteSSRC(0), | 118 _remoteSSRC(0), |
115 _remoteSenderInfo(), | 119 _remoteSenderInfo(), |
116 xr_rrtr_status_(false), | 120 xr_rrtr_status_(false), |
117 xr_rr_rtt_ms_(0), | 121 xr_rr_rtt_ms_(0), |
118 _lastReceivedRrMs(0), | 122 _lastReceivedRrMs(0), |
119 _lastIncreasedSequenceNumberMs(0), | 123 _lastIncreasedSequenceNumberMs(0), |
120 stats_callback_(NULL), | 124 stats_callback_(nullptr), |
121 packet_type_counter_observer_(packet_type_counter_observer), | 125 packet_type_counter_observer_(packet_type_counter_observer), |
122 num_skipped_packets_(0), | 126 num_skipped_packets_(0), |
123 last_skipped_packets_warning_(clock->TimeInMilliseconds()) { | 127 last_skipped_packets_warning_(clock->TimeInMilliseconds()) { |
124 memset(&_remoteSenderInfo, 0, sizeof(_remoteSenderInfo)); | 128 memset(&_remoteSenderInfo, 0, sizeof(_remoteSenderInfo)); |
125 } | 129 } |
126 | 130 |
127 RTCPReceiver::~RTCPReceiver() {} | 131 RTCPReceiver::~RTCPReceiver() {} |
128 | 132 |
129 bool RTCPReceiver::IncomingPacket(const uint8_t* packet, size_t packet_size) { | 133 bool RTCPReceiver::IncomingPacket(const uint8_t* packet, size_t packet_size) { |
130 if (packet_size == 0) { | 134 if (packet_size == 0) { |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 PacketInformation* packet_information) { | 624 PacketInformation* packet_information) { |
621 rtcp::Sdes sdes; | 625 rtcp::Sdes sdes; |
622 if (!sdes.Parse(rtcp_block)) { | 626 if (!sdes.Parse(rtcp_block)) { |
623 ++num_skipped_packets_; | 627 ++num_skipped_packets_; |
624 return; | 628 return; |
625 } | 629 } |
626 | 630 |
627 for (const rtcp::Sdes::Chunk& chunk : sdes.chunks()) { | 631 for (const rtcp::Sdes::Chunk& chunk : sdes.chunks()) { |
628 received_cnames_[chunk.ssrc] = chunk.cname; | 632 received_cnames_[chunk.ssrc] = chunk.cname; |
629 { | 633 { |
630 rtc::CritScope lock(&_criticalSectionFeedbacks); | 634 rtc::CritScope lock(&feedbacks_lock_); |
631 if (stats_callback_) | 635 if (stats_callback_) |
632 stats_callback_->CNameChanged(chunk.cname.c_str(), chunk.ssrc); | 636 stats_callback_->CNameChanged(chunk.cname.c_str(), chunk.ssrc); |
633 } | 637 } |
634 } | 638 } |
635 packet_information->packet_type_flags |= kRtcpSdes; | 639 packet_information->packet_type_flags |= kRtcpSdes; |
636 } | 640 } |
637 | 641 |
638 void RTCPReceiver::HandleNACK(const CommonHeader& rtcp_block, | 642 void RTCPReceiver::HandleNACK(const CommonHeader& rtcp_block, |
639 PacketInformation* packet_information) { | 643 PacketInformation* packet_information) { |
640 rtcp::Nack nack; | 644 rtcp::Nack nack; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 if (!xr.Parse(rtcp_block)) { | 690 if (!xr.Parse(rtcp_block)) { |
687 ++num_skipped_packets_; | 691 ++num_skipped_packets_; |
688 return; | 692 return; |
689 } | 693 } |
690 | 694 |
691 if (xr.rrtr()) | 695 if (xr.rrtr()) |
692 HandleXrReceiveReferenceTime(xr.sender_ssrc(), *xr.rrtr()); | 696 HandleXrReceiveReferenceTime(xr.sender_ssrc(), *xr.rrtr()); |
693 | 697 |
694 for (const rtcp::ReceiveTimeInfo& time_info : xr.dlrr().sub_blocks()) | 698 for (const rtcp::ReceiveTimeInfo& time_info : xr.dlrr().sub_blocks()) |
695 HandleXrDlrrReportBlock(time_info); | 699 HandleXrDlrrReportBlock(time_info); |
| 700 |
| 701 if (xr.target_bitrate()) |
| 702 HandleXrTargetBitrate(*xr.target_bitrate(), packet_information); |
696 } | 703 } |
697 | 704 |
698 void RTCPReceiver::HandleXrReceiveReferenceTime( | 705 void RTCPReceiver::HandleXrReceiveReferenceTime( |
699 uint32_t sender_ssrc, | 706 uint32_t sender_ssrc, |
700 const rtcp::Rrtr& rrtr) { | 707 const rtcp::Rrtr& rrtr) { |
701 remote_time_info_.ssrc = sender_ssrc; | 708 remote_time_info_.ssrc = sender_ssrc; |
702 remote_time_info_.last_rr = CompactNtp(rrtr.ntp()); | 709 remote_time_info_.last_rr = CompactNtp(rrtr.ntp()); |
703 last_received_xr_ntp_.SetCurrent(*_clock); | 710 last_received_xr_ntp_.SetCurrent(*_clock); |
704 } | 711 } |
705 | 712 |
(...skipping 12 matching lines...) Expand all Loading... |
718 if (send_time == 0) | 725 if (send_time == 0) |
719 return; | 726 return; |
720 | 727 |
721 uint32_t delay_rr = rti.delay_since_last_rr; | 728 uint32_t delay_rr = rti.delay_since_last_rr; |
722 uint32_t now = CompactNtp(NtpTime(*_clock)); | 729 uint32_t now = CompactNtp(NtpTime(*_clock)); |
723 | 730 |
724 uint32_t rtt_ntp = now - delay_rr - send_time; | 731 uint32_t rtt_ntp = now - delay_rr - send_time; |
725 xr_rr_rtt_ms_ = CompactNtpRttToMs(rtt_ntp); | 732 xr_rr_rtt_ms_ = CompactNtpRttToMs(rtt_ntp); |
726 } | 733 } |
727 | 734 |
| 735 void RTCPReceiver::HandleXrTargetBitrate( |
| 736 const rtcp::TargetBitrate& target_bitrate, |
| 737 PacketInformation* packet_information) { |
| 738 BitrateAllocation bitrate_allocation; |
| 739 for (const auto& item : target_bitrate.GetTargetBitrates()) { |
| 740 bitrate_allocation.SetBitrate(item.spatial_layer, item.temporal_layer, |
| 741 item.target_bitrate_kbps * 1000); |
| 742 } |
| 743 packet_information->target_bitrate_allocation.emplace(bitrate_allocation); |
| 744 } |
| 745 |
728 void RTCPReceiver::HandlePLI(const CommonHeader& rtcp_block, | 746 void RTCPReceiver::HandlePLI(const CommonHeader& rtcp_block, |
729 PacketInformation* packet_information) { | 747 PacketInformation* packet_information) { |
730 rtcp::Pli pli; | 748 rtcp::Pli pli; |
731 if (!pli.Parse(rtcp_block)) { | 749 if (!pli.Parse(rtcp_block)) { |
732 ++num_skipped_packets_; | 750 ++num_skipped_packets_; |
733 return; | 751 return; |
734 } | 752 } |
735 | 753 |
736 if (main_ssrc_ == pli.media_ssrc()) { | 754 if (main_ssrc_ == pli.media_ssrc()) { |
737 TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "PLI"); | 755 TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "PLI"); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 | 909 |
892 packet_information->packet_type_flags |= kRtcpTransportFeedback; | 910 packet_information->packet_type_flags |= kRtcpTransportFeedback; |
893 packet_information->transport_feedback = std::move(transport_feedback); | 911 packet_information->transport_feedback = std::move(transport_feedback); |
894 } | 912 } |
895 | 913 |
896 void RTCPReceiver::UpdateTmmbr() { | 914 void RTCPReceiver::UpdateTmmbr() { |
897 // Find bounding set. | 915 // Find bounding set. |
898 std::vector<rtcp::TmmbItem> bounding = | 916 std::vector<rtcp::TmmbItem> bounding = |
899 TMMBRHelp::FindBoundingSet(TmmbrReceived()); | 917 TMMBRHelp::FindBoundingSet(TmmbrReceived()); |
900 | 918 |
901 if (!bounding.empty() && _cbRtcpBandwidthObserver) { | 919 if (!bounding.empty() && rtcp_bandwidth_observer_) { |
902 // We have a new bandwidth estimate on this channel. | 920 // We have a new bandwidth estimate on this channel. |
903 uint64_t bitrate_bps = TMMBRHelp::CalcMinBitrateBps(bounding); | 921 uint64_t bitrate_bps = TMMBRHelp::CalcMinBitrateBps(bounding); |
904 if (bitrate_bps <= std::numeric_limits<uint32_t>::max()) | 922 if (bitrate_bps <= std::numeric_limits<uint32_t>::max()) |
905 _cbRtcpBandwidthObserver->OnReceivedEstimatedBitrate(bitrate_bps); | 923 rtcp_bandwidth_observer_->OnReceivedEstimatedBitrate(bitrate_bps); |
906 } | 924 } |
907 | 925 |
908 // Set bounding set: inform remote clients about the new bandwidth. | 926 // Set bounding set: inform remote clients about the new bandwidth. |
909 _rtpRtcp.SetTmmbn(std::move(bounding)); | 927 _rtpRtcp.SetTmmbn(std::move(bounding)); |
910 } | 928 } |
911 | 929 |
912 void RTCPReceiver::RegisterRtcpStatisticsCallback( | 930 void RTCPReceiver::RegisterRtcpStatisticsCallback( |
913 RtcpStatisticsCallback* callback) { | 931 RtcpStatisticsCallback* callback) { |
914 rtc::CritScope cs(&_criticalSectionFeedbacks); | 932 rtc::CritScope cs(&feedbacks_lock_); |
915 stats_callback_ = callback; | 933 stats_callback_ = callback; |
916 } | 934 } |
917 | 935 |
918 RtcpStatisticsCallback* RTCPReceiver::GetRtcpStatisticsCallback() { | 936 RtcpStatisticsCallback* RTCPReceiver::GetRtcpStatisticsCallback() { |
919 rtc::CritScope cs(&_criticalSectionFeedbacks); | 937 rtc::CritScope cs(&feedbacks_lock_); |
920 return stats_callback_; | 938 return stats_callback_; |
921 } | 939 } |
922 | 940 |
923 // Holding no Critical section | 941 // Holding no Critical section |
924 void RTCPReceiver::TriggerCallbacksFromRTCPPacket( | 942 void RTCPReceiver::TriggerCallbacksFromRTCPPacket( |
925 const PacketInformation& packet_information) { | 943 const PacketInformation& packet_information) { |
926 // Process TMMBR and REMB first to avoid multiple callbacks | 944 // Process TMMBR and REMB first to avoid multiple callbacks |
927 // to OnNetworkChanged. | 945 // to OnNetworkChanged. |
928 if (packet_information.packet_type_flags & kRtcpTmmbr) { | 946 if (packet_information.packet_type_flags & kRtcpTmmbr) { |
929 // Might trigger a OnReceivedBandwidthEstimateUpdate. | 947 // Might trigger a OnReceivedBandwidthEstimateUpdate. |
(...skipping 10 matching lines...) Expand all Loading... |
940 if (!receiver_only_ && (packet_information.packet_type_flags & kRtcpSrReq)) { | 958 if (!receiver_only_ && (packet_information.packet_type_flags & kRtcpSrReq)) { |
941 _rtpRtcp.OnRequestSendReport(); | 959 _rtpRtcp.OnRequestSendReport(); |
942 } | 960 } |
943 if (!receiver_only_ && (packet_information.packet_type_flags & kRtcpNack)) { | 961 if (!receiver_only_ && (packet_information.packet_type_flags & kRtcpNack)) { |
944 if (!packet_information.nack_sequence_numbers.empty()) { | 962 if (!packet_information.nack_sequence_numbers.empty()) { |
945 LOG(LS_VERBOSE) << "Incoming NACK length: " | 963 LOG(LS_VERBOSE) << "Incoming NACK length: " |
946 << packet_information.nack_sequence_numbers.size(); | 964 << packet_information.nack_sequence_numbers.size(); |
947 _rtpRtcp.OnReceivedNack(packet_information.nack_sequence_numbers); | 965 _rtpRtcp.OnReceivedNack(packet_information.nack_sequence_numbers); |
948 } | 966 } |
949 } | 967 } |
950 { | 968 |
951 // We need feedback that we have received a report block(s) so that we | 969 // We need feedback that we have received a report block(s) so that we |
952 // can generate a new packet in a conference relay scenario, one received | 970 // can generate a new packet in a conference relay scenario, one received |
953 // report can generate several RTCP packets, based on number relayed/mixed | 971 // report can generate several RTCP packets, based on number relayed/mixed |
954 // a send report block should go out to all receivers. | 972 // a send report block should go out to all receivers. |
955 if (_cbRtcpIntraFrameObserver) { | 973 if (rtcp_intra_frame_observer_) { |
956 RTC_DCHECK(!receiver_only_); | 974 RTC_DCHECK(!receiver_only_); |
957 if ((packet_information.packet_type_flags & kRtcpPli) || | 975 if ((packet_information.packet_type_flags & kRtcpPli) || |
958 (packet_information.packet_type_flags & kRtcpFir)) { | 976 (packet_information.packet_type_flags & kRtcpFir)) { |
959 if (packet_information.packet_type_flags & kRtcpPli) { | 977 if (packet_information.packet_type_flags & kRtcpPli) { |
960 LOG(LS_VERBOSE) << "Incoming PLI from SSRC " | 978 LOG(LS_VERBOSE) << "Incoming PLI from SSRC " |
961 << packet_information.remote_ssrc; | 979 << packet_information.remote_ssrc; |
962 } else { | 980 } else { |
963 LOG(LS_VERBOSE) << "Incoming FIR from SSRC " | 981 LOG(LS_VERBOSE) << "Incoming FIR from SSRC " |
964 << packet_information.remote_ssrc; | 982 << packet_information.remote_ssrc; |
965 } | |
966 _cbRtcpIntraFrameObserver->OnReceivedIntraFrameRequest(local_ssrc); | |
967 } | 983 } |
968 if (packet_information.packet_type_flags & kRtcpSli) { | 984 rtcp_intra_frame_observer_->OnReceivedIntraFrameRequest(local_ssrc); |
969 _cbRtcpIntraFrameObserver->OnReceivedSLI( | |
970 local_ssrc, packet_information.sli_picture_id); | |
971 } | |
972 if (packet_information.packet_type_flags & kRtcpRpsi) { | |
973 _cbRtcpIntraFrameObserver->OnReceivedRPSI( | |
974 local_ssrc, packet_information.rpsi_picture_id); | |
975 } | |
976 } | 985 } |
977 if (_cbRtcpBandwidthObserver) { | 986 if (packet_information.packet_type_flags & kRtcpSli) { |
978 RTC_DCHECK(!receiver_only_); | 987 rtcp_intra_frame_observer_->OnReceivedSLI( |
979 if (packet_information.packet_type_flags & kRtcpRemb) { | 988 local_ssrc, packet_information.sli_picture_id); |
980 LOG(LS_VERBOSE) | 989 } |
981 << "Incoming REMB: " | 990 if (packet_information.packet_type_flags & kRtcpRpsi) { |
982 << packet_information.receiver_estimated_max_bitrate_bps; | 991 rtcp_intra_frame_observer_->OnReceivedRPSI( |
983 _cbRtcpBandwidthObserver->OnReceivedEstimatedBitrate( | 992 local_ssrc, packet_information.rpsi_picture_id); |
984 packet_information.receiver_estimated_max_bitrate_bps); | 993 } |
985 } | 994 } |
986 if ((packet_information.packet_type_flags & kRtcpSr) || | 995 if (rtcp_bandwidth_observer_) { |
987 (packet_information.packet_type_flags & kRtcpRr)) { | 996 RTC_DCHECK(!receiver_only_); |
988 int64_t now = _clock->TimeInMilliseconds(); | 997 if (packet_information.packet_type_flags & kRtcpRemb) { |
989 _cbRtcpBandwidthObserver->OnReceivedRtcpReceiverReport( | 998 LOG(LS_VERBOSE) << "Incoming REMB: " |
990 packet_information.report_blocks, packet_information.rtt_ms, now); | 999 << packet_information.receiver_estimated_max_bitrate_bps; |
991 } | 1000 rtcp_bandwidth_observer_->OnReceivedEstimatedBitrate( |
| 1001 packet_information.receiver_estimated_max_bitrate_bps); |
992 } | 1002 } |
993 if ((packet_information.packet_type_flags & kRtcpSr) || | 1003 if ((packet_information.packet_type_flags & kRtcpSr) || |
994 (packet_information.packet_type_flags & kRtcpRr)) { | 1004 (packet_information.packet_type_flags & kRtcpRr)) { |
995 _rtpRtcp.OnReceivedRtcpReportBlocks(packet_information.report_blocks); | 1005 int64_t now = _clock->TimeInMilliseconds(); |
| 1006 rtcp_bandwidth_observer_->OnReceivedRtcpReceiverReport( |
| 1007 packet_information.report_blocks, packet_information.rtt_ms, now); |
996 } | 1008 } |
| 1009 } |
| 1010 if ((packet_information.packet_type_flags & kRtcpSr) || |
| 1011 (packet_information.packet_type_flags & kRtcpRr)) { |
| 1012 _rtpRtcp.OnReceivedRtcpReportBlocks(packet_information.report_blocks); |
| 1013 } |
997 | 1014 |
998 if (_cbTransportFeedbackObserver && | 1015 if (transport_feedback_observer_ && |
999 (packet_information.packet_type_flags & kRtcpTransportFeedback)) { | 1016 (packet_information.packet_type_flags & kRtcpTransportFeedback)) { |
1000 uint32_t media_source_ssrc = | 1017 uint32_t media_source_ssrc = |
1001 packet_information.transport_feedback->media_ssrc(); | 1018 packet_information.transport_feedback->media_ssrc(); |
1002 if (media_source_ssrc == local_ssrc || | 1019 if (media_source_ssrc == local_ssrc || |
1003 registered_ssrcs.find(media_source_ssrc) != registered_ssrcs.end()) { | 1020 registered_ssrcs.find(media_source_ssrc) != registered_ssrcs.end()) { |
1004 _cbTransportFeedbackObserver->OnTransportFeedback( | 1021 transport_feedback_observer_->OnTransportFeedback( |
1005 *packet_information.transport_feedback); | 1022 *packet_information.transport_feedback); |
1006 } | |
1007 } | 1023 } |
1008 } | 1024 } |
1009 | 1025 |
| 1026 if (bitrate_allocation_observer_ && |
| 1027 packet_information.target_bitrate_allocation) { |
| 1028 bitrate_allocation_observer_->OnBitrateAllocationUpdated( |
| 1029 *packet_information.target_bitrate_allocation); |
| 1030 } |
| 1031 |
1010 if (!receiver_only_) { | 1032 if (!receiver_only_) { |
1011 rtc::CritScope cs(&_criticalSectionFeedbacks); | 1033 rtc::CritScope cs(&feedbacks_lock_); |
1012 if (stats_callback_) { | 1034 if (stats_callback_) { |
1013 for (const auto& report_block : packet_information.report_blocks) { | 1035 for (const auto& report_block : packet_information.report_blocks) { |
1014 RtcpStatistics stats; | 1036 RtcpStatistics stats; |
1015 stats.cumulative_lost = report_block.cumulativeLost; | 1037 stats.cumulative_lost = report_block.cumulativeLost; |
1016 stats.extended_max_sequence_number = report_block.extendedHighSeqNum; | 1038 stats.extended_max_sequence_number = report_block.extendedHighSeqNum; |
1017 stats.fraction_lost = report_block.fractionLost; | 1039 stats.fraction_lost = report_block.fractionLost; |
1018 stats.jitter = report_block.jitter; | 1040 stats.jitter = report_block.jitter; |
1019 | 1041 |
1020 stats_callback_->StatisticsUpdated(stats, report_block.sourceSSRC); | 1042 stats_callback_->StatisticsUpdated(stats, report_block.sourceSSRC); |
1021 } | 1043 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 } else { | 1075 } else { |
1054 candidates.push_back(it->second.tmmbr_item); | 1076 candidates.push_back(it->second.tmmbr_item); |
1055 ++it; | 1077 ++it; |
1056 } | 1078 } |
1057 } | 1079 } |
1058 } | 1080 } |
1059 return candidates; | 1081 return candidates; |
1060 } | 1082 } |
1061 | 1083 |
1062 } // namespace webrtc | 1084 } // namespace webrtc |
OLD | NEW |