niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
pwestin@webrtc.org | f6bb77a | 2012-01-24 17:16:59 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #include "modules/rtp_rtcp/source/rtp_rtcp_impl.h" |
mflodman@webrtc.org | 2f225ca | 2013-01-09 13:54:43 +0000 | [diff] [blame] | 12 | |
pbos@webrtc.org | a048d7c | 2013-05-29 14:27:38 +0000 | [diff] [blame] | 13 | #include <string.h> |
sprang | 168794c | 2017-07-06 04:38:06 -0700 | [diff] [blame] | 14 | #include <algorithm> |
Yves Gerey | 988cc08 | 2018-10-23 12:03:01 +0200 | [diff] [blame] | 15 | #include <cstdint> |
mflodman@webrtc.org | 02270cd | 2015-02-06 13:10:19 +0000 | [diff] [blame] | 16 | #include <set> |
Peter Boström | 9c01725 | 2016-02-26 16:26:20 +0100 | [diff] [blame] | 17 | #include <string> |
Yves Gerey | 988cc08 | 2018-10-23 12:03:01 +0200 | [diff] [blame] | 18 | #include <utility> |
mflodman@webrtc.org | 02270cd | 2015-02-06 13:10:19 +0000 | [diff] [blame] | 19 | |
Niels Möller | 59ab1cf | 2019-02-06 22:48:11 +0100 | [diff] [blame] | 20 | #include "absl/memory/memory.h" |
Per Kjellander | e11b7d2 | 2019-02-21 07:55:59 +0100 | [diff] [blame] | 21 | #include "api/transport/field_trial_based_config.h" |
Yves Gerey | 988cc08 | 2018-10-23 12:03:01 +0200 | [diff] [blame] | 22 | #include "modules/rtp_rtcp/source/rtcp_packet/dlrr.h" |
| 23 | #include "modules/rtp_rtcp/source/rtp_rtcp_config.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 24 | #include "rtc_base/checks.h" |
| 25 | #include "rtc_base/logging.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 26 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 27 | #ifdef _WIN32 |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 28 | // Disable warning C4355: 'this' : used in base member initializer list. |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 29 | #pragma warning(disable : 4355) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 30 | #endif |
| 31 | |
| 32 | namespace webrtc { |
sprang | 168794c | 2017-07-06 04:38:06 -0700 | [diff] [blame] | 33 | namespace { |
| 34 | const int64_t kRtpRtcpMaxIdleTimeProcessMs = 5; |
| 35 | const int64_t kRtpRtcpRttProcessTimeMs = 1000; |
| 36 | const int64_t kRtpRtcpBitrateProcessTimeMs = 10; |
sprang | a8ae6f2 | 2017-09-04 07:23:56 -0700 | [diff] [blame] | 37 | const int64_t kDefaultExpectedRetransmissionTimeMs = 125; |
Jiawei Ou | 8b5d9d8 | 2018-11-15 16:44:37 -0800 | [diff] [blame] | 38 | constexpr int32_t kDefaultVideoReportInterval = 1000; |
| 39 | constexpr int32_t kDefaultAudioReportInterval = 5000; |
sprang | 168794c | 2017-07-06 04:38:06 -0700 | [diff] [blame] | 40 | } // namespace |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 41 | |
danilchap | d3f3c34 | 2017-07-25 04:20:12 -0700 | [diff] [blame] | 42 | RtpRtcp::Configuration::Configuration() = default; |
phoglund@webrtc.org | a22a9bd | 2013-01-14 10:01:55 +0000 | [diff] [blame] | 43 | |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 44 | RtpRtcp* RtpRtcp::CreateRtpRtcp(const RtpRtcp::Configuration& configuration) { |
| 45 | if (configuration.clock) { |
| 46 | return new ModuleRtpRtcpImpl(configuration); |
henrike@webrtc.org | f5da4da | 2012-02-15 23:54:59 +0000 | [diff] [blame] | 47 | } else { |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 48 | // No clock implementation provided, use default clock. |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 49 | RtpRtcp::Configuration configuration_copy; |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 50 | memcpy(&configuration_copy, &configuration, sizeof(RtpRtcp::Configuration)); |
stefan@webrtc.org | 20ed36d | 2013-01-17 14:01:20 +0000 | [diff] [blame] | 51 | configuration_copy.clock = Clock::GetRealTimeClock(); |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 52 | return new ModuleRtpRtcpImpl(configuration_copy); |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 53 | } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 54 | } |
| 55 | |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 56 | ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration) |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 57 | : rtcp_sender_(configuration.audio, |
stefan@webrtc.org | a15fbfd | 2014-06-17 17:32:05 +0000 | [diff] [blame] | 58 | configuration.clock, |
pbos@webrtc.org | 1d0fa5d | 2015-02-19 12:47:00 +0000 | [diff] [blame] | 59 | configuration.receive_statistics, |
sprang | 86fd9ed | 2015-09-29 04:45:43 -0700 | [diff] [blame] | 60 | configuration.rtcp_packet_type_counter_observer, |
terelius | 429c345 | 2016-01-21 05:42:04 -0800 | [diff] [blame] | 61 | configuration.event_log, |
Jiawei Ou | 3587b83 | 2018-01-31 22:08:26 -0800 | [diff] [blame] | 62 | configuration.outgoing_transport, |
Jiawei Ou | 8b5d9d8 | 2018-11-15 16:44:37 -0800 | [diff] [blame] | 63 | configuration.rtcp_report_interval_ms > 0 |
| 64 | ? configuration.rtcp_report_interval_ms |
| 65 | : (configuration.audio ? kDefaultAudioReportInterval |
| 66 | : kDefaultVideoReportInterval)), |
Peter Boström | ac547a6 | 2015-09-17 23:03:57 +0200 | [diff] [blame] | 67 | rtcp_receiver_(configuration.clock, |
Peter Boström | fe7a80c | 2015-04-23 17:53:17 +0200 | [diff] [blame] | 68 | configuration.receiver_only, |
pbos@webrtc.org | 1d0fa5d | 2015-02-19 12:47:00 +0000 | [diff] [blame] | 69 | configuration.rtcp_packet_type_counter_observer, |
mflodman@webrtc.org | 96abda0 | 2015-02-25 13:50:10 +0000 | [diff] [blame] | 70 | configuration.bandwidth_callback, |
| 71 | configuration.intra_frame_callback, |
Erik Språng | 6b8d355 | 2015-09-24 15:06:57 +0200 | [diff] [blame] | 72 | configuration.transport_feedback_callback, |
sprang | a790d83 | 2016-12-02 07:29:44 -0800 | [diff] [blame] | 73 | configuration.bitrate_allocation_observer, |
Jiawei Ou | 8b5d9d8 | 2018-11-15 16:44:37 -0800 | [diff] [blame] | 74 | configuration.rtcp_report_interval_ms > 0 |
| 75 | ? configuration.rtcp_report_interval_ms |
| 76 | : (configuration.audio ? kDefaultAudioReportInterval |
| 77 | : kDefaultVideoReportInterval), |
pbos@webrtc.org | 1d0fa5d | 2015-02-19 12:47:00 +0000 | [diff] [blame] | 78 | this), |
stefan@webrtc.org | a678a3b | 2013-01-21 07:42:11 +0000 | [diff] [blame] | 79 | clock_(configuration.clock), |
sprang | 168794c | 2017-07-06 04:38:06 -0700 | [diff] [blame] | 80 | keepalive_config_(configuration.keepalive_config), |
| 81 | last_bitrate_process_time_(clock_->TimeInMilliseconds()), |
| 82 | last_rtt_process_time_(clock_->TimeInMilliseconds()), |
| 83 | next_process_time_(clock_->TimeInMilliseconds() + |
| 84 | kRtpRtcpMaxIdleTimeProcessMs), |
| 85 | next_keepalive_time_(-1), |
asapersson | 35151f3 | 2016-05-02 23:44:01 -0700 | [diff] [blame] | 86 | packet_overhead_(28), // IPV4 UDP. |
Danil Chapovalov | 9eb6ce1 | 2017-12-15 12:25:01 +0100 | [diff] [blame] | 87 | nack_last_time_sent_full_ms_(0), |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 88 | nack_last_seq_number_sent_(0), |
Peter Boström | e23e737 | 2015-10-08 11:44:14 +0200 | [diff] [blame] | 89 | key_frame_req_method_(kKeyFrameReqPliRtcp), |
mflodman@webrtc.org | 7c894b7 | 2012-11-26 12:40:15 +0000 | [diff] [blame] | 90 | remote_bitrate_(configuration.remote_bitrate_estimator), |
Niels Möller | 5fe9510 | 2019-03-04 16:49:25 +0100 | [diff] [blame] | 91 | ack_observer_(configuration.ack_observer), |
asapersson@webrtc.org | 1ae1d0c | 2013-11-20 12:46:11 +0000 | [diff] [blame] | 92 | rtt_stats_(configuration.rtt_stats), |
asapersson@webrtc.org | 1ae1d0c | 2013-11-20 12:46:11 +0000 | [diff] [blame] | 93 | rtt_ms_(0) { |
Per Kjellander | e11b7d2 | 2019-02-21 07:55:59 +0100 | [diff] [blame] | 94 | FieldTrialBasedConfig default_trials; |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 95 | if (!configuration.receiver_only) { |
| 96 | rtp_sender_.reset(new RTPSender( |
Erik Språng | 7b52f10 | 2018-02-07 14:37:37 +0100 | [diff] [blame] | 97 | configuration.audio, configuration.clock, |
| 98 | configuration.outgoing_transport, configuration.paced_sender, |
Niels Möller | 59ab1cf | 2019-02-06 22:48:11 +0100 | [diff] [blame] | 99 | configuration.flexfec_sender |
| 100 | ? absl::make_optional(configuration.flexfec_sender->ssrc()) |
| 101 | : absl::nullopt, |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 102 | configuration.transport_sequence_number_allocator, |
| 103 | configuration.transport_feedback_callback, |
| 104 | configuration.send_bitrate_observer, |
Erik Språng | 7b52f10 | 2018-02-07 14:37:37 +0100 | [diff] [blame] | 105 | configuration.send_side_delay_observer, configuration.event_log, |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 106 | configuration.send_packet_observer, |
| 107 | configuration.retransmission_rate_limiter, |
Erik Språng | 7b52f10 | 2018-02-07 14:37:37 +0100 | [diff] [blame] | 108 | configuration.overhead_observer, |
Benjamin Wright | 192eeec | 2018-10-17 17:27:25 -0700 | [diff] [blame] | 109 | configuration.populate_network2_timestamp, |
Johannes Kron | 9190b82 | 2018-10-29 11:22:05 +0100 | [diff] [blame] | 110 | configuration.frame_encryptor, configuration.require_frame_encryption, |
Per Kjellander | e11b7d2 | 2019-02-21 07:55:59 +0100 | [diff] [blame] | 111 | configuration.extmap_allow_mixed, |
| 112 | configuration.field_trials ? *configuration.field_trials |
| 113 | : default_trials)); |
Niels Möller | 59ab1cf | 2019-02-06 22:48:11 +0100 | [diff] [blame] | 114 | if (configuration.audio) { |
| 115 | audio_ = absl::make_unique<RTPSenderAudio>(clock_, rtp_sender_.get()); |
Niels Möller | 59ab1cf | 2019-02-06 22:48:11 +0100 | [diff] [blame] | 116 | } |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 117 | // Make sure rtcp sender use same timestamp offset as rtp sender. |
| 118 | rtcp_sender_.SetTimestampOffset(rtp_sender_->TimestampOffset()); |
sprang | 168794c | 2017-07-06 04:38:06 -0700 | [diff] [blame] | 119 | |
| 120 | if (keepalive_config_.timeout_interval_ms != -1) { |
| 121 | next_keepalive_time_ = |
| 122 | clock_->TimeInMilliseconds() + keepalive_config_.timeout_interval_ms; |
| 123 | } |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 124 | } |
danilchap | 71fead2 | 2016-08-18 02:01:49 -0700 | [diff] [blame] | 125 | |
| 126 | // Set default packet size limit. |
nisse | 284542b | 2017-01-10 08:58:32 -0800 | [diff] [blame] | 127 | // TODO(nisse): Kind-of duplicates |
| 128 | // webrtc::VideoSendStream::Config::Rtp::kDefaultMaxPacketSize. |
| 129 | const size_t kTcpOverIpv4HeaderSize = 40; |
| 130 | SetMaxRtpPacketSize(IP_PACKET_SIZE - kTcpOverIpv4HeaderSize); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 131 | } |
| 132 | |
Danil Chapovalov | 2a5ce2b | 2018-02-07 09:38:31 +0100 | [diff] [blame] | 133 | ModuleRtpRtcpImpl::~ModuleRtpRtcpImpl() = default; |
| 134 | |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 135 | // Returns the number of milliseconds until the module want a worker thread |
| 136 | // to call Process. |
pkasting@chromium.org | 0b1534c | 2014-12-15 22:09:40 +0000 | [diff] [blame] | 137 | int64_t ModuleRtpRtcpImpl::TimeUntilNextProcess() { |
sprang | 168794c | 2017-07-06 04:38:06 -0700 | [diff] [blame] | 138 | return std::max<int64_t>(0, |
| 139 | next_process_time_ - clock_->TimeInMilliseconds()); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 140 | } |
| 141 | |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 142 | // Process any pending tasks such as timeouts (non time critical events). |
pbos | a26ac92 | 2016-02-25 04:50:01 -0800 | [diff] [blame] | 143 | void ModuleRtpRtcpImpl::Process() { |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 144 | const int64_t now = clock_->TimeInMilliseconds(); |
sprang | 168794c | 2017-07-06 04:38:06 -0700 | [diff] [blame] | 145 | next_process_time_ = now + kRtpRtcpMaxIdleTimeProcessMs; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 146 | |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 147 | if (rtp_sender_) { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 148 | if (now >= last_bitrate_process_time_ + kRtpRtcpBitrateProcessTimeMs) { |
| 149 | rtp_sender_->ProcessBitrate(); |
| 150 | last_bitrate_process_time_ = now; |
sprang | 168794c | 2017-07-06 04:38:06 -0700 | [diff] [blame] | 151 | next_process_time_ = |
| 152 | std::min(next_process_time_, now + kRtpRtcpBitrateProcessTimeMs); |
| 153 | } |
| 154 | if (keepalive_config_.timeout_interval_ms > 0 && |
| 155 | now >= next_keepalive_time_) { |
| 156 | int64_t last_send_time_ms = rtp_sender_->LastTimestampTimeMs(); |
| 157 | // If no packet has been sent, |last_send_time_ms| will be 0, and so the |
| 158 | // keep-alive will be triggered as expected. |
| 159 | if (now >= last_send_time_ms + keepalive_config_.timeout_interval_ms) { |
| 160 | rtp_sender_->SendKeepAlive(keepalive_config_.payload_type); |
| 161 | next_keepalive_time_ = now + keepalive_config_.timeout_interval_ms; |
| 162 | } else { |
| 163 | next_keepalive_time_ = |
| 164 | last_send_time_ms + keepalive_config_.timeout_interval_ms; |
| 165 | } |
| 166 | next_process_time_ = std::min(next_process_time_, next_keepalive_time_); |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 167 | } |
asapersson@webrtc.org | 0b3c35a | 2012-01-16 11:06:31 +0000 | [diff] [blame] | 168 | } |
sprang | 168794c | 2017-07-06 04:38:06 -0700 | [diff] [blame] | 169 | |
mflodman@webrtc.org | 9dd0ebc | 2015-02-26 12:57:47 +0000 | [diff] [blame] | 170 | bool process_rtt = now >= last_rtt_process_time_ + kRtpRtcpRttProcessTimeMs; |
| 171 | if (rtcp_sender_.Sending()) { |
Danil Chapovalov | 760c4b4 | 2017-09-27 13:25:24 +0200 | [diff] [blame] | 172 | // Process RTT if we have received a report block and we haven't |
mflodman@webrtc.org | 9dd0ebc | 2015-02-26 12:57:47 +0000 | [diff] [blame] | 173 | // processed RTT for at least |kRtpRtcpRttProcessTimeMs| milliseconds. |
Danil Chapovalov | 760c4b4 | 2017-09-27 13:25:24 +0200 | [diff] [blame] | 174 | if (rtcp_receiver_.LastReceivedReportBlockMs() > last_rtt_process_time_ && |
| 175 | process_rtt) { |
mflodman@webrtc.org | 9dd0ebc | 2015-02-26 12:57:47 +0000 | [diff] [blame] | 176 | std::vector<RTCPReportBlock> receive_blocks; |
| 177 | rtcp_receiver_.StatisticsReceived(&receive_blocks); |
| 178 | int64_t max_rtt = 0; |
| 179 | for (std::vector<RTCPReportBlock>::iterator it = receive_blocks.begin(); |
| 180 | it != receive_blocks.end(); ++it) { |
| 181 | int64_t rtt = 0; |
srte | 3e69e5c | 2017-08-09 06:13:45 -0700 | [diff] [blame] | 182 | rtcp_receiver_.RTT(it->sender_ssrc, &rtt, NULL, NULL, NULL); |
mflodman@webrtc.org | 9dd0ebc | 2015-02-26 12:57:47 +0000 | [diff] [blame] | 183 | max_rtt = (rtt > max_rtt) ? rtt : max_rtt; |
mflodman@webrtc.org | d7d4688 | 2012-02-14 12:49:59 +0000 | [diff] [blame] | 184 | } |
mflodman@webrtc.org | 9dd0ebc | 2015-02-26 12:57:47 +0000 | [diff] [blame] | 185 | // Report the rtt. |
| 186 | if (rtt_stats_ && max_rtt != 0) |
| 187 | rtt_stats_->OnRttUpdate(max_rtt); |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 188 | } |
asapersson@webrtc.org | 7d6bd22 | 2013-10-31 12:14:34 +0000 | [diff] [blame] | 189 | |
mflodman@webrtc.org | 9dd0ebc | 2015-02-26 12:57:47 +0000 | [diff] [blame] | 190 | // Verify receiver reports are delivered and the reported sequence number |
| 191 | // is increasing. |
Jiawei Ou | 8b5d9d8 | 2018-11-15 16:44:37 -0800 | [diff] [blame] | 192 | if (rtcp_receiver_.RtcpRrTimeout()) { |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 193 | RTC_LOG_F(LS_WARNING) << "Timeout: No RTCP RR received."; |
Jiawei Ou | 8b5d9d8 | 2018-11-15 16:44:37 -0800 | [diff] [blame] | 194 | } else if (rtcp_receiver_.RtcpRrSequenceNumberTimeout()) { |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 195 | RTC_LOG_F(LS_WARNING) << "Timeout: No increase in RTCP RR extended " |
| 196 | "highest sequence number."; |
mflodman@webrtc.org | 9dd0ebc | 2015-02-26 12:57:47 +0000 | [diff] [blame] | 197 | } |
| 198 | |
| 199 | if (remote_bitrate_ && rtcp_sender_.TMMBR()) { |
| 200 | unsigned int target_bitrate = 0; |
| 201 | std::vector<unsigned int> ssrcs; |
| 202 | if (remote_bitrate_->LatestEstimate(&ssrcs, &target_bitrate)) { |
| 203 | if (!ssrcs.empty()) { |
| 204 | target_bitrate = target_bitrate / ssrcs.size(); |
| 205 | } |
| 206 | rtcp_sender_.SetTargetBitrate(target_bitrate); |
| 207 | } |
| 208 | } |
| 209 | } else { |
| 210 | // Report rtt from receiver. |
asapersson@webrtc.org | 7d6bd22 | 2013-10-31 12:14:34 +0000 | [diff] [blame] | 211 | if (process_rtt) { |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 212 | int64_t rtt_ms; |
| 213 | if (rtt_stats_ && rtcp_receiver_.GetAndResetXrRrRtt(&rtt_ms)) { |
| 214 | rtt_stats_->OnRttUpdate(rtt_ms); |
| 215 | } |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 216 | } |
asapersson@webrtc.org | 0b3c35a | 2012-01-16 11:06:31 +0000 | [diff] [blame] | 217 | } |
| 218 | |
mflodman@webrtc.org | 9dd0ebc | 2015-02-26 12:57:47 +0000 | [diff] [blame] | 219 | // Get processed rtt. |
| 220 | if (process_rtt) { |
| 221 | last_rtt_process_time_ = now; |
sprang | 168794c | 2017-07-06 04:38:06 -0700 | [diff] [blame] | 222 | next_process_time_ = std::min( |
| 223 | next_process_time_, last_rtt_process_time_ + kRtpRtcpRttProcessTimeMs); |
sprang | e2d83d6 | 2016-02-19 09:03:26 -0800 | [diff] [blame] | 224 | if (rtt_stats_) { |
| 225 | // Make sure we have a valid RTT before setting. |
| 226 | int64_t last_rtt = rtt_stats_->LastProcessedRtt(); |
| 227 | if (last_rtt >= 0) |
| 228 | set_rtt_ms(last_rtt); |
| 229 | } |
mflodman@webrtc.org | 9dd0ebc | 2015-02-26 12:57:47 +0000 | [diff] [blame] | 230 | } |
| 231 | |
Danil Chapovalov | 70ffead | 2016-07-20 15:26:59 +0200 | [diff] [blame] | 232 | if (rtcp_sender_.TimeToSendRTCPReport()) |
| 233 | rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport); |
mflodman@webrtc.org | 9dd0ebc | 2015-02-26 12:57:47 +0000 | [diff] [blame] | 234 | |
danilchap | 9bf610e | 2017-02-20 06:03:01 -0800 | [diff] [blame] | 235 | if (TMMBR() && rtcp_receiver_.UpdateTmmbrTimers()) { |
| 236 | rtcp_receiver_.NotifyTmmbrUpdated(); |
asapersson@webrtc.org | 0b3c35a | 2012-01-16 11:06:31 +0000 | [diff] [blame] | 237 | } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 238 | } |
| 239 | |
pbos@webrtc.org | 0b0c241 | 2015-01-13 14:15:15 +0000 | [diff] [blame] | 240 | void ModuleRtpRtcpImpl::SetRtxSendStatus(int mode) { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 241 | rtp_sender_->SetRtxStatus(mode); |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 242 | } |
| 243 | |
pbos@webrtc.org | 0b0c241 | 2015-01-13 14:15:15 +0000 | [diff] [blame] | 244 | int ModuleRtpRtcpImpl::RtxSendStatus() const { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 245 | return rtp_sender_ ? rtp_sender_->RtxStatus() : kRtxOff; |
stefan@webrtc.org | ef92755 | 2014-06-05 08:25:29 +0000 | [diff] [blame] | 246 | } |
| 247 | |
| 248 | void ModuleRtpRtcpImpl::SetRtxSsrc(uint32_t ssrc) { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 249 | rtp_sender_->SetRtxSsrc(ssrc); |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 250 | } |
| 251 | |
Shao Changbin | e62202f | 2015-04-21 20:24:50 +0800 | [diff] [blame] | 252 | void ModuleRtpRtcpImpl::SetRtxSendPayloadType(int payload_type, |
| 253 | int associated_payload_type) { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 254 | rtp_sender_->SetRtxPayloadType(payload_type, associated_payload_type); |
mflodman@webrtc.org | 9f5ebb5 | 2013-04-12 14:55:46 +0000 | [diff] [blame] | 255 | } |
| 256 | |
Danil Chapovalov | d264df5 | 2018-06-14 12:59:38 +0200 | [diff] [blame] | 257 | absl::optional<uint32_t> ModuleRtpRtcpImpl::FlexfecSsrc() const { |
brandtr | 7c7796b | 2017-07-03 06:02:53 -0700 | [diff] [blame] | 258 | if (rtp_sender_) |
| 259 | return rtp_sender_->FlexfecSsrc(); |
Danil Chapovalov | d264df5 | 2018-06-14 12:59:38 +0200 | [diff] [blame] | 260 | return absl::nullopt; |
brandtr | 9dfff29 | 2016-11-14 05:14:50 -0800 | [diff] [blame] | 261 | } |
| 262 | |
nisse | 479d3d7 | 2017-09-13 07:53:37 -0700 | [diff] [blame] | 263 | void ModuleRtpRtcpImpl::IncomingRtcpPacket(const uint8_t* rtcp_packet, |
| 264 | const size_t length) { |
| 265 | rtcp_receiver_.IncomingPacket(rtcp_packet, length); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 266 | } |
| 267 | |
Fredrik Solenberg | 18f0c3c | 2018-12-06 11:49:35 +0100 | [diff] [blame] | 268 | void ModuleRtpRtcpImpl::RegisterAudioSendPayload(int payload_type, |
| 269 | absl::string_view payload_name, |
| 270 | int frequency, |
| 271 | int channels, |
| 272 | int rate) { |
Niels Möller | 59ab1cf | 2019-02-06 22:48:11 +0100 | [diff] [blame] | 273 | RTC_DCHECK(audio_); |
Fredrik Solenberg | 18f0c3c | 2018-12-06 11:49:35 +0100 | [diff] [blame] | 274 | rtcp_sender_.SetRtpClockRate(payload_type, frequency); |
Niels Möller | 59ab1cf | 2019-02-06 22:48:11 +0100 | [diff] [blame] | 275 | RTC_CHECK_EQ(0, audio_->RegisterAudioPayload(payload_name, payload_type, |
| 276 | frequency, channels, rate)); |
Fredrik Solenberg | 18f0c3c | 2018-12-06 11:49:35 +0100 | [diff] [blame] | 277 | } |
| 278 | |
Niels Möller | 5fe9510 | 2019-03-04 16:49:25 +0100 | [diff] [blame] | 279 | void ModuleRtpRtcpImpl::RegisterSendPayloadFrequency(int payload_type, |
| 280 | int payload_frequency) { |
| 281 | rtcp_sender_.SetRtpClockRate(payload_type, payload_frequency); |
Peter Boström | 8b79b07 | 2016-02-26 16:31:37 +0100 | [diff] [blame] | 282 | } |
| 283 | |
asapersson@webrtc.org | 9ffd8fe | 2015-01-21 08:22:50 +0000 | [diff] [blame] | 284 | int32_t ModuleRtpRtcpImpl::DeRegisterSendPayload(const int8_t payload_type) { |
Niels Möller | 59ab1cf | 2019-02-06 22:48:11 +0100 | [diff] [blame] | 285 | return 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 286 | } |
| 287 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 288 | uint32_t ModuleRtpRtcpImpl::StartTimestamp() const { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 289 | return rtp_sender_->TimestampOffset(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 290 | } |
| 291 | |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 292 | // Configure start timestamp, default is a random number. |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 293 | void ModuleRtpRtcpImpl::SetStartTimestamp(const uint32_t timestamp) { |
danilchap | 71fead2 | 2016-08-18 02:01:49 -0700 | [diff] [blame] | 294 | rtcp_sender_.SetTimestampOffset(timestamp); |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 295 | rtp_sender_->SetTimestampOffset(timestamp); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 296 | } |
| 297 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 298 | uint16_t ModuleRtpRtcpImpl::SequenceNumber() const { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 299 | return rtp_sender_->SequenceNumber(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 300 | } |
| 301 | |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 302 | // Set SequenceNumber, default is a random number. |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 303 | void ModuleRtpRtcpImpl::SetSequenceNumber(const uint16_t seq_num) { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 304 | rtp_sender_->SetSequenceNumber(seq_num); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 305 | } |
| 306 | |
Per | 83d0910 | 2016-04-15 14:59:13 +0200 | [diff] [blame] | 307 | void ModuleRtpRtcpImpl::SetRtpState(const RtpState& rtp_state) { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 308 | rtp_sender_->SetRtpState(rtp_state); |
danilchap | 71fead2 | 2016-08-18 02:01:49 -0700 | [diff] [blame] | 309 | rtcp_sender_.SetTimestampOffset(rtp_state.start_timestamp); |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 310 | } |
| 311 | |
Per | 83d0910 | 2016-04-15 14:59:13 +0200 | [diff] [blame] | 312 | void ModuleRtpRtcpImpl::SetRtxState(const RtpState& rtp_state) { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 313 | rtp_sender_->SetRtxRtpState(rtp_state); |
Per | 83d0910 | 2016-04-15 14:59:13 +0200 | [diff] [blame] | 314 | } |
| 315 | |
| 316 | RtpState ModuleRtpRtcpImpl::GetRtpState() const { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 317 | return rtp_sender_->GetRtpState(); |
Per | 83d0910 | 2016-04-15 14:59:13 +0200 | [diff] [blame] | 318 | } |
| 319 | |
| 320 | RtpState ModuleRtpRtcpImpl::GetRtxState() const { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 321 | return rtp_sender_->GetRtxRtpState(); |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 322 | } |
| 323 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 324 | uint32_t ModuleRtpRtcpImpl::SSRC() const { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 325 | return rtcp_sender_.SSRC(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 326 | } |
| 327 | |
stefan@webrtc.org | ef92755 | 2014-06-05 08:25:29 +0000 | [diff] [blame] | 328 | void ModuleRtpRtcpImpl::SetSSRC(const uint32_t ssrc) { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 329 | if (rtp_sender_) { |
| 330 | rtp_sender_->SetSSRC(ssrc); |
| 331 | } |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 332 | rtcp_sender_.SetSSRC(ssrc); |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 333 | SetRtcpReceiverSsrcs(ssrc); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 334 | } |
| 335 | |
Amit Hilbuch | 77938e6 | 2018-12-21 09:23:38 -0800 | [diff] [blame] | 336 | void ModuleRtpRtcpImpl::SetRid(const std::string& rid) { |
| 337 | if (rtp_sender_) { |
| 338 | rtp_sender_->SetRid(rid); |
| 339 | } |
| 340 | } |
| 341 | |
Steve Anton | 296a0ce | 2018-03-22 15:17:27 -0700 | [diff] [blame] | 342 | void ModuleRtpRtcpImpl::SetMid(const std::string& mid) { |
| 343 | if (rtp_sender_) { |
| 344 | rtp_sender_->SetMid(mid); |
| 345 | } |
| 346 | // TODO(bugs.webrtc.org/4050): If we end up supporting the MID SDES item for |
| 347 | // RTCP, this will need to be passed down to the RTCPSender also. |
| 348 | } |
| 349 | |
pbos@webrtc.org | 9334ac2 | 2014-11-24 08:25:50 +0000 | [diff] [blame] | 350 | void ModuleRtpRtcpImpl::SetCsrcs(const std::vector<uint32_t>& csrcs) { |
pbos@webrtc.org | 9334ac2 | 2014-11-24 08:25:50 +0000 | [diff] [blame] | 351 | rtcp_sender_.SetCsrcs(csrcs); |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 352 | rtp_sender_->SetCsrcs(csrcs); |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 353 | } |
| 354 | |
pbos@webrtc.org | 2f4b14e | 2014-07-15 15:25:39 +0000 | [diff] [blame] | 355 | // TODO(pbos): Handle media and RTX streams separately (separate RTCP |
| 356 | // feedbacks). |
| 357 | RTCPSender::FeedbackState ModuleRtpRtcpImpl::GetFeedbackState() { |
pbos@webrtc.org | 2f4b14e | 2014-07-15 15:25:39 +0000 | [diff] [blame] | 358 | RTCPSender::FeedbackState state; |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 359 | // This is called also when receiver_only is true. Hence below |
| 360 | // checks that rtp_sender_ exists. |
| 361 | if (rtp_sender_) { |
| 362 | StreamDataCounters rtp_stats; |
| 363 | StreamDataCounters rtx_stats; |
| 364 | rtp_sender_->GetDataCounters(&rtp_stats, &rtx_stats); |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 365 | state.packets_sent = |
| 366 | rtp_stats.transmitted.packets + rtx_stats.transmitted.packets; |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 367 | state.media_bytes_sent = rtp_stats.transmitted.payload_bytes + |
| 368 | rtx_stats.transmitted.payload_bytes; |
| 369 | state.send_bitrate = rtp_sender_->BitrateSent(); |
| 370 | } |
pbos@webrtc.org | 2f4b14e | 2014-07-15 15:25:39 +0000 | [diff] [blame] | 371 | state.module = this; |
| 372 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 373 | LastReceivedNTP(&state.last_rr_ntp_secs, &state.last_rr_ntp_frac, |
pbos@webrtc.org | 2f4b14e | 2014-07-15 15:25:39 +0000 | [diff] [blame] | 374 | &state.remote_sr); |
| 375 | |
Mirta Dvornicic | b1f063d | 2018-04-16 11:16:21 +0200 | [diff] [blame] | 376 | state.last_xr_rtis = rtcp_receiver_.ConsumeReceivedXrReferenceTimeInfo(); |
pbos@webrtc.org | 2f4b14e | 2014-07-15 15:25:39 +0000 | [diff] [blame] | 377 | |
pbos@webrtc.org | 2f4b14e | 2014-07-15 15:25:39 +0000 | [diff] [blame] | 378 | return state; |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 379 | } |
| 380 | |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 381 | // TODO(nisse): This method shouldn't be called for a receive-only |
| 382 | // stream. Delete rtp_sender_ check as soon as all applications are |
| 383 | // updated. |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 384 | int32_t ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) { |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 385 | if (rtcp_sender_.Sending() != sending) { |
| 386 | // Sends RTCP BYE when going from true to false |
pbos@webrtc.org | 2f4b14e | 2014-07-15 15:25:39 +0000 | [diff] [blame] | 387 | if (rtcp_sender_.SetSendingStatus(GetFeedbackState(), sending) != 0) { |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 388 | RTC_LOG(LS_WARNING) << "Failed to send RTCP BYE"; |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 389 | } |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 390 | if (sending && rtp_sender_) { |
nisse | 7d59f6b | 2017-02-21 03:40:24 -0800 | [diff] [blame] | 391 | // Update Rtcp receiver config, to track Rtx config changes from |
| 392 | // the SetRtxStatus and SetRtxSsrc methods. |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 393 | SetRtcpReceiverSsrcs(rtp_sender_->SSRC()); |
nisse | 7d59f6b | 2017-02-21 03:40:24 -0800 | [diff] [blame] | 394 | } |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 395 | } |
| 396 | return 0; |
| 397 | } |
| 398 | |
| 399 | bool ModuleRtpRtcpImpl::Sending() const { |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 400 | return rtcp_sender_.Sending(); |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 401 | } |
| 402 | |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 403 | // TODO(nisse): This method shouldn't be called for a receive-only |
| 404 | // stream. Delete rtp_sender_ check as soon as all applications are |
| 405 | // updated. |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 406 | void ModuleRtpRtcpImpl::SetSendingMediaStatus(const bool sending) { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 407 | if (rtp_sender_) { |
| 408 | rtp_sender_->SetSendingMediaStatus(sending); |
| 409 | } else { |
| 410 | RTC_DCHECK(!sending); |
| 411 | } |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 412 | } |
| 413 | |
| 414 | bool ModuleRtpRtcpImpl::SendingMedia() const { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 415 | return rtp_sender_ ? rtp_sender_->SendingMedia() : false; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 416 | } |
| 417 | |
Sebastian Jansson | 1bca65b | 2018-10-10 09:58:08 +0200 | [diff] [blame] | 418 | void ModuleRtpRtcpImpl::SetAsPartOfAllocation(bool part_of_allocation) { |
| 419 | RTC_CHECK(rtp_sender_); |
| 420 | rtp_sender_->SetAsPartOfAllocation(part_of_allocation); |
| 421 | } |
| 422 | |
Sergey Ulanov | 525df3f | 2016-08-02 17:46:41 -0700 | [diff] [blame] | 423 | bool ModuleRtpRtcpImpl::SendOutgoingData( |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 424 | FrameType frame_type, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 425 | int8_t payload_type, |
| 426 | uint32_t time_stamp, |
stefan@webrtc.org | ddfdfed | 2012-07-03 13:21:22 +0000 | [diff] [blame] | 427 | int64_t capture_time_ms, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 428 | const uint8_t* payload_data, |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 429 | size_t payload_size, |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 430 | const RTPFragmentationHeader* fragmentation, |
Sergey Ulanov | 525df3f | 2016-08-02 17:46:41 -0700 | [diff] [blame] | 431 | const RTPVideoHeader* rtp_video_header, |
| 432 | uint32_t* transport_frame_id_out) { |
Niels Möller | 5fe9510 | 2019-03-04 16:49:25 +0100 | [diff] [blame] | 433 | OnSendingRtpFrame(time_stamp, capture_time_ms, payload_type, |
| 434 | kVideoFrameKey == frame_type); |
Niels Möller | 59ab1cf | 2019-02-06 22:48:11 +0100 | [diff] [blame] | 435 | |
| 436 | const uint32_t rtp_timestamp = time_stamp + rtp_sender_->TimestampOffset(); |
| 437 | if (transport_frame_id_out) |
| 438 | *transport_frame_id_out = rtp_timestamp; |
| 439 | |
Niels Möller | 5fe9510 | 2019-03-04 16:49:25 +0100 | [diff] [blame] | 440 | RTC_DCHECK(audio_); |
| 441 | RTC_DCHECK(fragmentation == nullptr); |
Niels Möller | 59ab1cf | 2019-02-06 22:48:11 +0100 | [diff] [blame] | 442 | |
Niels Möller | 5fe9510 | 2019-03-04 16:49:25 +0100 | [diff] [blame] | 443 | return audio_->SendAudio(frame_type, payload_type, rtp_timestamp, |
| 444 | payload_data, payload_size); |
| 445 | } |
| 446 | |
| 447 | bool ModuleRtpRtcpImpl::OnSendingRtpFrame(uint32_t timestamp, |
| 448 | int64_t capture_time_ms, |
| 449 | int payload_type, |
| 450 | bool force_sender_report) { |
| 451 | if (!Sending()) |
| 452 | return false; |
| 453 | |
| 454 | rtcp_sender_.SetLastRtpTime(timestamp, capture_time_ms, payload_type); |
| 455 | // Make sure an RTCP report isn't queued behind a key frame. |
| 456 | if (rtcp_sender_.TimeToSendRTCPReport(force_sender_report)) |
| 457 | rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport); |
| 458 | |
| 459 | return true; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 460 | } |
| 461 | |
hclam@chromium.org | 2e402ce | 2013-06-20 20:18:31 +0000 | [diff] [blame] | 462 | bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc, |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 463 | uint16_t sequence_number, |
stefan@webrtc.org | 9b82f5a | 2013-11-13 15:29:21 +0000 | [diff] [blame] | 464 | int64_t capture_time_ms, |
philipel | a1ed0b3 | 2016-06-01 06:31:17 -0700 | [diff] [blame] | 465 | bool retransmission, |
philipel | c7bf32a | 2017-02-17 03:59:43 -0800 | [diff] [blame] | 466 | const PacedPacketInfo& pacing_info) { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 467 | return rtp_sender_->TimeToSendPacket(ssrc, sequence_number, capture_time_ms, |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 468 | retransmission, pacing_info); |
stefan@webrtc.org | 508a84b | 2013-06-17 12:53:37 +0000 | [diff] [blame] | 469 | } |
| 470 | |
philipel | c7bf32a | 2017-02-17 03:59:43 -0800 | [diff] [blame] | 471 | size_t ModuleRtpRtcpImpl::TimeToSendPadding( |
| 472 | size_t bytes, |
| 473 | const PacedPacketInfo& pacing_info) { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 474 | return rtp_sender_->TimeToSendPadding(bytes, pacing_info); |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 475 | } |
| 476 | |
nisse | 284542b | 2017-01-10 08:58:32 -0800 | [diff] [blame] | 477 | size_t ModuleRtpRtcpImpl::MaxRtpPacketSize() const { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 478 | return rtp_sender_->MaxRtpPacketSize(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 479 | } |
| 480 | |
nisse | 284542b | 2017-01-10 08:58:32 -0800 | [diff] [blame] | 481 | void ModuleRtpRtcpImpl::SetMaxRtpPacketSize(size_t rtp_packet_size) { |
| 482 | RTC_DCHECK_LE(rtp_packet_size, IP_PACKET_SIZE) |
| 483 | << "rtp packet size too large: " << rtp_packet_size; |
| 484 | RTC_DCHECK_GT(rtp_packet_size, packet_overhead_) |
| 485 | << "rtp packet size too small: " << rtp_packet_size; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 486 | |
nisse | 284542b | 2017-01-10 08:58:32 -0800 | [diff] [blame] | 487 | rtcp_sender_.SetMaxRtpPacketSize(rtp_packet_size); |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 488 | if (rtp_sender_) |
| 489 | rtp_sender_->SetMaxRtpPacketSize(rtp_packet_size); |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 490 | } |
| 491 | |
pbos | da903ea | 2015-10-02 02:36:56 -0700 | [diff] [blame] | 492 | RtcpMode ModuleRtpRtcpImpl::RTCP() const { |
Taylor Brandstetter | 5f0b83b | 2016-03-18 15:02:07 -0700 | [diff] [blame] | 493 | return rtcp_sender_.Status(); |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 494 | } |
| 495 | |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 496 | // Configure RTCP status i.e on/off. |
pbos | da903ea | 2015-10-02 02:36:56 -0700 | [diff] [blame] | 497 | void ModuleRtpRtcpImpl::SetRTCPStatus(const RtcpMode method) { |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 498 | rtcp_sender_.SetRTCPStatus(method); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 499 | } |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 500 | |
Peter Boström | 9ba52f8 | 2015-06-01 14:12:28 +0200 | [diff] [blame] | 501 | int32_t ModuleRtpRtcpImpl::SetCNAME(const char* c_name) { |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 502 | return rtcp_sender_.SetCNAME(c_name); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 503 | } |
| 504 | |
Erik Språng | 0ea42d3 | 2015-06-25 14:46:16 +0200 | [diff] [blame] | 505 | int32_t ModuleRtpRtcpImpl::AddMixedCNAME(uint32_t ssrc, const char* c_name) { |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 506 | return rtcp_sender_.AddMixedCNAME(ssrc, c_name); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 507 | } |
| 508 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 509 | int32_t ModuleRtpRtcpImpl::RemoveMixedCNAME(const uint32_t ssrc) { |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 510 | return rtcp_sender_.RemoveMixedCNAME(ssrc); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 511 | } |
| 512 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 513 | int32_t ModuleRtpRtcpImpl::RemoteCNAME(const uint32_t remote_ssrc, |
| 514 | char c_name[RTCP_CNAME_SIZE]) const { |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 515 | return rtcp_receiver_.CNAME(remote_ssrc, c_name); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 516 | } |
| 517 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 518 | int32_t ModuleRtpRtcpImpl::RemoteNTP(uint32_t* received_ntpsecs, |
| 519 | uint32_t* received_ntpfrac, |
| 520 | uint32_t* rtcp_arrival_time_secs, |
| 521 | uint32_t* rtcp_arrival_time_frac, |
| 522 | uint32_t* rtcp_timestamp) const { |
| 523 | return rtcp_receiver_.NTP(received_ntpsecs, received_ntpfrac, |
| 524 | rtcp_arrival_time_secs, rtcp_arrival_time_frac, |
pbos@webrtc.org | 376b4ea | 2014-07-15 15:51:33 +0000 | [diff] [blame] | 525 | rtcp_timestamp) |
| 526 | ? 0 |
| 527 | : -1; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 528 | } |
| 529 | |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 530 | // Get RoundTripTime. |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 531 | int32_t ModuleRtpRtcpImpl::RTT(const uint32_t remote_ssrc, |
pkasting@chromium.org | 16825b1 | 2015-01-12 21:51:21 +0000 | [diff] [blame] | 532 | int64_t* rtt, |
| 533 | int64_t* avg_rtt, |
| 534 | int64_t* min_rtt, |
| 535 | int64_t* max_rtt) const { |
wu@webrtc.org | cd70119 | 2014-04-24 22:10:24 +0000 | [diff] [blame] | 536 | int32_t ret = rtcp_receiver_.RTT(remote_ssrc, rtt, avg_rtt, min_rtt, max_rtt); |
| 537 | if (rtt && *rtt == 0) { |
| 538 | // Try to get RTT from RtcpRttStats class. |
pkasting@chromium.org | 16825b1 | 2015-01-12 21:51:21 +0000 | [diff] [blame] | 539 | *rtt = rtt_ms(); |
wu@webrtc.org | cd70119 | 2014-04-24 22:10:24 +0000 | [diff] [blame] | 540 | } |
| 541 | return ret; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 542 | } |
| 543 | |
Niels Möller | 5fe9510 | 2019-03-04 16:49:25 +0100 | [diff] [blame] | 544 | int64_t ModuleRtpRtcpImpl::ExpectedRetransmissionTimeMs() const { |
| 545 | int64_t expected_retransmission_time_ms = rtt_ms(); |
| 546 | if (expected_retransmission_time_ms > 0) { |
| 547 | return expected_retransmission_time_ms; |
| 548 | } |
| 549 | // No rtt available (|kRtpRtcpRttProcessTimeMs| not yet passed?), so try to |
| 550 | // poll avg_rtt_ms directly from rtcp receiver. |
| 551 | if (rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), nullptr, |
| 552 | &expected_retransmission_time_ms, nullptr, |
| 553 | nullptr) == 0) { |
| 554 | return expected_retransmission_time_ms; |
| 555 | } |
| 556 | return kDefaultExpectedRetransmissionTimeMs; |
| 557 | } |
| 558 | |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 559 | // Force a send of an RTCP packet. |
| 560 | // Normal SR and RR are triggered via the process function. |
Erik Språng | 242e22b | 2015-05-11 10:17:43 +0200 | [diff] [blame] | 561 | int32_t ModuleRtpRtcpImpl::SendRTCP(RTCPPacketType packet_type) { |
| 562 | return rtcp_sender_.SendRTCP(GetFeedbackState(), packet_type); |
| 563 | } |
| 564 | |
| 565 | // Force a send of an RTCP packet. |
| 566 | // Normal SR and RR are triggered via the process function. |
| 567 | int32_t ModuleRtpRtcpImpl::SendCompoundRTCP( |
| 568 | const std::set<RTCPPacketType>& packet_types) { |
| 569 | return rtcp_sender_.SendCompoundRTCP(GetFeedbackState(), packet_types); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 570 | } |
| 571 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 572 | int32_t ModuleRtpRtcpImpl::SetRTCPApplicationSpecificData( |
| 573 | const uint8_t sub_type, |
| 574 | const uint32_t name, |
| 575 | const uint8_t* data, |
| 576 | const uint16_t length) { |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 577 | return rtcp_sender_.SetApplicationSpecificData(sub_type, name, data, length); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 578 | } |
| 579 | |
asapersson@webrtc.org | 7d6bd22 | 2013-10-31 12:14:34 +0000 | [diff] [blame] | 580 | void ModuleRtpRtcpImpl::SetRtcpXrRrtrStatus(bool enable) { |
Danil Chapovalov | c1e55c7 | 2016-03-09 15:14:35 +0100 | [diff] [blame] | 581 | rtcp_receiver_.SetRtcpXrRrtrStatus(enable); |
| 582 | rtcp_sender_.SendRtcpXrReceiverReferenceTime(enable); |
asapersson@webrtc.org | 7d6bd22 | 2013-10-31 12:14:34 +0000 | [diff] [blame] | 583 | } |
| 584 | |
asapersson@webrtc.org | 8d02f5d | 2013-11-21 08:57:04 +0000 | [diff] [blame] | 585 | bool ModuleRtpRtcpImpl::RtcpXrRrtrStatus() const { |
| 586 | return rtcp_sender_.RtcpXrReceiverReferenceTime(); |
| 587 | } |
| 588 | |
asapersson@webrtc.org | 97d0489 | 2014-12-09 09:47:53 +0000 | [diff] [blame] | 589 | // TODO(asapersson): Replace this method with the one below. |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 590 | int32_t ModuleRtpRtcpImpl::DataCountersRTP(size_t* bytes_sent, |
| 591 | uint32_t* packets_sent) const { |
pbos@webrtc.org | 2f4b14e | 2014-07-15 15:25:39 +0000 | [diff] [blame] | 592 | StreamDataCounters rtp_stats; |
| 593 | StreamDataCounters rtx_stats; |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 594 | rtp_sender_->GetDataCounters(&rtp_stats, &rtx_stats); |
pbos@webrtc.org | 2f4b14e | 2014-07-15 15:25:39 +0000 | [diff] [blame] | 595 | |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 596 | if (bytes_sent) { |
asapersson@webrtc.org | cfd82df | 2015-01-22 09:39:59 +0000 | [diff] [blame] | 597 | *bytes_sent = rtp_stats.transmitted.payload_bytes + |
| 598 | rtp_stats.transmitted.padding_bytes + |
| 599 | rtp_stats.transmitted.header_bytes + |
| 600 | rtx_stats.transmitted.payload_bytes + |
| 601 | rtx_stats.transmitted.padding_bytes + |
| 602 | rtx_stats.transmitted.header_bytes; |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 603 | } |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 604 | if (packets_sent) { |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 605 | *packets_sent = |
| 606 | rtp_stats.transmitted.packets + rtx_stats.transmitted.packets; |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 607 | } |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 608 | return 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 609 | } |
| 610 | |
asapersson@webrtc.org | 97d0489 | 2014-12-09 09:47:53 +0000 | [diff] [blame] | 611 | void ModuleRtpRtcpImpl::GetSendStreamDataCounters( |
| 612 | StreamDataCounters* rtp_counters, |
| 613 | StreamDataCounters* rtx_counters) const { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 614 | rtp_sender_->GetDataCounters(rtp_counters, rtx_counters); |
asapersson@webrtc.org | 97d0489 | 2014-12-09 09:47:53 +0000 | [diff] [blame] | 615 | } |
| 616 | |
bcornell | 30409b4 | 2015-07-10 18:10:05 -0700 | [diff] [blame] | 617 | void ModuleRtpRtcpImpl::GetRtpPacketLossStats( |
| 618 | bool outgoing, |
| 619 | uint32_t ssrc, |
| 620 | struct RtpPacketLossStats* loss_stats) const { |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 621 | if (!loss_stats) |
| 622 | return; |
bcornell | 30409b4 | 2015-07-10 18:10:05 -0700 | [diff] [blame] | 623 | const PacketLossStats* stats_source = NULL; |
| 624 | if (outgoing) { |
| 625 | if (SSRC() == ssrc) { |
| 626 | stats_source = &send_loss_stats_; |
| 627 | } |
| 628 | } else { |
| 629 | if (rtcp_receiver_.RemoteSSRC() == ssrc) { |
| 630 | stats_source = &receive_loss_stats_; |
| 631 | } |
| 632 | } |
| 633 | if (stats_source) { |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 634 | loss_stats->single_packet_loss_count = stats_source->GetSingleLossCount(); |
bcornell | 30409b4 | 2015-07-10 18:10:05 -0700 | [diff] [blame] | 635 | loss_stats->multiple_packet_loss_event_count = |
| 636 | stats_source->GetMultipleLossEventCount(); |
| 637 | loss_stats->multiple_packet_loss_packet_count = |
| 638 | stats_source->GetMultipleLossPacketCount(); |
| 639 | } |
| 640 | } |
| 641 | |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 642 | // Received RTCP report. |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 643 | int32_t ModuleRtpRtcpImpl::RemoteRTCPStat( |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 644 | std::vector<RTCPReportBlock>* receive_blocks) const { |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 645 | return rtcp_receiver_.StatisticsReceived(receive_blocks); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 646 | } |
| 647 | |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 648 | // (REMB) Receiver Estimated Max Bitrate. |
Danil Chapovalov | 1de4b62 | 2017-12-13 13:35:10 +0100 | [diff] [blame] | 649 | void ModuleRtpRtcpImpl::SetRemb(int64_t bitrate_bps, |
| 650 | std::vector<uint32_t> ssrcs) { |
| 651 | rtcp_sender_.SetRemb(bitrate_bps, std::move(ssrcs)); |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 652 | } |
| 653 | |
Danil Chapovalov | 51e21aa | 2017-10-10 17:46:26 +0200 | [diff] [blame] | 654 | void ModuleRtpRtcpImpl::UnsetRemb() { |
Danil Chapovalov | f74d641 | 2017-10-18 13:32:57 +0200 | [diff] [blame] | 655 | rtcp_sender_.UnsetRemb(); |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 656 | } |
| 657 | |
Johannes Kron | 9190b82 | 2018-10-29 11:22:05 +0100 | [diff] [blame] | 658 | void ModuleRtpRtcpImpl::SetExtmapAllowMixed(bool extmap_allow_mixed) { |
| 659 | rtp_sender_->SetExtmapAllowMixed(extmap_allow_mixed); |
| 660 | } |
| 661 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 662 | int32_t ModuleRtpRtcpImpl::RegisterSendRtpHeaderExtension( |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 663 | const RTPExtensionType type, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 664 | const uint8_t id) { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 665 | return rtp_sender_->RegisterRtpHeaderExtension(type, id); |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 666 | } |
| 667 | |
Danil Chapovalov | 585d1aa | 2018-09-14 18:29:32 +0200 | [diff] [blame] | 668 | bool ModuleRtpRtcpImpl::RegisterRtpHeaderExtension(const std::string& uri, |
| 669 | int id) { |
| 670 | return rtp_sender_->RegisterRtpHeaderExtension(uri, id); |
| 671 | } |
| 672 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 673 | int32_t ModuleRtpRtcpImpl::DeregisterSendRtpHeaderExtension( |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 674 | const RTPExtensionType type) { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 675 | return rtp_sender_->DeregisterRtpHeaderExtension(type); |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 676 | } |
| 677 | |
stefan | 53b6cc3 | 2017-02-03 08:13:57 -0800 | [diff] [blame] | 678 | bool ModuleRtpRtcpImpl::HasBweExtensions() const { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 679 | return rtp_sender_->IsRtpHeaderExtensionRegistered( |
stefan | 53b6cc3 | 2017-02-03 08:13:57 -0800 | [diff] [blame] | 680 | kRtpExtensionTransportSequenceNumber) || |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 681 | rtp_sender_->IsRtpHeaderExtensionRegistered( |
stefan | 53b6cc3 | 2017-02-03 08:13:57 -0800 | [diff] [blame] | 682 | kRtpExtensionAbsoluteSendTime) || |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 683 | rtp_sender_->IsRtpHeaderExtensionRegistered( |
stefan | 53b6cc3 | 2017-02-03 08:13:57 -0800 | [diff] [blame] | 684 | kRtpExtensionTransmissionTimeOffset); |
| 685 | } |
| 686 | |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 687 | // (TMMBR) Temporary Max Media Bit Rate. |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 688 | bool ModuleRtpRtcpImpl::TMMBR() const { |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 689 | return rtcp_sender_.TMMBR(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 690 | } |
| 691 | |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 692 | void ModuleRtpRtcpImpl::SetTMMBRStatus(const bool enable) { |
| 693 | rtcp_sender_.SetTMMBRStatus(enable); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 694 | } |
| 695 | |
danilchap | 853ecb2 | 2016-08-22 08:26:15 -0700 | [diff] [blame] | 696 | void ModuleRtpRtcpImpl::SetTmmbn(std::vector<rtcp::TmmbItem> bounding_set) { |
| 697 | rtcp_sender_.SetTmmbn(std::move(bounding_set)); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 698 | } |
| 699 | |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 700 | // Send a Negative acknowledgment packet. |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 701 | int32_t ModuleRtpRtcpImpl::SendNACK(const uint16_t* nack_list, |
| 702 | const uint16_t size) { |
bcornell | 30409b4 | 2015-07-10 18:10:05 -0700 | [diff] [blame] | 703 | for (int i = 0; i < size; ++i) { |
| 704 | receive_loss_stats_.AddLostPacket(nack_list[i]); |
| 705 | } |
asapersson@webrtc.org | ba8138b | 2014-12-08 13:29:02 +0000 | [diff] [blame] | 706 | uint16_t nack_length = size; |
| 707 | uint16_t start_id = 0; |
Danil Chapovalov | 9eb6ce1 | 2017-12-15 12:25:01 +0100 | [diff] [blame] | 708 | int64_t now_ms = clock_->TimeInMilliseconds(); |
| 709 | if (TimeToSendFullNackList(now_ms)) { |
| 710 | nack_last_time_sent_full_ms_ = now_ms; |
asapersson@webrtc.org | ba8138b | 2014-12-08 13:29:02 +0000 | [diff] [blame] | 711 | } else { |
| 712 | // Only send extended list. |
| 713 | if (nack_last_seq_number_sent_ == nack_list[size - 1]) { |
| 714 | // Last sequence number is the same, do not send list. |
| 715 | return 0; |
| 716 | } |
| 717 | // Send new sequence numbers. |
| 718 | for (int i = 0; i < size; ++i) { |
| 719 | if (nack_last_seq_number_sent_ == nack_list[i]) { |
| 720 | start_id = i + 1; |
| 721 | break; |
| 722 | } |
| 723 | } |
| 724 | nack_length = size - start_id; |
| 725 | } |
| 726 | |
| 727 | // Our RTCP NACK implementation is limited to kRtcpMaxNackFields sequence |
| 728 | // numbers per RTCP packet. |
| 729 | if (nack_length > kRtcpMaxNackFields) { |
| 730 | nack_length = kRtcpMaxNackFields; |
| 731 | } |
| 732 | nack_last_seq_number_sent_ = nack_list[start_id + nack_length - 1]; |
| 733 | |
philipel | 83f831a | 2016-03-12 03:30:23 -0800 | [diff] [blame] | 734 | return rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpNack, nack_length, |
| 735 | &nack_list[start_id]); |
| 736 | } |
| 737 | |
| 738 | void ModuleRtpRtcpImpl::SendNack( |
| 739 | const std::vector<uint16_t>& sequence_numbers) { |
| 740 | rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpNack, sequence_numbers.size(), |
| 741 | sequence_numbers.data()); |
asapersson@webrtc.org | ba8138b | 2014-12-08 13:29:02 +0000 | [diff] [blame] | 742 | } |
| 743 | |
| 744 | bool ModuleRtpRtcpImpl::TimeToSendFullNackList(int64_t now) const { |
asapersson@webrtc.org | e7b1e11 | 2013-12-16 14:40:36 +0000 | [diff] [blame] | 745 | // Use RTT from RtcpRttStats class if provided. |
pkasting@chromium.org | 16825b1 | 2015-01-12 21:51:21 +0000 | [diff] [blame] | 746 | int64_t rtt = rtt_ms(); |
asapersson@webrtc.org | e7b1e11 | 2013-12-16 14:40:36 +0000 | [diff] [blame] | 747 | if (rtt == 0) { |
| 748 | rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), NULL, &rtt, NULL, NULL); |
| 749 | } |
stefan@webrtc.org | 8ca8a71 | 2013-04-23 16:48:32 +0000 | [diff] [blame] | 750 | |
asapersson@webrtc.org | ba8138b | 2014-12-08 13:29:02 +0000 | [diff] [blame] | 751 | const int64_t kStartUpRttMs = 100; |
asapersson@webrtc.org | e7b1e11 | 2013-12-16 14:40:36 +0000 | [diff] [blame] | 752 | int64_t wait_time = 5 + ((rtt * 3) >> 1); // 5 + RTT * 1.5. |
asapersson@webrtc.org | ba8138b | 2014-12-08 13:29:02 +0000 | [diff] [blame] | 753 | if (rtt == 0) { |
| 754 | wait_time = kStartUpRttMs; |
stefan@webrtc.org | 8ca8a71 | 2013-04-23 16:48:32 +0000 | [diff] [blame] | 755 | } |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 756 | |
asapersson@webrtc.org | ba8138b | 2014-12-08 13:29:02 +0000 | [diff] [blame] | 757 | // Send a full NACK list once within every |wait_time|. |
Danil Chapovalov | 9eb6ce1 | 2017-12-15 12:25:01 +0100 | [diff] [blame] | 758 | return now - nack_last_time_sent_full_ms_ > wait_time; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 759 | } |
| 760 | |
asapersson@webrtc.org | 9ffd8fe | 2015-01-21 08:22:50 +0000 | [diff] [blame] | 761 | // Store the sent packets, needed to answer to Negative acknowledgment requests. |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 762 | void ModuleRtpRtcpImpl::SetStorePacketsStatus(const bool enable, |
| 763 | const uint16_t number_to_store) { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 764 | rtp_sender_->SetStorePacketsStatus(enable, number_to_store); |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 765 | } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 766 | |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 767 | bool ModuleRtpRtcpImpl::StorePackets() const { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 768 | return rtp_sender_->StorePackets(); |
tnakamura@webrtc.org | aa4d96a | 2013-07-16 19:25:04 +0000 | [diff] [blame] | 769 | } |
| 770 | |
pbos@webrtc.org | ce4e9a3 | 2014-12-18 13:50:16 +0000 | [diff] [blame] | 771 | void ModuleRtpRtcpImpl::RegisterRtcpStatisticsCallback( |
sprang@webrtc.org | a6ad6e5 | 2013-12-05 09:48:44 +0000 | [diff] [blame] | 772 | RtcpStatisticsCallback* callback) { |
| 773 | rtcp_receiver_.RegisterRtcpStatisticsCallback(callback); |
| 774 | } |
| 775 | |
pbos@webrtc.org | 1d0fa5d | 2015-02-19 12:47:00 +0000 | [diff] [blame] | 776 | RtcpStatisticsCallback* ModuleRtpRtcpImpl::GetRtcpStatisticsCallback() { |
sprang@webrtc.org | a6ad6e5 | 2013-12-05 09:48:44 +0000 | [diff] [blame] | 777 | return rtcp_receiver_.GetRtcpStatisticsCallback(); |
| 778 | } |
| 779 | |
sprang | 233bd87 | 2015-09-08 13:25:16 -0700 | [diff] [blame] | 780 | bool ModuleRtpRtcpImpl::SendFeedbackPacket( |
| 781 | const rtcp::TransportFeedback& packet) { |
| 782 | return rtcp_sender_.SendFeedbackPacket(packet); |
| 783 | } |
| 784 | |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 785 | // Send a TelephoneEvent tone using RFC 2833 (4733). |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 786 | int32_t ModuleRtpRtcpImpl::SendTelephoneEventOutband(const uint8_t key, |
| 787 | const uint16_t time_ms, |
| 788 | const uint8_t level) { |
Niels Möller | 59ab1cf | 2019-02-06 22:48:11 +0100 | [diff] [blame] | 789 | return audio_ ? audio_->SendTelephoneEvent(key, time_ms, level) : -1; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 790 | } |
| 791 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 792 | int32_t ModuleRtpRtcpImpl::SetAudioLevel(const uint8_t level_d_bov) { |
Niels Möller | 59ab1cf | 2019-02-06 22:48:11 +0100 | [diff] [blame] | 793 | return audio_ ? audio_->SetAudioLevel(level_d_bov) : -1; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 794 | } |
| 795 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 796 | int32_t ModuleRtpRtcpImpl::SetKeyFrameRequestMethod( |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 797 | const KeyFrameRequestMethod method) { |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 798 | key_frame_req_method_ = method; |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 799 | return 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 800 | } |
| 801 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 802 | int32_t ModuleRtpRtcpImpl::RequestKeyFrame() { |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 803 | switch (key_frame_req_method_) { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 804 | case kKeyFrameReqPliRtcp: |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 805 | return SendRTCP(kRtcpPli); |
pwestin@webrtc.org | 5e95481 | 2012-02-10 12:13:12 +0000 | [diff] [blame] | 806 | case kKeyFrameReqFirRtcp: |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 807 | return SendRTCP(kRtcpFir); |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 808 | } |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 809 | return -1; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 810 | } |
| 811 | |
Elad Alon | 7d6a4c0 | 2019-02-25 13:00:51 +0100 | [diff] [blame] | 812 | int32_t ModuleRtpRtcpImpl::SendLossNotification(uint16_t last_decoded_seq_num, |
| 813 | uint16_t last_received_seq_num, |
| 814 | bool decodability_flag) { |
| 815 | return rtcp_sender_.SendLossNotification( |
| 816 | GetFeedbackState(), last_decoded_seq_num, last_received_seq_num, |
| 817 | decodability_flag); |
| 818 | } |
| 819 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 820 | void ModuleRtpRtcpImpl::SetRemoteSSRC(const uint32_t ssrc) { |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 821 | // Inform about the incoming SSRC. |
| 822 | rtcp_sender_.SetRemoteSSRC(ssrc); |
| 823 | rtcp_receiver_.SetRemoteSSRC(ssrc); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 824 | } |
| 825 | |
Niels Möller | 5fe9510 | 2019-03-04 16:49:25 +0100 | [diff] [blame] | 826 | // TODO(nisse): Delete video_rate amd fec_rate arguments. |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 827 | void ModuleRtpRtcpImpl::BitrateSent(uint32_t* total_rate, |
| 828 | uint32_t* video_rate, |
| 829 | uint32_t* fec_rate, |
| 830 | uint32_t* nack_rate) const { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 831 | *total_rate = rtp_sender_->BitrateSent(); |
Niels Möller | 5fe9510 | 2019-03-04 16:49:25 +0100 | [diff] [blame] | 832 | if (video_rate) |
| 833 | *video_rate = 0; |
| 834 | if (fec_rate) |
| 835 | *fec_rate = 0; |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 836 | *nack_rate = rtp_sender_->NackOverheadRate(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 837 | } |
| 838 | |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 839 | void ModuleRtpRtcpImpl::OnRequestSendReport() { |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 840 | SendRTCP(kRtcpSr); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 841 | } |
| 842 | |
Danil Chapovalov | 2800d74 | 2016-08-26 18:48:46 +0200 | [diff] [blame] | 843 | void ModuleRtpRtcpImpl::OnReceivedNack( |
| 844 | const std::vector<uint16_t>& nack_sequence_numbers) { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 845 | if (!rtp_sender_) |
| 846 | return; |
| 847 | |
bcornell | 30409b4 | 2015-07-10 18:10:05 -0700 | [diff] [blame] | 848 | for (uint16_t nack_sequence_number : nack_sequence_numbers) { |
| 849 | send_loss_stats_.AddLostPacket(nack_sequence_number); |
| 850 | } |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 851 | if (!rtp_sender_->StorePackets() || nack_sequence_numbers.size() == 0) { |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 852 | return; |
| 853 | } |
asapersson@webrtc.org | e7b1e11 | 2013-12-16 14:40:36 +0000 | [diff] [blame] | 854 | // Use RTT from RtcpRttStats class if provided. |
pkasting@chromium.org | 16825b1 | 2015-01-12 21:51:21 +0000 | [diff] [blame] | 855 | int64_t rtt = rtt_ms(); |
asapersson@webrtc.org | e7b1e11 | 2013-12-16 14:40:36 +0000 | [diff] [blame] | 856 | if (rtt == 0) { |
| 857 | rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), NULL, &rtt, NULL, NULL); |
| 858 | } |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 859 | rtp_sender_->OnReceivedNack(nack_sequence_numbers, rtt); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 860 | } |
| 861 | |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 862 | void ModuleRtpRtcpImpl::OnReceivedRtcpReportBlocks( |
| 863 | const ReportBlockList& report_blocks) { |
Niels Möller | 5fe9510 | 2019-03-04 16:49:25 +0100 | [diff] [blame] | 864 | if (ack_observer_) { |
Niels Möller | 59ab1cf | 2019-02-06 22:48:11 +0100 | [diff] [blame] | 865 | uint32_t ssrc = SSRC(); |
| 866 | |
| 867 | for (const RTCPReportBlock& report_block : report_blocks) { |
| 868 | if (ssrc == report_block.source_ssrc) { |
Niels Möller | 5fe9510 | 2019-03-04 16:49:25 +0100 | [diff] [blame] | 869 | ack_observer_->OnReceivedAck( |
| 870 | report_block.extended_highest_sequence_number); |
Niels Möller | 59ab1cf | 2019-02-06 22:48:11 +0100 | [diff] [blame] | 871 | } |
| 872 | } |
| 873 | } |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 874 | } |
| 875 | |
pbos@webrtc.org | 2f4b14e | 2014-07-15 15:25:39 +0000 | [diff] [blame] | 876 | bool ModuleRtpRtcpImpl::LastReceivedNTP( |
| 877 | uint32_t* rtcp_arrival_time_secs, // When we got the last report. |
| 878 | uint32_t* rtcp_arrival_time_frac, |
| 879 | uint32_t* remote_sr) const { |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 880 | // Remote SR: NTP inside the last received (mid 16 bits from sec and frac). |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 881 | uint32_t ntp_secs = 0; |
| 882 | uint32_t ntp_frac = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 883 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 884 | if (!rtcp_receiver_.NTP(&ntp_secs, &ntp_frac, rtcp_arrival_time_secs, |
| 885 | rtcp_arrival_time_frac, NULL)) { |
pbos@webrtc.org | 2f4b14e | 2014-07-15 15:25:39 +0000 | [diff] [blame] | 886 | return false; |
henrike@webrtc.org | d5657c2 | 2012-02-08 23:41:49 +0000 | [diff] [blame] | 887 | } |
pbos@webrtc.org | 2f4b14e | 2014-07-15 15:25:39 +0000 | [diff] [blame] | 888 | *remote_sr = |
| 889 | ((ntp_secs & 0x0000ffff) << 16) + ((ntp_frac & 0xffff0000) >> 16); |
| 890 | return true; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 891 | } |
| 892 | |
phoglund@webrtc.org | acfdd96 | 2013-01-16 10:27:33 +0000 | [diff] [blame] | 893 | // Called from RTCPsender. |
danilchap | 2b61639 | 2016-08-18 06:17:42 -0700 | [diff] [blame] | 894 | std::vector<rtcp::TmmbItem> ModuleRtpRtcpImpl::BoundingSet(bool* tmmbr_owner) { |
| 895 | return rtcp_receiver_.BoundingSet(tmmbr_owner); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 896 | } |
mflodman@webrtc.org | 2f225ca | 2013-01-09 13:54:43 +0000 | [diff] [blame] | 897 | |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 898 | void ModuleRtpRtcpImpl::SetRtcpReceiverSsrcs(uint32_t main_ssrc) { |
| 899 | std::set<uint32_t> ssrcs; |
| 900 | ssrcs.insert(main_ssrc); |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 901 | if (RtxSendStatus() != kRtxOff) |
| 902 | ssrcs.insert(rtp_sender_->RtxSsrc()); |
Danil Chapovalov | d264df5 | 2018-06-14 12:59:38 +0200 | [diff] [blame] | 903 | absl::optional<uint32_t> flexfec_ssrc = FlexfecSsrc(); |
brandtr | 7c7796b | 2017-07-03 06:02:53 -0700 | [diff] [blame] | 904 | if (flexfec_ssrc) |
| 905 | ssrcs.insert(*flexfec_ssrc); |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 906 | rtcp_receiver_.SetSsrcs(main_ssrc, ssrcs); |
| 907 | } |
| 908 | |
pkasting@chromium.org | 16825b1 | 2015-01-12 21:51:21 +0000 | [diff] [blame] | 909 | void ModuleRtpRtcpImpl::set_rtt_ms(int64_t rtt_ms) { |
danilchap | 7c9426c | 2016-04-14 03:05:31 -0700 | [diff] [blame] | 910 | rtc::CritScope cs(&critical_section_rtt_); |
asapersson@webrtc.org | 1ae1d0c | 2013-11-20 12:46:11 +0000 | [diff] [blame] | 911 | rtt_ms_ = rtt_ms; |
Erik Språng | 8b10192 | 2018-01-18 11:58:05 -0800 | [diff] [blame] | 912 | if (rtp_sender_) |
| 913 | rtp_sender_->SetRtt(rtt_ms); |
asapersson@webrtc.org | 1ae1d0c | 2013-11-20 12:46:11 +0000 | [diff] [blame] | 914 | } |
| 915 | |
pkasting@chromium.org | 16825b1 | 2015-01-12 21:51:21 +0000 | [diff] [blame] | 916 | int64_t ModuleRtpRtcpImpl::rtt_ms() const { |
danilchap | 7c9426c | 2016-04-14 03:05:31 -0700 | [diff] [blame] | 917 | rtc::CritScope cs(&critical_section_rtt_); |
asapersson@webrtc.org | 1ae1d0c | 2013-11-20 12:46:11 +0000 | [diff] [blame] | 918 | return rtt_ms_; |
| 919 | } |
| 920 | |
sprang@webrtc.org | ebad765 | 2013-12-05 14:29:02 +0000 | [diff] [blame] | 921 | void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback( |
| 922 | StreamDataCountersCallback* callback) { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 923 | rtp_sender_->RegisterRtpStatisticsCallback(callback); |
sprang@webrtc.org | ebad765 | 2013-12-05 14:29:02 +0000 | [diff] [blame] | 924 | } |
| 925 | |
| 926 | StreamDataCountersCallback* |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 927 | ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { |
nisse | 14adba7 | 2017-03-20 03:52:39 -0700 | [diff] [blame] | 928 | return rtp_sender_->GetRtpStatisticsCallback(); |
sprang@webrtc.org | ebad765 | 2013-12-05 14:29:02 +0000 | [diff] [blame] | 929 | } |
sprang | 5e38c96 | 2016-12-01 05:18:09 -0800 | [diff] [blame] | 930 | |
| 931 | void ModuleRtpRtcpImpl::SetVideoBitrateAllocation( |
Erik Språng | 566124a | 2018-04-23 12:32:22 +0200 | [diff] [blame] | 932 | const VideoBitrateAllocation& bitrate) { |
sprang | 5e38c96 | 2016-12-01 05:18:09 -0800 | [diff] [blame] | 933 | rtcp_sender_.SetVideoBitrateAllocation(bitrate); |
| 934 | } |
Niels Möller | 5fe9510 | 2019-03-04 16:49:25 +0100 | [diff] [blame] | 935 | |
| 936 | RTPSender* ModuleRtpRtcpImpl::RtpSender() { |
| 937 | return rtp_sender_.get(); |
| 938 | } |
| 939 | |
| 940 | const RTPSender* ModuleRtpRtcpImpl::RtpSender() const { |
| 941 | return rtp_sender_.get(); |
| 942 | } |
| 943 | |
mflodman@webrtc.org | 02270cd | 2015-02-06 13:10:19 +0000 | [diff] [blame] | 944 | } // namespace webrtc |