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 |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" | 29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" |
30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.h" | 30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.h" |
31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.h" | 31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.h" |
32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h" | 32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h" |
33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h" | 33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h" |
34 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h" | 34 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h" |
35 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h" | 35 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h" |
36 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h" | 36 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h" |
37 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" | 37 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" |
38 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" | 38 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" |
| 39 #include "webrtc/modules/rtp_rtcp/source/tmmbr_help.h" |
39 | 40 |
40 namespace webrtc { | 41 namespace webrtc { |
41 | 42 |
42 NACKStringBuilder::NACKStringBuilder() | 43 NACKStringBuilder::NACKStringBuilder() |
43 : stream_(""), count_(0), prevNack_(0), consecutive_(false) {} | 44 : stream_(""), count_(0), prevNack_(0), consecutive_(false) {} |
44 | 45 |
45 NACKStringBuilder::~NACKStringBuilder() {} | 46 NACKStringBuilder::~NACKStringBuilder() {} |
46 | 47 |
47 void NACKStringBuilder::PushNACK(uint16_t nack) { | 48 void NACKStringBuilder::PushNACK(uint16_t nack) { |
48 if (count_ == 0) { | 49 if (count_ == 0) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 last_rtp_timestamp_(0), | 163 last_rtp_timestamp_(0), |
163 last_frame_capture_time_ms_(-1), | 164 last_frame_capture_time_ms_(-1), |
164 ssrc_(0), | 165 ssrc_(0), |
165 remote_ssrc_(0), | 166 remote_ssrc_(0), |
166 receive_statistics_(receive_statistics), | 167 receive_statistics_(receive_statistics), |
167 | 168 |
168 sequence_number_fir_(0), | 169 sequence_number_fir_(0), |
169 | 170 |
170 remb_bitrate_(0), | 171 remb_bitrate_(0), |
171 | 172 |
172 tmmbr_help_(), | |
173 tmmbr_send_(0), | 173 tmmbr_send_(0), |
174 packet_oh_send_(0), | 174 packet_oh_send_(0), |
175 max_payload_length_(IP_PACKET_SIZE - 28), // IPv4 + UDP by default. | 175 max_payload_length_(IP_PACKET_SIZE - 28), // IPv4 + UDP by default. |
176 | 176 |
177 app_sub_type_(0), | 177 app_sub_type_(0), |
178 app_name_(0), | 178 app_name_(0), |
179 app_data_(nullptr), | 179 app_data_(nullptr), |
180 app_length_(0), | 180 app_length_(0), |
181 | 181 |
182 xr_send_receiver_reference_time_enabled_(false), | 182 xr_send_receiver_reference_time_enabled_(false), |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 | 578 |
579 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBR( | 579 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBR( |
580 const RtcpContext& ctx) { | 580 const RtcpContext& ctx) { |
581 if (ctx.feedback_state_.module == nullptr) | 581 if (ctx.feedback_state_.module == nullptr) |
582 return nullptr; | 582 return nullptr; |
583 // Before sending the TMMBR check the received TMMBN, only an owner is | 583 // Before sending the TMMBR check the received TMMBN, only an owner is |
584 // allowed to raise the bitrate: | 584 // allowed to raise the bitrate: |
585 // * If the sender is an owner of the TMMBN -> send TMMBR | 585 // * If the sender is an owner of the TMMBN -> send TMMBR |
586 // * If not an owner but the TMMBR would enter the TMMBN -> send TMMBR | 586 // * If not an owner but the TMMBR would enter the TMMBN -> send TMMBR |
587 | 587 |
| 588 TMMBRHelp tmmbr_help; |
588 // get current bounding set from RTCP receiver | 589 // get current bounding set from RTCP receiver |
589 bool tmmbrOwner = false; | 590 bool tmmbrOwner = false; |
590 // store in candidateSet, allocates one extra slot | 591 // store in candidateSet, allocates one extra slot |
591 TMMBRSet* candidateSet = tmmbr_help_.CandidateSet(); | 592 TMMBRSet* candidateSet = tmmbr_help.CandidateSet(); |
592 | 593 |
593 // holding critical_section_rtcp_sender_ while calling RTCPreceiver which | 594 // holding critical_section_rtcp_sender_ while calling RTCPreceiver which |
594 // will accuire criticalSectionRTCPReceiver_ is a potental deadlock but | 595 // will accuire criticalSectionRTCPReceiver_ is a potental deadlock but |
595 // since RTCPreceiver is not doing the reverse we should be fine | 596 // since RTCPreceiver is not doing the reverse we should be fine |
596 int32_t lengthOfBoundingSet = | 597 int32_t lengthOfBoundingSet = |
597 ctx.feedback_state_.module->BoundingSet(&tmmbrOwner, candidateSet); | 598 ctx.feedback_state_.module->BoundingSet(&tmmbrOwner, candidateSet); |
598 | 599 |
599 if (lengthOfBoundingSet > 0) { | 600 if (lengthOfBoundingSet > 0) { |
600 for (int32_t i = 0; i < lengthOfBoundingSet; i++) { | 601 for (int32_t i = 0; i < lengthOfBoundingSet; i++) { |
601 if (candidateSet->Tmmbr(i) == tmmbr_send_ && | 602 if (candidateSet->Tmmbr(i) == tmmbr_send_ && |
602 candidateSet->PacketOH(i) == packet_oh_send_) { | 603 candidateSet->PacketOH(i) == packet_oh_send_) { |
603 // Do not send the same tuple. | 604 // Do not send the same tuple. |
604 return nullptr; | 605 return nullptr; |
605 } | 606 } |
606 } | 607 } |
607 if (!tmmbrOwner) { | 608 if (!tmmbrOwner) { |
608 // use received bounding set as candidate set | 609 // use received bounding set as candidate set |
609 // add current tuple | 610 // add current tuple |
610 candidateSet->SetEntry(lengthOfBoundingSet, tmmbr_send_, packet_oh_send_, | 611 candidateSet->SetEntry(lengthOfBoundingSet, tmmbr_send_, packet_oh_send_, |
611 ssrc_); | 612 ssrc_); |
612 int numCandidates = lengthOfBoundingSet + 1; | 613 int numCandidates = lengthOfBoundingSet + 1; |
613 | 614 |
614 // find bounding set | 615 // find bounding set |
615 TMMBRSet* boundingSet = nullptr; | 616 TMMBRSet* boundingSet = nullptr; |
616 int numBoundingSet = tmmbr_help_.FindTMMBRBoundingSet(boundingSet); | 617 int numBoundingSet = tmmbr_help.FindTMMBRBoundingSet(boundingSet); |
617 if (numBoundingSet > 0 || numBoundingSet <= numCandidates) | 618 if (numBoundingSet > 0 || numBoundingSet <= numCandidates) |
618 tmmbrOwner = tmmbr_help_.IsOwner(ssrc_, numBoundingSet); | 619 tmmbrOwner = tmmbr_help.IsOwner(ssrc_, numBoundingSet); |
619 if (!tmmbrOwner) { | 620 if (!tmmbrOwner) { |
620 // Did not enter bounding set, no meaning to send this request. | 621 // Did not enter bounding set, no meaning to send this request. |
621 return nullptr; | 622 return nullptr; |
622 } | 623 } |
623 } | 624 } |
624 } | 625 } |
625 | 626 |
626 if (!tmmbr_send_) | 627 if (!tmmbr_send_) |
627 return nullptr; | 628 return nullptr; |
628 | 629 |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 // but we can't because of an incorrect warning (C4822) in MVS 2013. | 1037 // but we can't because of an incorrect warning (C4822) in MVS 2013. |
1037 } sender(transport_, event_log_); | 1038 } sender(transport_, event_log_); |
1038 | 1039 |
1039 RTC_DCHECK_LE(max_payload_length_, static_cast<size_t>(IP_PACKET_SIZE)); | 1040 RTC_DCHECK_LE(max_payload_length_, static_cast<size_t>(IP_PACKET_SIZE)); |
1040 uint8_t buffer[IP_PACKET_SIZE]; | 1041 uint8_t buffer[IP_PACKET_SIZE]; |
1041 return packet.BuildExternalBuffer(buffer, max_payload_length_, &sender) && | 1042 return packet.BuildExternalBuffer(buffer, max_payload_length_, &sender) && |
1042 !sender.send_failure_; | 1043 !sender.send_failure_; |
1043 } | 1044 } |
1044 | 1045 |
1045 } // namespace webrtc | 1046 } // namespace webrtc |
OLD | NEW |