Index: webrtc/modules/rtp_rtcp/source/rtcp_sender.cc |
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc |
index 4a509b001ea0db5d438268b6011a163096f6abee..a206510fb4cd9d7ddb1b23e2f1b4cf420929b068 100644 |
--- a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc |
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc |
@@ -169,9 +169,6 @@ RTCPSender::RTCPSender( |
remb_bitrate_(0), |
- tmmbr_help_(), |
- tmmbr_send_(0), |
- packet_oh_send_(0), |
max_payload_length_(IP_PACKET_SIZE - 28), // IPv4 + UDP by default. |
app_sub_type_(0), |
@@ -573,7 +570,7 @@ std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildREMB( |
void RTCPSender::SetTargetBitrate(unsigned int target_bitrate) { |
rtc::CritScope lock(&critical_section_rtcp_sender_); |
- tmmbr_send_ = target_bitrate / 1000; |
+ tmmbr_to_send_.set_bitrate_bps(target_bitrate); |
} |
std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBR( |
@@ -588,18 +585,18 @@ std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBR( |
// get current bounding set from RTCP receiver |
bool tmmbrOwner = false; |
// store in candidateSet, allocates one extra slot |
- TMMBRSet* candidateSet = tmmbr_help_.CandidateSet(); |
+ std::vector<rtcp::TmmbItem> candidates; |
// holding critical_section_rtcp_sender_ while calling RTCPreceiver which |
// will accuire criticalSectionRTCPReceiver_ is a potental deadlock but |
// since RTCPreceiver is not doing the reverse we should be fine |
int32_t lengthOfBoundingSet = |
- ctx.feedback_state_.module->BoundingSet(&tmmbrOwner, candidateSet); |
+ ctx.feedback_state_.module->BoundingSet(&tmmbrOwner, &candidates); |
if (lengthOfBoundingSet > 0) { |
for (int32_t i = 0; i < lengthOfBoundingSet; i++) { |
- if (candidateSet->Tmmbr(i) == tmmbr_send_ && |
- candidateSet->PacketOH(i) == packet_oh_send_) { |
+ if (candidates[i].bitrate_bps() == tmmbr_to_send_.bitrate_bps() && |
+ candidates[i].packet_overhead() == tmmbr_to_send_.packet_overhead()) { |
// Do not send the same tuple. |
return nullptr; |
} |
@@ -607,15 +604,17 @@ std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBR( |
if (!tmmbrOwner) { |
// use received bounding set as candidate set |
// add current tuple |
- candidateSet->SetEntry(lengthOfBoundingSet, tmmbr_send_, packet_oh_send_, |
- ssrc_); |
- int numCandidates = lengthOfBoundingSet + 1; |
+ tmmbr_to_send_.set_ssrc(ssrc_); |
+ candidates.push_back(tmmbr_to_send_); |
// find bounding set |
- TMMBRSet* boundingSet = nullptr; |
- int numBoundingSet = tmmbr_help_.FindTMMBRBoundingSet(boundingSet); |
- if (numBoundingSet > 0 || numBoundingSet <= numCandidates) |
- tmmbrOwner = tmmbr_help_.IsOwner(ssrc_, numBoundingSet); |
+ FindTMMBRBoundingSet(&candidates); |
+ for (const rtcp::TmmbItem& entry : candidates) { |
+ if (entry.ssrc() == ssrc_) { |
+ tmmbrOwner = true; |
+ break; |
+ } |
+ } |
if (!tmmbrOwner) { |
// Did not enter bounding set, no meaning to send this request. |
return nullptr; |
@@ -623,16 +622,13 @@ std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBR( |
} |
} |
- if (!tmmbr_send_) |
+ if (tmmbr_to_send_.bitrate_bps() == 0) |
return nullptr; |
rtcp::Tmmbr* tmmbr = new rtcp::Tmmbr(); |
tmmbr->From(ssrc_); |
- rtcp::TmmbItem request; |
- request.set_ssrc(remote_ssrc_); |
- request.set_bitrate_bps(tmmbr_send_ * 1000); |
- request.set_packet_overhead(packet_oh_send_); |
- tmmbr->WithTmmbr(request); |
+ tmmbr_to_send_.set_ssrc(remote_ssrc_); |
+ tmmbr->WithTmmbr(tmmbr_to_send_); |
return std::unique_ptr<rtcp::RtcpPacket>(tmmbr); |
} |
@@ -641,9 +637,9 @@ std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBN( |
const RtcpContext& ctx) { |
rtcp::Tmmbn* tmmbn = new rtcp::Tmmbn(); |
tmmbn->From(ssrc_); |
- for (const rtcp::TmmbItem& tmmbr : tmmbn_to_send_) { |
- if (tmmbr.bitrate_bps() > 0) { |
- tmmbn->WithTmmbr(tmmbr); |
+ for (const rtcp::TmmbItem& item : tmmbn_to_send_) { |
+ if (item.bitrate_bps() > 0) { |
+ tmmbn->WithTmmbr(item); |
} |
} |