Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(640)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc

Issue 2540363003: Wire up rtcp xr target bitrate on receive side. (Closed)
Patch Set: Addressed comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 PacketInformation* packet_information) { 688 PacketInformation* packet_information) {
685 rtcp::ExtendedReports xr; 689 rtcp::ExtendedReports xr;
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 if (!xr.dlrr().sub_blocks().empty()) {
danilchap 2016/12/02 11:01:14 can remove back if (!empty()) block too
sprang_webrtc 2016/12/02 12:20:11 Done.
695 HandleXrDlrrReportBlock(time_info); 699 for (const rtcp::ReceiveTimeInfo& time_info : xr.dlrr().sub_blocks())
700 HandleXrDlrrReportBlock(time_info);
701 }
702
703 if (xr.target_bitrate())
704 HandleXrTargetBitrate(*xr.target_bitrate(), packet_information);
696 } 705 }
697 706
698 void RTCPReceiver::HandleXrReceiveReferenceTime( 707 void RTCPReceiver::HandleXrReceiveReferenceTime(
699 uint32_t sender_ssrc, 708 uint32_t sender_ssrc,
700 const rtcp::Rrtr& rrtr) { 709 const rtcp::Rrtr& rrtr) {
701 remote_time_info_.ssrc = sender_ssrc; 710 remote_time_info_.ssrc = sender_ssrc;
702 remote_time_info_.last_rr = CompactNtp(rrtr.ntp()); 711 remote_time_info_.last_rr = CompactNtp(rrtr.ntp());
703 last_received_xr_ntp_.SetCurrent(*_clock); 712 last_received_xr_ntp_.SetCurrent(*_clock);
704 } 713 }
705 714
(...skipping 12 matching lines...) Expand all
718 if (send_time == 0) 727 if (send_time == 0)
719 return; 728 return;
720 729
721 uint32_t delay_rr = rti.delay_since_last_rr; 730 uint32_t delay_rr = rti.delay_since_last_rr;
722 uint32_t now = CompactNtp(NtpTime(*_clock)); 731 uint32_t now = CompactNtp(NtpTime(*_clock));
723 732
724 uint32_t rtt_ntp = now - delay_rr - send_time; 733 uint32_t rtt_ntp = now - delay_rr - send_time;
725 xr_rr_rtt_ms_ = CompactNtpRttToMs(rtt_ntp); 734 xr_rr_rtt_ms_ = CompactNtpRttToMs(rtt_ntp);
726 } 735 }
727 736
737 void RTCPReceiver::HandleXrTargetBitrate(
738 const rtcp::TargetBitrate& target_bitrate,
739 PacketInformation* packet_information) {
740 BitrateAllocation bitrate_allocation;
741 for (const auto& item : target_bitrate.GetTargetBitrates()) {
742 bitrate_allocation.SetBitrate(item.spatial_layer, item.temporal_layer,
743 item.target_bitrate_kbps * 1000);
744 }
745 packet_information->target_bitrate_allocation.emplace(bitrate_allocation);
746 }
747
728 void RTCPReceiver::HandlePLI(const CommonHeader& rtcp_block, 748 void RTCPReceiver::HandlePLI(const CommonHeader& rtcp_block,
729 PacketInformation* packet_information) { 749 PacketInformation* packet_information) {
730 rtcp::Pli pli; 750 rtcp::Pli pli;
731 if (!pli.Parse(rtcp_block)) { 751 if (!pli.Parse(rtcp_block)) {
732 ++num_skipped_packets_; 752 ++num_skipped_packets_;
733 return; 753 return;
734 } 754 }
735 755
736 if (main_ssrc_ == pli.media_ssrc()) { 756 if (main_ssrc_ == pli.media_ssrc()) {
737 TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "PLI"); 757 TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "PLI");
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 911
892 packet_information->packet_type_flags |= kRtcpTransportFeedback; 912 packet_information->packet_type_flags |= kRtcpTransportFeedback;
893 packet_information->transport_feedback = std::move(transport_feedback); 913 packet_information->transport_feedback = std::move(transport_feedback);
894 } 914 }
895 915
896 void RTCPReceiver::UpdateTmmbr() { 916 void RTCPReceiver::UpdateTmmbr() {
897 // Find bounding set. 917 // Find bounding set.
898 std::vector<rtcp::TmmbItem> bounding = 918 std::vector<rtcp::TmmbItem> bounding =
899 TMMBRHelp::FindBoundingSet(TmmbrReceived()); 919 TMMBRHelp::FindBoundingSet(TmmbrReceived());
900 920
901 if (!bounding.empty() && _cbRtcpBandwidthObserver) { 921 if (!bounding.empty() && rtcp_bandwidth_observer_) {
902 // We have a new bandwidth estimate on this channel. 922 // We have a new bandwidth estimate on this channel.
903 uint64_t bitrate_bps = TMMBRHelp::CalcMinBitrateBps(bounding); 923 uint64_t bitrate_bps = TMMBRHelp::CalcMinBitrateBps(bounding);
904 if (bitrate_bps <= std::numeric_limits<uint32_t>::max()) 924 if (bitrate_bps <= std::numeric_limits<uint32_t>::max())
905 _cbRtcpBandwidthObserver->OnReceivedEstimatedBitrate(bitrate_bps); 925 rtcp_bandwidth_observer_->OnReceivedEstimatedBitrate(bitrate_bps);
906 } 926 }
907 927
908 // Set bounding set: inform remote clients about the new bandwidth. 928 // Set bounding set: inform remote clients about the new bandwidth.
909 _rtpRtcp.SetTmmbn(std::move(bounding)); 929 _rtpRtcp.SetTmmbn(std::move(bounding));
910 } 930 }
911 931
912 void RTCPReceiver::RegisterRtcpStatisticsCallback( 932 void RTCPReceiver::RegisterRtcpStatisticsCallback(
913 RtcpStatisticsCallback* callback) { 933 RtcpStatisticsCallback* callback) {
914 rtc::CritScope cs(&_criticalSectionFeedbacks); 934 rtc::CritScope cs(&feedbacks_lock_);
915 stats_callback_ = callback; 935 stats_callback_ = callback;
916 } 936 }
917 937
918 RtcpStatisticsCallback* RTCPReceiver::GetRtcpStatisticsCallback() { 938 RtcpStatisticsCallback* RTCPReceiver::GetRtcpStatisticsCallback() {
919 rtc::CritScope cs(&_criticalSectionFeedbacks); 939 rtc::CritScope cs(&feedbacks_lock_);
920 return stats_callback_; 940 return stats_callback_;
921 } 941 }
922 942
923 // Holding no Critical section 943 // Holding no Critical section
924 void RTCPReceiver::TriggerCallbacksFromRTCPPacket( 944 void RTCPReceiver::TriggerCallbacksFromRTCPPacket(
925 const PacketInformation& packet_information) { 945 const PacketInformation& packet_information) {
926 // Process TMMBR and REMB first to avoid multiple callbacks 946 // Process TMMBR and REMB first to avoid multiple callbacks
927 // to OnNetworkChanged. 947 // to OnNetworkChanged.
928 if (packet_information.packet_type_flags & kRtcpTmmbr) { 948 if (packet_information.packet_type_flags & kRtcpTmmbr) {
929 // Might trigger a OnReceivedBandwidthEstimateUpdate. 949 // Might trigger a OnReceivedBandwidthEstimateUpdate.
(...skipping 10 matching lines...) Expand all
940 if (!receiver_only_ && (packet_information.packet_type_flags & kRtcpSrReq)) { 960 if (!receiver_only_ && (packet_information.packet_type_flags & kRtcpSrReq)) {
941 _rtpRtcp.OnRequestSendReport(); 961 _rtpRtcp.OnRequestSendReport();
942 } 962 }
943 if (!receiver_only_ && (packet_information.packet_type_flags & kRtcpNack)) { 963 if (!receiver_only_ && (packet_information.packet_type_flags & kRtcpNack)) {
944 if (!packet_information.nack_sequence_numbers.empty()) { 964 if (!packet_information.nack_sequence_numbers.empty()) {
945 LOG(LS_VERBOSE) << "Incoming NACK length: " 965 LOG(LS_VERBOSE) << "Incoming NACK length: "
946 << packet_information.nack_sequence_numbers.size(); 966 << packet_information.nack_sequence_numbers.size();
947 _rtpRtcp.OnReceivedNack(packet_information.nack_sequence_numbers); 967 _rtpRtcp.OnReceivedNack(packet_information.nack_sequence_numbers);
948 } 968 }
949 } 969 }
950 { 970
951 // We need feedback that we have received a report block(s) so that we 971 // 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 972 // can generate a new packet in a conference relay scenario, one received
953 // report can generate several RTCP packets, based on number relayed/mixed 973 // report can generate several RTCP packets, based on number relayed/mixed
954 // a send report block should go out to all receivers. 974 // a send report block should go out to all receivers.
955 if (_cbRtcpIntraFrameObserver) { 975 if (rtcp_intra_frame_observer_) {
956 RTC_DCHECK(!receiver_only_); 976 RTC_DCHECK(!receiver_only_);
957 if ((packet_information.packet_type_flags & kRtcpPli) || 977 if ((packet_information.packet_type_flags & kRtcpPli) ||
958 (packet_information.packet_type_flags & kRtcpFir)) { 978 (packet_information.packet_type_flags & kRtcpFir)) {
959 if (packet_information.packet_type_flags & kRtcpPli) { 979 if (packet_information.packet_type_flags & kRtcpPli) {
960 LOG(LS_VERBOSE) << "Incoming PLI from SSRC " 980 LOG(LS_VERBOSE) << "Incoming PLI from SSRC "
961 << packet_information.remote_ssrc; 981 << packet_information.remote_ssrc;
962 } else { 982 } else {
963 LOG(LS_VERBOSE) << "Incoming FIR from SSRC " 983 LOG(LS_VERBOSE) << "Incoming FIR from SSRC "
964 << packet_information.remote_ssrc; 984 << packet_information.remote_ssrc;
965 }
966 _cbRtcpIntraFrameObserver->OnReceivedIntraFrameRequest(local_ssrc);
967 } 985 }
968 if (packet_information.packet_type_flags & kRtcpSli) { 986 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 } 987 }
977 if (_cbRtcpBandwidthObserver) { 988 if (packet_information.packet_type_flags & kRtcpSli) {
978 RTC_DCHECK(!receiver_only_); 989 rtcp_intra_frame_observer_->OnReceivedSLI(
979 if (packet_information.packet_type_flags & kRtcpRemb) { 990 local_ssrc, packet_information.sli_picture_id);
980 LOG(LS_VERBOSE) 991 }
981 << "Incoming REMB: " 992 if (packet_information.packet_type_flags & kRtcpRpsi) {
982 << packet_information.receiver_estimated_max_bitrate_bps; 993 rtcp_intra_frame_observer_->OnReceivedRPSI(
983 _cbRtcpBandwidthObserver->OnReceivedEstimatedBitrate( 994 local_ssrc, packet_information.rpsi_picture_id);
984 packet_information.receiver_estimated_max_bitrate_bps); 995 }
985 } 996 }
986 if ((packet_information.packet_type_flags & kRtcpSr) || 997 if (rtcp_bandwidth_observer_) {
987 (packet_information.packet_type_flags & kRtcpRr)) { 998 RTC_DCHECK(!receiver_only_);
988 int64_t now = _clock->TimeInMilliseconds(); 999 if (packet_information.packet_type_flags & kRtcpRemb) {
989 _cbRtcpBandwidthObserver->OnReceivedRtcpReceiverReport( 1000 LOG(LS_VERBOSE) << "Incoming REMB: "
990 packet_information.report_blocks, packet_information.rtt_ms, now); 1001 << packet_information.receiver_estimated_max_bitrate_bps;
991 } 1002 rtcp_bandwidth_observer_->OnReceivedEstimatedBitrate(
1003 packet_information.receiver_estimated_max_bitrate_bps);
992 } 1004 }
993 if ((packet_information.packet_type_flags & kRtcpSr) || 1005 if ((packet_information.packet_type_flags & kRtcpSr) ||
994 (packet_information.packet_type_flags & kRtcpRr)) { 1006 (packet_information.packet_type_flags & kRtcpRr)) {
995 _rtpRtcp.OnReceivedRtcpReportBlocks(packet_information.report_blocks); 1007 int64_t now = _clock->TimeInMilliseconds();
1008 rtcp_bandwidth_observer_->OnReceivedRtcpReceiverReport(
1009 packet_information.report_blocks, packet_information.rtt_ms, now);
996 } 1010 }
1011 }
1012 if ((packet_information.packet_type_flags & kRtcpSr) ||
1013 (packet_information.packet_type_flags & kRtcpRr)) {
1014 _rtpRtcp.OnReceivedRtcpReportBlocks(packet_information.report_blocks);
1015 }
997 1016
998 if (_cbTransportFeedbackObserver && 1017 if (transport_feedback_observer_ &&
999 (packet_information.packet_type_flags & kRtcpTransportFeedback)) { 1018 (packet_information.packet_type_flags & kRtcpTransportFeedback)) {
1000 uint32_t media_source_ssrc = 1019 uint32_t media_source_ssrc =
1001 packet_information.transport_feedback->media_ssrc(); 1020 packet_information.transport_feedback->media_ssrc();
1002 if (media_source_ssrc == local_ssrc || 1021 if (media_source_ssrc == local_ssrc ||
1003 registered_ssrcs.find(media_source_ssrc) != registered_ssrcs.end()) { 1022 registered_ssrcs.find(media_source_ssrc) != registered_ssrcs.end()) {
1004 _cbTransportFeedbackObserver->OnTransportFeedback( 1023 transport_feedback_observer_->OnTransportFeedback(
1005 *packet_information.transport_feedback); 1024 *packet_information.transport_feedback);
1006 }
1007 } 1025 }
1008 } 1026 }
1009 1027
1028 if (bitrate_allocation_observer_ &&
1029 packet_information.target_bitrate_allocation) {
1030 bitrate_allocation_observer_->OnBitrateAllocationUpdated(
1031 *packet_information.target_bitrate_allocation);
1032 }
1033
1010 if (!receiver_only_) { 1034 if (!receiver_only_) {
1011 rtc::CritScope cs(&_criticalSectionFeedbacks); 1035 rtc::CritScope cs(&feedbacks_lock_);
1012 if (stats_callback_) { 1036 if (stats_callback_) {
1013 for (const auto& report_block : packet_information.report_blocks) { 1037 for (const auto& report_block : packet_information.report_blocks) {
1014 RtcpStatistics stats; 1038 RtcpStatistics stats;
1015 stats.cumulative_lost = report_block.cumulativeLost; 1039 stats.cumulative_lost = report_block.cumulativeLost;
1016 stats.extended_max_sequence_number = report_block.extendedHighSeqNum; 1040 stats.extended_max_sequence_number = report_block.extendedHighSeqNum;
1017 stats.fraction_lost = report_block.fractionLost; 1041 stats.fraction_lost = report_block.fractionLost;
1018 stats.jitter = report_block.jitter; 1042 stats.jitter = report_block.jitter;
1019 1043
1020 stats_callback_->StatisticsUpdated(stats, report_block.sourceSSRC); 1044 stats_callback_->StatisticsUpdated(stats, report_block.sourceSSRC);
1021 } 1045 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 } else { 1077 } else {
1054 candidates.push_back(it->second.tmmbr_item); 1078 candidates.push_back(it->second.tmmbr_item);
1055 ++it; 1079 ++it;
1056 } 1080 }
1057 } 1081 }
1058 } 1082 }
1059 return candidates; 1083 return candidates;
1060 } 1084 }
1061 1085
1062 } // namespace webrtc 1086 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698