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