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

Unified Diff: webrtc/modules/rtp_rtcp/source/rtcp_sender.cc

Issue 2254703003: Remove TMMBRSet class (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Feedback Created 4 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_sender.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5365d19abb7627d606368b5d6018798b982fc93e..bd34700fa6db538e5e2771520aff984d07023121 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
@@ -172,7 +172,7 @@ RTCPSender::RTCPSender(
remb_bitrate_(0),
- tmmbr_send_(0),
+ tmmbr_send_bps_(0),
packet_oh_send_(0),
max_payload_length_(IP_PACKET_SIZE - 28), // IPv4 + UDP by default.
@@ -577,7 +577,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_send_bps_ = target_bitrate;
}
std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBR(
@@ -590,48 +590,46 @@ std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBR(
// * If not an owner but the TMMBR would enter the TMMBN -> send TMMBR
// get current bounding set from RTCP receiver
- bool tmmbrOwner = false;
- TMMBRSet candidates;
+ bool tmmbr_owner = false;
// 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, &candidates);
+ std::vector<rtcp::TmmbItem> candidates =
+ ctx.feedback_state_.module->BoundingSet(&tmmbr_owner);
- if (lengthOfBoundingSet > 0) {
- for (int32_t i = 0; i < lengthOfBoundingSet; i++) {
- if (candidates.Tmmbr(i) == tmmbr_send_ &&
- candidates.PacketOH(i) == packet_oh_send_) {
+ if (!candidates.empty()) {
+ for (const auto& candidate : candidates) {
+ if (candidate.bitrate_bps() == tmmbr_send_bps_ &&
+ candidate.packet_overhead() == packet_oh_send_) {
// Do not send the same tuple.
return nullptr;
}
}
- if (!tmmbrOwner) {
- // use received bounding set as candidate set
- // add current tuple
- candidates.SetEntry(lengthOfBoundingSet, tmmbr_send_, packet_oh_send_,
- ssrc_);
+ if (!tmmbr_owner) {
+ // Use received bounding set as candidate set.
+ // Add current tuple.
+ candidates.emplace_back(ssrc_, tmmbr_send_bps_, packet_oh_send_);
- // find bounding set
+ // Find bounding set.
std::vector<rtcp::TmmbItem> bounding =
TMMBRHelp::FindBoundingSet(std::move(candidates));
- tmmbrOwner = TMMBRHelp::IsOwner(bounding, ssrc_);
- if (!tmmbrOwner) {
+ tmmbr_owner = TMMBRHelp::IsOwner(bounding, ssrc_);
+ if (!tmmbr_owner) {
// Did not enter bounding set, no meaning to send this request.
return nullptr;
}
}
}
- if (!tmmbr_send_)
+ if (!tmmbr_send_bps_)
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_bitrate_bps(tmmbr_send_bps_);
request.set_packet_overhead(packet_oh_send_);
tmmbr->WithTmmbr(request);
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_sender.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698