Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 | 63 |
| 64 // Deprecated. | 64 // Deprecated. |
| 65 int32_t RtpRtcp::SetFecParameters(const FecProtectionParams* delta_params, | 65 int32_t RtpRtcp::SetFecParameters(const FecProtectionParams* delta_params, |
| 66 const FecProtectionParams* key_params) { | 66 const FecProtectionParams* key_params) { |
| 67 RTC_DCHECK(delta_params); | 67 RTC_DCHECK(delta_params); |
| 68 RTC_DCHECK(key_params); | 68 RTC_DCHECK(key_params); |
| 69 return SetFecParameters(*delta_params, *key_params) ? 0 : -1; | 69 return SetFecParameters(*delta_params, *key_params) ? 0 : -1; |
| 70 } | 70 } |
| 71 | 71 |
| 72 ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration) | 72 ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration) |
| 73 : rtp_sender_(configuration.audio, | 73 : rtcp_sender_(configuration.audio, |
| 74 configuration.clock, | |
| 75 configuration.outgoing_transport, | |
| 76 configuration.paced_sender, | |
| 77 configuration.flexfec_sender, | |
| 78 configuration.transport_sequence_number_allocator, | |
| 79 configuration.transport_feedback_callback, | |
| 80 configuration.send_bitrate_observer, | |
| 81 configuration.send_frame_count_observer, | |
| 82 configuration.send_side_delay_observer, | |
| 83 configuration.event_log, | |
| 84 configuration.send_packet_observer, | |
| 85 configuration.retransmission_rate_limiter, | |
| 86 configuration.overhead_observer), | |
| 87 rtcp_sender_(configuration.audio, | |
| 88 configuration.clock, | 74 configuration.clock, |
| 89 configuration.receive_statistics, | 75 configuration.receive_statistics, |
| 90 configuration.rtcp_packet_type_counter_observer, | 76 configuration.rtcp_packet_type_counter_observer, |
| 91 configuration.event_log, | 77 configuration.event_log, |
| 92 configuration.outgoing_transport), | 78 configuration.outgoing_transport), |
| 93 rtcp_receiver_(configuration.clock, | 79 rtcp_receiver_(configuration.clock, |
| 94 configuration.receiver_only, | 80 configuration.receiver_only, |
| 95 configuration.rtcp_packet_type_counter_observer, | 81 configuration.rtcp_packet_type_counter_observer, |
| 96 configuration.bandwidth_callback, | 82 configuration.bandwidth_callback, |
| 97 configuration.intra_frame_callback, | 83 configuration.intra_frame_callback, |
| 98 configuration.transport_feedback_callback, | 84 configuration.transport_feedback_callback, |
| 99 configuration.bitrate_allocation_observer, | 85 configuration.bitrate_allocation_observer, |
| 100 this), | 86 this), |
| 101 clock_(configuration.clock), | 87 clock_(configuration.clock), |
| 102 audio_(configuration.audio), | 88 audio_(configuration.audio), |
| 103 last_process_time_(configuration.clock->TimeInMilliseconds()), | 89 last_process_time_(configuration.clock->TimeInMilliseconds()), |
| 104 last_bitrate_process_time_(configuration.clock->TimeInMilliseconds()), | 90 last_bitrate_process_time_(configuration.clock->TimeInMilliseconds()), |
| 105 last_rtt_process_time_(configuration.clock->TimeInMilliseconds()), | 91 last_rtt_process_time_(configuration.clock->TimeInMilliseconds()), |
| 106 packet_overhead_(28), // IPV4 UDP. | 92 packet_overhead_(28), // IPV4 UDP. |
| 107 nack_last_time_sent_full_(0), | 93 nack_last_time_sent_full_(0), |
| 108 nack_last_time_sent_full_prev_(0), | 94 nack_last_time_sent_full_prev_(0), |
| 109 nack_last_seq_number_sent_(0), | 95 nack_last_seq_number_sent_(0), |
| 110 key_frame_req_method_(kKeyFrameReqPliRtcp), | 96 key_frame_req_method_(kKeyFrameReqPliRtcp), |
| 111 remote_bitrate_(configuration.remote_bitrate_estimator), | 97 remote_bitrate_(configuration.remote_bitrate_estimator), |
| 112 rtt_stats_(configuration.rtt_stats), | 98 rtt_stats_(configuration.rtt_stats), |
| 113 rtt_ms_(0) { | 99 rtt_ms_(0) { |
| 114 // Make sure rtcp sender use same timestamp offset as rtp sender. | 100 if (!configuration.receiver_only) { |
| 115 rtcp_sender_.SetTimestampOffset(rtp_sender_.TimestampOffset()); | 101 rtp_sender_.reset(new RTPSender( |
| 102 configuration.audio, | |
| 103 configuration.clock, | |
| 104 configuration.outgoing_transport, | |
| 105 configuration.paced_sender, | |
| 106 configuration.flexfec_sender, | |
| 107 configuration.transport_sequence_number_allocator, | |
| 108 configuration.transport_feedback_callback, | |
| 109 configuration.send_bitrate_observer, | |
| 110 configuration.send_frame_count_observer, | |
| 111 configuration.send_side_delay_observer, | |
| 112 configuration.event_log, | |
| 113 configuration.send_packet_observer, | |
| 114 configuration.retransmission_rate_limiter, | |
| 115 configuration.overhead_observer)); | |
| 116 // Make sure rtcp sender use same timestamp offset as rtp sender. | |
| 117 rtcp_sender_.SetTimestampOffset(rtp_sender_->TimestampOffset()); | |
| 116 | 118 |
| 117 // Set default packet size limit. | 119 // Set default packet size limit. |
| 118 // TODO(nisse): Kind-of duplicates | 120 // TODO(nisse): Kind-of duplicates |
| 119 // webrtc::VideoSendStream::Config::Rtp::kDefaultMaxPacketSize. | 121 // webrtc::VideoSendStream::Config::Rtp::kDefaultMaxPacketSize. |
| 120 const size_t kTcpOverIpv4HeaderSize = 40; | 122 const size_t kTcpOverIpv4HeaderSize = 40; |
| 121 SetMaxRtpPacketSize(IP_PACKET_SIZE - kTcpOverIpv4HeaderSize); | 123 SetMaxRtpPacketSize(IP_PACKET_SIZE - kTcpOverIpv4HeaderSize); |
| 124 } | |
| 122 } | 125 } |
| 123 | 126 |
| 124 // Returns the number of milliseconds until the module want a worker thread | 127 // Returns the number of milliseconds until the module want a worker thread |
| 125 // to call Process. | 128 // to call Process. |
| 126 int64_t ModuleRtpRtcpImpl::TimeUntilNextProcess() { | 129 int64_t ModuleRtpRtcpImpl::TimeUntilNextProcess() { |
| 127 const int64_t now = clock_->TimeInMilliseconds(); | 130 const int64_t now = clock_->TimeInMilliseconds(); |
| 128 const int64_t kRtpRtcpMaxIdleTimeProcessMs = 5; | 131 const int64_t kRtpRtcpMaxIdleTimeProcessMs = 5; |
| 129 return kRtpRtcpMaxIdleTimeProcessMs - (now - last_process_time_); | 132 return kRtpRtcpMaxIdleTimeProcessMs - (now - last_process_time_); |
| 130 } | 133 } |
| 131 | 134 |
| 132 // Process any pending tasks such as timeouts (non time critical events). | 135 // Process any pending tasks such as timeouts (non time critical events). |
| 133 void ModuleRtpRtcpImpl::Process() { | 136 void ModuleRtpRtcpImpl::Process() { |
| 134 const int64_t now = clock_->TimeInMilliseconds(); | 137 const int64_t now = clock_->TimeInMilliseconds(); |
| 135 last_process_time_ = now; | 138 last_process_time_ = now; |
| 136 | 139 |
| 137 const int64_t kRtpRtcpBitrateProcessTimeMs = 10; | 140 if (rtp_sender_) { |
| 138 if (now >= last_bitrate_process_time_ + kRtpRtcpBitrateProcessTimeMs) { | 141 const int64_t kRtpRtcpBitrateProcessTimeMs = 10; |
| 139 rtp_sender_.ProcessBitrate(); | 142 if (now >= last_bitrate_process_time_ + kRtpRtcpBitrateProcessTimeMs) { |
| 140 last_bitrate_process_time_ = now; | 143 rtp_sender_->ProcessBitrate(); |
| 144 last_bitrate_process_time_ = now; | |
| 145 } | |
| 141 } | 146 } |
| 142 | |
| 143 const int64_t kRtpRtcpRttProcessTimeMs = 1000; | 147 const int64_t kRtpRtcpRttProcessTimeMs = 1000; |
| 144 bool process_rtt = now >= last_rtt_process_time_ + kRtpRtcpRttProcessTimeMs; | 148 bool process_rtt = now >= last_rtt_process_time_ + kRtpRtcpRttProcessTimeMs; |
| 145 if (rtcp_sender_.Sending()) { | 149 if (rtcp_sender_.Sending()) { |
| 146 // Process RTT if we have received a receiver report and we haven't | 150 // Process RTT if we have received a receiver report and we haven't |
| 147 // processed RTT for at least |kRtpRtcpRttProcessTimeMs| milliseconds. | 151 // processed RTT for at least |kRtpRtcpRttProcessTimeMs| milliseconds. |
| 148 if (rtcp_receiver_.LastReceivedReceiverReport() > | 152 if (rtcp_receiver_.LastReceivedReceiverReport() > |
| 149 last_rtt_process_time_ && process_rtt) { | 153 last_rtt_process_time_ && process_rtt) { |
| 150 std::vector<RTCPReportBlock> receive_blocks; | 154 std::vector<RTCPReportBlock> receive_blocks; |
| 151 rtcp_receiver_.StatisticsReceived(&receive_blocks); | 155 rtcp_receiver_.StatisticsReceived(&receive_blocks); |
| 152 int64_t max_rtt = 0; | 156 int64_t max_rtt = 0; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 | 208 |
| 205 if (rtcp_sender_.TimeToSendRTCPReport()) | 209 if (rtcp_sender_.TimeToSendRTCPReport()) |
| 206 rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport); | 210 rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport); |
| 207 | 211 |
| 208 if (TMMBR() && rtcp_receiver_.UpdateTmmbrTimers()) { | 212 if (TMMBR() && rtcp_receiver_.UpdateTmmbrTimers()) { |
| 209 rtcp_receiver_.NotifyTmmbrUpdated(); | 213 rtcp_receiver_.NotifyTmmbrUpdated(); |
| 210 } | 214 } |
| 211 } | 215 } |
| 212 | 216 |
| 213 void ModuleRtpRtcpImpl::SetRtxSendStatus(int mode) { | 217 void ModuleRtpRtcpImpl::SetRtxSendStatus(int mode) { |
| 214 rtp_sender_.SetRtxStatus(mode); | 218 rtp_sender_->SetRtxStatus(mode); |
| 215 } | 219 } |
| 216 | 220 |
| 217 int ModuleRtpRtcpImpl::RtxSendStatus() const { | 221 int ModuleRtpRtcpImpl::RtxSendStatus() const { |
| 218 return rtp_sender_.RtxStatus(); | 222 return rtp_sender_ ? rtp_sender_->RtxStatus() : kRtxOff; |
| 219 } | 223 } |
| 220 | 224 |
| 221 void ModuleRtpRtcpImpl::SetRtxSsrc(uint32_t ssrc) { | 225 void ModuleRtpRtcpImpl::SetRtxSsrc(uint32_t ssrc) { |
| 222 rtp_sender_.SetRtxSsrc(ssrc); | 226 rtp_sender_->SetRtxSsrc(ssrc); |
| 223 } | 227 } |
| 224 | 228 |
| 225 void ModuleRtpRtcpImpl::SetRtxSendPayloadType(int payload_type, | 229 void ModuleRtpRtcpImpl::SetRtxSendPayloadType(int payload_type, |
| 226 int associated_payload_type) { | 230 int associated_payload_type) { |
| 227 rtp_sender_.SetRtxPayloadType(payload_type, associated_payload_type); | 231 rtp_sender_->SetRtxPayloadType(payload_type, associated_payload_type); |
| 228 } | 232 } |
| 229 | 233 |
| 230 rtc::Optional<uint32_t> ModuleRtpRtcpImpl::FlexfecSsrc() const { | 234 rtc::Optional<uint32_t> ModuleRtpRtcpImpl::FlexfecSsrc() const { |
| 231 return rtp_sender_.FlexfecSsrc(); | 235 return rtp_sender_->FlexfecSsrc(); |
| 232 } | 236 } |
| 233 | 237 |
| 234 int32_t ModuleRtpRtcpImpl::IncomingRtcpPacket( | 238 int32_t ModuleRtpRtcpImpl::IncomingRtcpPacket( |
| 235 const uint8_t* rtcp_packet, | 239 const uint8_t* rtcp_packet, |
| 236 const size_t length) { | 240 const size_t length) { |
| 237 return rtcp_receiver_.IncomingPacket(rtcp_packet, length) ? 0 : -1; | 241 return rtcp_receiver_.IncomingPacket(rtcp_packet, length) ? 0 : -1; |
| 238 } | 242 } |
| 239 | 243 |
| 240 int32_t ModuleRtpRtcpImpl::RegisterSendPayload( | 244 int32_t ModuleRtpRtcpImpl::RegisterSendPayload( |
| 241 const CodecInst& voice_codec) { | 245 const CodecInst& voice_codec) { |
| 242 return rtp_sender_.RegisterPayload( | 246 return rtp_sender_->RegisterPayload( |
| 243 voice_codec.plname, voice_codec.pltype, voice_codec.plfreq, | 247 voice_codec.plname, voice_codec.pltype, voice_codec.plfreq, |
| 244 voice_codec.channels, (voice_codec.rate < 0) ? 0 : voice_codec.rate); | 248 voice_codec.channels, (voice_codec.rate < 0) ? 0 : voice_codec.rate); |
| 245 } | 249 } |
| 246 | 250 |
| 247 int32_t ModuleRtpRtcpImpl::RegisterSendPayload(const VideoCodec& video_codec) { | 251 int32_t ModuleRtpRtcpImpl::RegisterSendPayload(const VideoCodec& video_codec) { |
| 248 return rtp_sender_.RegisterPayload(video_codec.plName, video_codec.plType, | 252 return rtp_sender_->RegisterPayload(video_codec.plName, video_codec.plType, |
| 249 90000, 0, 0); | 253 90000, 0, 0); |
| 250 } | 254 } |
| 251 | 255 |
| 252 void ModuleRtpRtcpImpl::RegisterVideoSendPayload(int payload_type, | 256 void ModuleRtpRtcpImpl::RegisterVideoSendPayload(int payload_type, |
| 253 const char* payload_name) { | 257 const char* payload_name) { |
| 254 RTC_CHECK_EQ( | 258 RTC_CHECK_EQ( |
| 255 0, rtp_sender_.RegisterPayload(payload_name, payload_type, 90000, 0, 0)); | 259 0, rtp_sender_->RegisterPayload(payload_name, payload_type, 90000, 0, 0)); |
| 256 } | 260 } |
| 257 | 261 |
| 258 int32_t ModuleRtpRtcpImpl::DeRegisterSendPayload(const int8_t payload_type) { | 262 int32_t ModuleRtpRtcpImpl::DeRegisterSendPayload(const int8_t payload_type) { |
| 259 return rtp_sender_.DeRegisterSendPayload(payload_type); | 263 return rtp_sender_->DeRegisterSendPayload(payload_type); |
| 260 } | |
| 261 | |
| 262 int8_t ModuleRtpRtcpImpl::SendPayloadType() const { | |
| 263 return rtp_sender_.SendPayloadType(); | |
| 264 } | 264 } |
| 265 | 265 |
| 266 uint32_t ModuleRtpRtcpImpl::StartTimestamp() const { | 266 uint32_t ModuleRtpRtcpImpl::StartTimestamp() const { |
| 267 return rtp_sender_.TimestampOffset(); | 267 return rtp_sender_->TimestampOffset(); |
| 268 } | 268 } |
| 269 | 269 |
| 270 // Configure start timestamp, default is a random number. | 270 // Configure start timestamp, default is a random number. |
| 271 void ModuleRtpRtcpImpl::SetStartTimestamp(const uint32_t timestamp) { | 271 void ModuleRtpRtcpImpl::SetStartTimestamp(const uint32_t timestamp) { |
| 272 rtcp_sender_.SetTimestampOffset(timestamp); | 272 rtcp_sender_.SetTimestampOffset(timestamp); |
| 273 rtp_sender_.SetTimestampOffset(timestamp); | 273 rtp_sender_->SetTimestampOffset(timestamp); |
| 274 } | 274 } |
| 275 | 275 |
| 276 uint16_t ModuleRtpRtcpImpl::SequenceNumber() const { | 276 uint16_t ModuleRtpRtcpImpl::SequenceNumber() const { |
| 277 return rtp_sender_.SequenceNumber(); | 277 return rtp_sender_->SequenceNumber(); |
| 278 } | 278 } |
| 279 | 279 |
| 280 // Set SequenceNumber, default is a random number. | 280 // Set SequenceNumber, default is a random number. |
| 281 void ModuleRtpRtcpImpl::SetSequenceNumber(const uint16_t seq_num) { | 281 void ModuleRtpRtcpImpl::SetSequenceNumber(const uint16_t seq_num) { |
| 282 rtp_sender_.SetSequenceNumber(seq_num); | 282 rtp_sender_->SetSequenceNumber(seq_num); |
| 283 } | 283 } |
| 284 | 284 |
| 285 void ModuleRtpRtcpImpl::SetRtpState(const RtpState& rtp_state) { | 285 void ModuleRtpRtcpImpl::SetRtpState(const RtpState& rtp_state) { |
| 286 rtp_sender_.SetRtpState(rtp_state); | 286 rtp_sender_->SetRtpState(rtp_state); |
| 287 rtcp_sender_.SetTimestampOffset(rtp_state.start_timestamp); | 287 rtcp_sender_.SetTimestampOffset(rtp_state.start_timestamp); |
| 288 } | 288 } |
| 289 | 289 |
| 290 void ModuleRtpRtcpImpl::SetRtxState(const RtpState& rtp_state) { | 290 void ModuleRtpRtcpImpl::SetRtxState(const RtpState& rtp_state) { |
| 291 rtp_sender_.SetRtxRtpState(rtp_state); | 291 rtp_sender_->SetRtxRtpState(rtp_state); |
| 292 } | 292 } |
| 293 | 293 |
| 294 RtpState ModuleRtpRtcpImpl::GetRtpState() const { | 294 RtpState ModuleRtpRtcpImpl::GetRtpState() const { |
| 295 return rtp_sender_.GetRtpState(); | 295 return rtp_sender_->GetRtpState(); |
| 296 } | 296 } |
| 297 | 297 |
| 298 RtpState ModuleRtpRtcpImpl::GetRtxState() const { | 298 RtpState ModuleRtpRtcpImpl::GetRtxState() const { |
| 299 return rtp_sender_.GetRtxRtpState(); | 299 return rtp_sender_->GetRtxRtpState(); |
| 300 } | 300 } |
| 301 | 301 |
| 302 uint32_t ModuleRtpRtcpImpl::SSRC() const { | 302 uint32_t ModuleRtpRtcpImpl::SSRC() const { |
| 303 return rtp_sender_.SSRC(); | 303 return rtcp_sender_.SSRC(); |
| 304 } | 304 } |
| 305 | 305 |
| 306 void ModuleRtpRtcpImpl::SetSSRC(const uint32_t ssrc) { | 306 void ModuleRtpRtcpImpl::SetSSRC(const uint32_t ssrc) { |
| 307 rtp_sender_.SetSSRC(ssrc); | 307 if (rtp_sender_) { |
| 308 rtp_sender_->SetSSRC(ssrc); | |
| 309 } | |
| 308 rtcp_sender_.SetSSRC(ssrc); | 310 rtcp_sender_.SetSSRC(ssrc); |
| 309 SetRtcpReceiverSsrcs(ssrc); | 311 SetRtcpReceiverSsrcs(ssrc); |
| 310 } | 312 } |
| 311 | 313 |
| 312 void ModuleRtpRtcpImpl::SetCsrcs(const std::vector<uint32_t>& csrcs) { | 314 void ModuleRtpRtcpImpl::SetCsrcs(const std::vector<uint32_t>& csrcs) { |
| 313 rtcp_sender_.SetCsrcs(csrcs); | 315 rtcp_sender_.SetCsrcs(csrcs); |
| 314 rtp_sender_.SetCsrcs(csrcs); | 316 rtp_sender_->SetCsrcs(csrcs); |
| 315 } | 317 } |
| 316 | 318 |
| 317 // TODO(pbos): Handle media and RTX streams separately (separate RTCP | 319 // TODO(pbos): Handle media and RTX streams separately (separate RTCP |
| 318 // feedbacks). | 320 // feedbacks). |
| 321 // TODO(nisse): This is currently called also when receiver_only is true. Hence | |
|
danilchap
2017/03/10 15:48:12
this called when rtcp should be send, it collects
nisse-webrtc
2017/03/13 08:20:10
What info is relevant in the receive receiver_only
danilchap
2017/03/13 12:40:09
yes, those are used on recieve side.
state.module
| |
| 322 // below checks that rtp_sender_ exists. Does that make any sense? | |
| 319 RTCPSender::FeedbackState ModuleRtpRtcpImpl::GetFeedbackState() { | 323 RTCPSender::FeedbackState ModuleRtpRtcpImpl::GetFeedbackState() { |
| 320 StreamDataCounters rtp_stats; | 324 StreamDataCounters rtp_stats; |
| 321 StreamDataCounters rtx_stats; | 325 StreamDataCounters rtx_stats; |
| 322 rtp_sender_.GetDataCounters(&rtp_stats, &rtx_stats); | |
| 323 | |
| 324 RTCPSender::FeedbackState state; | 326 RTCPSender::FeedbackState state; |
| 325 state.send_payload_type = SendPayloadType(); | 327 if (rtp_sender_) { |
| 328 rtp_sender_->GetDataCounters(&rtp_stats, &rtx_stats); | |
| 329 state.send_payload_type = rtp_sender_->SendPayloadType(); | |
| 330 state.send_bitrate = rtp_sender_->BitrateSent(); | |
| 331 } else { | |
| 332 // The default value for RTPSender::payload_type_ is -1, | |
| 333 // use same value if RTPSender is missing. | |
| 334 state.send_payload_type = static_cast<uint8_t>(-1); | |
| 335 state.send_bitrate = 0; | |
| 336 } | |
| 326 state.packets_sent = rtp_stats.transmitted.packets + | 337 state.packets_sent = rtp_stats.transmitted.packets + |
|
danilchap
2017/03/10 15:48:12
this and next field doesn't make sense if rtp_send
nisse-webrtc
2017/03/13 08:20:10
Fixed.
| |
| 327 rtx_stats.transmitted.packets; | 338 rtx_stats.transmitted.packets; |
| 328 state.media_bytes_sent = rtp_stats.transmitted.payload_bytes + | 339 state.media_bytes_sent = rtp_stats.transmitted.payload_bytes + |
| 329 rtx_stats.transmitted.payload_bytes; | 340 rtx_stats.transmitted.payload_bytes; |
| 330 state.module = this; | 341 state.module = this; |
| 331 | 342 |
| 332 LastReceivedNTP(&state.last_rr_ntp_secs, | 343 LastReceivedNTP(&state.last_rr_ntp_secs, |
| 333 &state.last_rr_ntp_frac, | 344 &state.last_rr_ntp_frac, |
| 334 &state.remote_sr); | 345 &state.remote_sr); |
| 335 | 346 |
| 336 state.has_last_xr_rr = | 347 state.has_last_xr_rr = |
| 337 rtcp_receiver_.LastReceivedXrReferenceTimeInfo(&state.last_xr_rr); | 348 rtcp_receiver_.LastReceivedXrReferenceTimeInfo(&state.last_xr_rr); |
| 338 | 349 |
| 339 uint32_t tmp; | |
| 340 BitrateSent(&state.send_bitrate, &tmp, &tmp, &tmp); | |
| 341 return state; | 350 return state; |
| 342 } | 351 } |
| 343 | 352 |
| 353 // TODO(nisse): The | |
| 354 // TestWithNewVideoJitterBuffer/EndToEndTest.RembWithSendSideBwe/* tests call | |
| 355 // this method for a receive-only stream, which makes little sense. If that is | |
| 356 // fixed, the rtp_sender_ check can be removed. | |
| 344 int32_t ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) { | 357 int32_t ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) { |
| 345 if (rtcp_sender_.Sending() != sending) { | 358 if (rtcp_sender_.Sending() != sending) { |
| 346 // Sends RTCP BYE when going from true to false | 359 // Sends RTCP BYE when going from true to false |
| 347 if (rtcp_sender_.SetSendingStatus(GetFeedbackState(), sending) != 0) { | 360 if (rtcp_sender_.SetSendingStatus(GetFeedbackState(), sending) != 0) { |
| 348 LOG(LS_WARNING) << "Failed to send RTCP BYE"; | 361 LOG(LS_WARNING) << "Failed to send RTCP BYE"; |
| 349 } | 362 } |
| 350 if (sending) { | 363 if (sending && rtp_sender_) { |
| 351 // Update Rtcp receiver config, to track Rtx config changes from | 364 // Update Rtcp receiver config, to track Rtx config changes from |
| 352 // the SetRtxStatus and SetRtxSsrc methods. | 365 // the SetRtxStatus and SetRtxSsrc methods. |
| 353 SetRtcpReceiverSsrcs(rtp_sender_.SSRC()); | 366 SetRtcpReceiverSsrcs(rtp_sender_->SSRC()); |
| 354 } | 367 } |
| 355 } | 368 } |
| 356 return 0; | 369 return 0; |
| 357 } | 370 } |
| 358 | 371 |
| 359 bool ModuleRtpRtcpImpl::Sending() const { | 372 bool ModuleRtpRtcpImpl::Sending() const { |
| 360 return rtcp_sender_.Sending(); | 373 return rtcp_sender_.Sending(); |
| 361 } | 374 } |
| 362 | 375 |
| 363 void ModuleRtpRtcpImpl::SetSendingMediaStatus(const bool sending) { | 376 void ModuleRtpRtcpImpl::SetSendingMediaStatus(const bool sending) { |
| 364 rtp_sender_.SetSendingMediaStatus(sending); | 377 rtp_sender_->SetSendingMediaStatus(sending); |
| 365 } | 378 } |
| 366 | 379 |
| 367 bool ModuleRtpRtcpImpl::SendingMedia() const { | 380 bool ModuleRtpRtcpImpl::SendingMedia() const { |
| 368 return rtp_sender_.SendingMedia(); | 381 return rtp_sender_ ? rtp_sender_->SendingMedia() : false; |
| 369 } | 382 } |
| 370 | 383 |
| 371 bool ModuleRtpRtcpImpl::SendOutgoingData( | 384 bool ModuleRtpRtcpImpl::SendOutgoingData( |
| 372 FrameType frame_type, | 385 FrameType frame_type, |
| 373 int8_t payload_type, | 386 int8_t payload_type, |
| 374 uint32_t time_stamp, | 387 uint32_t time_stamp, |
| 375 int64_t capture_time_ms, | 388 int64_t capture_time_ms, |
| 376 const uint8_t* payload_data, | 389 const uint8_t* payload_data, |
| 377 size_t payload_size, | 390 size_t payload_size, |
| 378 const RTPFragmentationHeader* fragmentation, | 391 const RTPFragmentationHeader* fragmentation, |
| 379 const RTPVideoHeader* rtp_video_header, | 392 const RTPVideoHeader* rtp_video_header, |
| 380 uint32_t* transport_frame_id_out) { | 393 uint32_t* transport_frame_id_out) { |
| 381 rtcp_sender_.SetLastRtpTime(time_stamp, capture_time_ms); | 394 rtcp_sender_.SetLastRtpTime(time_stamp, capture_time_ms); |
| 382 // Make sure an RTCP report isn't queued behind a key frame. | 395 // Make sure an RTCP report isn't queued behind a key frame. |
| 383 if (rtcp_sender_.TimeToSendRTCPReport(kVideoFrameKey == frame_type)) { | 396 if (rtcp_sender_.TimeToSendRTCPReport(kVideoFrameKey == frame_type)) { |
| 384 rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport); | 397 rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport); |
| 385 } | 398 } |
| 386 return rtp_sender_.SendOutgoingData( | 399 return rtp_sender_->SendOutgoingData( |
| 387 frame_type, payload_type, time_stamp, capture_time_ms, payload_data, | 400 frame_type, payload_type, time_stamp, capture_time_ms, payload_data, |
| 388 payload_size, fragmentation, rtp_video_header, transport_frame_id_out); | 401 payload_size, fragmentation, rtp_video_header, transport_frame_id_out); |
| 389 } | 402 } |
| 390 | 403 |
| 391 bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc, | 404 bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc, |
| 392 uint16_t sequence_number, | 405 uint16_t sequence_number, |
| 393 int64_t capture_time_ms, | 406 int64_t capture_time_ms, |
| 394 bool retransmission, | 407 bool retransmission, |
| 395 const PacedPacketInfo& pacing_info) { | 408 const PacedPacketInfo& pacing_info) { |
| 396 return rtp_sender_.TimeToSendPacket(ssrc, sequence_number, capture_time_ms, | 409 return rtp_sender_->TimeToSendPacket(ssrc, sequence_number, capture_time_ms, |
| 397 retransmission, pacing_info); | 410 retransmission, pacing_info); |
| 398 } | 411 } |
| 399 | 412 |
| 400 size_t ModuleRtpRtcpImpl::TimeToSendPadding( | 413 size_t ModuleRtpRtcpImpl::TimeToSendPadding( |
| 401 size_t bytes, | 414 size_t bytes, |
| 402 const PacedPacketInfo& pacing_info) { | 415 const PacedPacketInfo& pacing_info) { |
| 403 return rtp_sender_.TimeToSendPadding(bytes, pacing_info); | 416 return rtp_sender_->TimeToSendPadding(bytes, pacing_info); |
| 404 } | 417 } |
| 405 | 418 |
| 406 size_t ModuleRtpRtcpImpl::MaxPayloadSize() const { | 419 size_t ModuleRtpRtcpImpl::MaxPayloadSize() const { |
| 407 return rtp_sender_.MaxPayloadSize(); | 420 return rtp_sender_->MaxPayloadSize(); |
| 408 } | 421 } |
| 409 | 422 |
| 410 size_t ModuleRtpRtcpImpl::MaxRtpPacketSize() const { | 423 size_t ModuleRtpRtcpImpl::MaxRtpPacketSize() const { |
| 411 return rtp_sender_.MaxRtpPacketSize(); | 424 return rtp_sender_->MaxRtpPacketSize(); |
| 412 } | 425 } |
| 413 | 426 |
| 414 void ModuleRtpRtcpImpl::SetMaxRtpPacketSize(size_t rtp_packet_size) { | 427 void ModuleRtpRtcpImpl::SetMaxRtpPacketSize(size_t rtp_packet_size) { |
| 415 RTC_DCHECK_LE(rtp_packet_size, IP_PACKET_SIZE) | 428 RTC_DCHECK_LE(rtp_packet_size, IP_PACKET_SIZE) |
| 416 << "rtp packet size too large: " << rtp_packet_size; | 429 << "rtp packet size too large: " << rtp_packet_size; |
| 417 RTC_DCHECK_GT(rtp_packet_size, packet_overhead_) | 430 RTC_DCHECK_GT(rtp_packet_size, packet_overhead_) |
| 418 << "rtp packet size too small: " << rtp_packet_size; | 431 << "rtp packet size too small: " << rtp_packet_size; |
| 419 | 432 |
| 420 rtcp_sender_.SetMaxRtpPacketSize(rtp_packet_size); | 433 rtcp_sender_.SetMaxRtpPacketSize(rtp_packet_size); |
| 421 rtp_sender_.SetMaxRtpPacketSize(rtp_packet_size); | 434 rtp_sender_->SetMaxRtpPacketSize(rtp_packet_size); |
| 422 } | 435 } |
| 423 | 436 |
| 424 RtcpMode ModuleRtpRtcpImpl::RTCP() const { | 437 RtcpMode ModuleRtpRtcpImpl::RTCP() const { |
| 425 return rtcp_sender_.Status(); | 438 return rtcp_sender_.Status(); |
| 426 } | 439 } |
| 427 | 440 |
| 428 // Configure RTCP status i.e on/off. | 441 // Configure RTCP status i.e on/off. |
| 429 void ModuleRtpRtcpImpl::SetRTCPStatus(const RtcpMode method) { | 442 void ModuleRtpRtcpImpl::SetRTCPStatus(const RtcpMode method) { |
| 430 rtcp_sender_.SetRTCPStatus(method); | 443 rtcp_sender_.SetRTCPStatus(method); |
| 431 } | 444 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 512 bool ModuleRtpRtcpImpl::RtcpXrRrtrStatus() const { | 525 bool ModuleRtpRtcpImpl::RtcpXrRrtrStatus() const { |
| 513 return rtcp_sender_.RtcpXrReceiverReferenceTime(); | 526 return rtcp_sender_.RtcpXrReceiverReferenceTime(); |
| 514 } | 527 } |
| 515 | 528 |
| 516 // TODO(asapersson): Replace this method with the one below. | 529 // TODO(asapersson): Replace this method with the one below. |
| 517 int32_t ModuleRtpRtcpImpl::DataCountersRTP( | 530 int32_t ModuleRtpRtcpImpl::DataCountersRTP( |
| 518 size_t* bytes_sent, | 531 size_t* bytes_sent, |
| 519 uint32_t* packets_sent) const { | 532 uint32_t* packets_sent) const { |
| 520 StreamDataCounters rtp_stats; | 533 StreamDataCounters rtp_stats; |
| 521 StreamDataCounters rtx_stats; | 534 StreamDataCounters rtx_stats; |
| 522 rtp_sender_.GetDataCounters(&rtp_stats, &rtx_stats); | 535 rtp_sender_->GetDataCounters(&rtp_stats, &rtx_stats); |
| 523 | 536 |
| 524 if (bytes_sent) { | 537 if (bytes_sent) { |
| 525 *bytes_sent = rtp_stats.transmitted.payload_bytes + | 538 *bytes_sent = rtp_stats.transmitted.payload_bytes + |
| 526 rtp_stats.transmitted.padding_bytes + | 539 rtp_stats.transmitted.padding_bytes + |
| 527 rtp_stats.transmitted.header_bytes + | 540 rtp_stats.transmitted.header_bytes + |
| 528 rtx_stats.transmitted.payload_bytes + | 541 rtx_stats.transmitted.payload_bytes + |
| 529 rtx_stats.transmitted.padding_bytes + | 542 rtx_stats.transmitted.padding_bytes + |
| 530 rtx_stats.transmitted.header_bytes; | 543 rtx_stats.transmitted.header_bytes; |
| 531 } | 544 } |
| 532 if (packets_sent) { | 545 if (packets_sent) { |
| 533 *packets_sent = rtp_stats.transmitted.packets + | 546 *packets_sent = rtp_stats.transmitted.packets + |
| 534 rtx_stats.transmitted.packets; | 547 rtx_stats.transmitted.packets; |
| 535 } | 548 } |
| 536 return 0; | 549 return 0; |
| 537 } | 550 } |
| 538 | 551 |
| 539 void ModuleRtpRtcpImpl::GetSendStreamDataCounters( | 552 void ModuleRtpRtcpImpl::GetSendStreamDataCounters( |
| 540 StreamDataCounters* rtp_counters, | 553 StreamDataCounters* rtp_counters, |
| 541 StreamDataCounters* rtx_counters) const { | 554 StreamDataCounters* rtx_counters) const { |
| 542 rtp_sender_.GetDataCounters(rtp_counters, rtx_counters); | 555 rtp_sender_->GetDataCounters(rtp_counters, rtx_counters); |
| 543 } | 556 } |
| 544 | 557 |
| 545 void ModuleRtpRtcpImpl::GetRtpPacketLossStats( | 558 void ModuleRtpRtcpImpl::GetRtpPacketLossStats( |
| 546 bool outgoing, | 559 bool outgoing, |
| 547 uint32_t ssrc, | 560 uint32_t ssrc, |
| 548 struct RtpPacketLossStats* loss_stats) const { | 561 struct RtpPacketLossStats* loss_stats) const { |
| 549 if (!loss_stats) return; | 562 if (!loss_stats) return; |
| 550 const PacketLossStats* stats_source = NULL; | 563 const PacketLossStats* stats_source = NULL; |
| 551 if (outgoing) { | 564 if (outgoing) { |
| 552 if (SSRC() == ssrc) { | 565 if (SSRC() == ssrc) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 587 } | 600 } |
| 588 | 601 |
| 589 void ModuleRtpRtcpImpl::SetREMBData(const uint32_t bitrate, | 602 void ModuleRtpRtcpImpl::SetREMBData(const uint32_t bitrate, |
| 590 const std::vector<uint32_t>& ssrcs) { | 603 const std::vector<uint32_t>& ssrcs) { |
| 591 rtcp_sender_.SetREMBData(bitrate, ssrcs); | 604 rtcp_sender_.SetREMBData(bitrate, ssrcs); |
| 592 } | 605 } |
| 593 | 606 |
| 594 int32_t ModuleRtpRtcpImpl::RegisterSendRtpHeaderExtension( | 607 int32_t ModuleRtpRtcpImpl::RegisterSendRtpHeaderExtension( |
| 595 const RTPExtensionType type, | 608 const RTPExtensionType type, |
| 596 const uint8_t id) { | 609 const uint8_t id) { |
| 597 return rtp_sender_.RegisterRtpHeaderExtension(type, id); | 610 return rtp_sender_->RegisterRtpHeaderExtension(type, id); |
| 598 } | 611 } |
| 599 | 612 |
| 600 int32_t ModuleRtpRtcpImpl::DeregisterSendRtpHeaderExtension( | 613 int32_t ModuleRtpRtcpImpl::DeregisterSendRtpHeaderExtension( |
| 601 const RTPExtensionType type) { | 614 const RTPExtensionType type) { |
| 602 return rtp_sender_.DeregisterRtpHeaderExtension(type); | 615 return rtp_sender_->DeregisterRtpHeaderExtension(type); |
| 603 } | 616 } |
| 604 | 617 |
| 605 bool ModuleRtpRtcpImpl::HasBweExtensions() const { | 618 bool ModuleRtpRtcpImpl::HasBweExtensions() const { |
| 606 return rtp_sender_.IsRtpHeaderExtensionRegistered( | 619 return rtp_sender_->IsRtpHeaderExtensionRegistered( |
| 607 kRtpExtensionTransportSequenceNumber) || | 620 kRtpExtensionTransportSequenceNumber) || |
| 608 rtp_sender_.IsRtpHeaderExtensionRegistered( | 621 rtp_sender_->IsRtpHeaderExtensionRegistered( |
| 609 kRtpExtensionAbsoluteSendTime) || | 622 kRtpExtensionAbsoluteSendTime) || |
| 610 rtp_sender_.IsRtpHeaderExtensionRegistered( | 623 rtp_sender_->IsRtpHeaderExtensionRegistered( |
| 611 kRtpExtensionTransmissionTimeOffset); | 624 kRtpExtensionTransmissionTimeOffset); |
| 612 } | 625 } |
| 613 | 626 |
| 614 // (TMMBR) Temporary Max Media Bit Rate. | 627 // (TMMBR) Temporary Max Media Bit Rate. |
| 615 bool ModuleRtpRtcpImpl::TMMBR() const { | 628 bool ModuleRtpRtcpImpl::TMMBR() const { |
| 616 return rtcp_sender_.TMMBR(); | 629 return rtcp_sender_.TMMBR(); |
| 617 } | 630 } |
| 618 | 631 |
| 619 void ModuleRtpRtcpImpl::SetTMMBRStatus(const bool enable) { | 632 void ModuleRtpRtcpImpl::SetTMMBRStatus(const bool enable) { |
| 620 rtcp_sender_.SetTMMBRStatus(enable); | 633 rtcp_sender_.SetTMMBRStatus(enable); |
| 621 } | 634 } |
| 622 | 635 |
| 623 void ModuleRtpRtcpImpl::SetTmmbn(std::vector<rtcp::TmmbItem> bounding_set) { | 636 void ModuleRtpRtcpImpl::SetTmmbn(std::vector<rtcp::TmmbItem> bounding_set) { |
| 624 rtcp_sender_.SetTmmbn(std::move(bounding_set)); | 637 rtcp_sender_.SetTmmbn(std::move(bounding_set)); |
| 625 } | 638 } |
| 626 | 639 |
| 627 // Returns the currently configured retransmission mode. | 640 // Returns the currently configured retransmission mode. |
| 628 int ModuleRtpRtcpImpl::SelectiveRetransmissions() const { | 641 int ModuleRtpRtcpImpl::SelectiveRetransmissions() const { |
| 629 return rtp_sender_.SelectiveRetransmissions(); | 642 return rtp_sender_->SelectiveRetransmissions(); |
| 630 } | 643 } |
| 631 | 644 |
| 632 // Enable or disable a retransmission mode, which decides which packets will | 645 // Enable or disable a retransmission mode, which decides which packets will |
| 633 // be retransmitted if NACKed. | 646 // be retransmitted if NACKed. |
| 634 int ModuleRtpRtcpImpl::SetSelectiveRetransmissions(uint8_t settings) { | 647 int ModuleRtpRtcpImpl::SetSelectiveRetransmissions(uint8_t settings) { |
| 635 return rtp_sender_.SetSelectiveRetransmissions(settings); | 648 return rtp_sender_->SetSelectiveRetransmissions(settings); |
| 636 } | 649 } |
| 637 | 650 |
| 638 // Send a Negative acknowledgment packet. | 651 // Send a Negative acknowledgment packet. |
| 639 int32_t ModuleRtpRtcpImpl::SendNACK(const uint16_t* nack_list, | 652 int32_t ModuleRtpRtcpImpl::SendNACK(const uint16_t* nack_list, |
| 640 const uint16_t size) { | 653 const uint16_t size) { |
| 641 for (int i = 0; i < size; ++i) { | 654 for (int i = 0; i < size; ++i) { |
| 642 receive_loss_stats_.AddLostPacket(nack_list[i]); | 655 receive_loss_stats_.AddLostPacket(nack_list[i]); |
| 643 } | 656 } |
| 644 uint16_t nack_length = size; | 657 uint16_t nack_length = size; |
| 645 uint16_t start_id = 0; | 658 uint16_t start_id = 0; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 696 // Send a full NACK list once within every |wait_time|. | 709 // Send a full NACK list once within every |wait_time|. |
| 697 if (rtt_stats_) { | 710 if (rtt_stats_) { |
| 698 return now - nack_last_time_sent_full_ > wait_time; | 711 return now - nack_last_time_sent_full_ > wait_time; |
| 699 } | 712 } |
| 700 return now - nack_last_time_sent_full_prev_ > wait_time; | 713 return now - nack_last_time_sent_full_prev_ > wait_time; |
| 701 } | 714 } |
| 702 | 715 |
| 703 // Store the sent packets, needed to answer to Negative acknowledgment requests. | 716 // Store the sent packets, needed to answer to Negative acknowledgment requests. |
| 704 void ModuleRtpRtcpImpl::SetStorePacketsStatus(const bool enable, | 717 void ModuleRtpRtcpImpl::SetStorePacketsStatus(const bool enable, |
| 705 const uint16_t number_to_store) { | 718 const uint16_t number_to_store) { |
| 706 rtp_sender_.SetStorePacketsStatus(enable, number_to_store); | 719 rtp_sender_->SetStorePacketsStatus(enable, number_to_store); |
| 707 } | 720 } |
| 708 | 721 |
| 709 bool ModuleRtpRtcpImpl::StorePackets() const { | 722 bool ModuleRtpRtcpImpl::StorePackets() const { |
| 710 return rtp_sender_.StorePackets(); | 723 return rtp_sender_->StorePackets(); |
| 711 } | 724 } |
| 712 | 725 |
| 713 void ModuleRtpRtcpImpl::RegisterRtcpStatisticsCallback( | 726 void ModuleRtpRtcpImpl::RegisterRtcpStatisticsCallback( |
| 714 RtcpStatisticsCallback* callback) { | 727 RtcpStatisticsCallback* callback) { |
| 715 rtcp_receiver_.RegisterRtcpStatisticsCallback(callback); | 728 rtcp_receiver_.RegisterRtcpStatisticsCallback(callback); |
| 716 } | 729 } |
| 717 | 730 |
| 718 RtcpStatisticsCallback* ModuleRtpRtcpImpl::GetRtcpStatisticsCallback() { | 731 RtcpStatisticsCallback* ModuleRtpRtcpImpl::GetRtcpStatisticsCallback() { |
| 719 return rtcp_receiver_.GetRtcpStatisticsCallback(); | 732 return rtcp_receiver_.GetRtcpStatisticsCallback(); |
| 720 } | 733 } |
| 721 | 734 |
| 722 bool ModuleRtpRtcpImpl::SendFeedbackPacket( | 735 bool ModuleRtpRtcpImpl::SendFeedbackPacket( |
| 723 const rtcp::TransportFeedback& packet) { | 736 const rtcp::TransportFeedback& packet) { |
| 724 return rtcp_sender_.SendFeedbackPacket(packet); | 737 return rtcp_sender_.SendFeedbackPacket(packet); |
| 725 } | 738 } |
| 726 | 739 |
| 727 // Send a TelephoneEvent tone using RFC 2833 (4733). | 740 // Send a TelephoneEvent tone using RFC 2833 (4733). |
| 728 int32_t ModuleRtpRtcpImpl::SendTelephoneEventOutband( | 741 int32_t ModuleRtpRtcpImpl::SendTelephoneEventOutband( |
| 729 const uint8_t key, | 742 const uint8_t key, |
| 730 const uint16_t time_ms, | 743 const uint16_t time_ms, |
| 731 const uint8_t level) { | 744 const uint8_t level) { |
| 732 return rtp_sender_.SendTelephoneEvent(key, time_ms, level); | 745 return rtp_sender_->SendTelephoneEvent(key, time_ms, level); |
| 733 } | 746 } |
| 734 | 747 |
| 735 int32_t ModuleRtpRtcpImpl::SetAudioPacketSize( | 748 int32_t ModuleRtpRtcpImpl::SetAudioPacketSize( |
| 736 const uint16_t packet_size_samples) { | 749 const uint16_t packet_size_samples) { |
| 737 return audio_ ? 0 : -1; | 750 return audio_ ? 0 : -1; |
| 738 } | 751 } |
| 739 | 752 |
| 740 int32_t ModuleRtpRtcpImpl::SetAudioLevel( | 753 int32_t ModuleRtpRtcpImpl::SetAudioLevel( |
| 741 const uint8_t level_d_bov) { | 754 const uint8_t level_d_bov) { |
| 742 return rtp_sender_.SetAudioLevel(level_d_bov); | 755 return rtp_sender_->SetAudioLevel(level_d_bov); |
| 743 } | 756 } |
| 744 | 757 |
| 745 int32_t ModuleRtpRtcpImpl::SetKeyFrameRequestMethod( | 758 int32_t ModuleRtpRtcpImpl::SetKeyFrameRequestMethod( |
| 746 const KeyFrameRequestMethod method) { | 759 const KeyFrameRequestMethod method) { |
| 747 key_frame_req_method_ = method; | 760 key_frame_req_method_ = method; |
| 748 return 0; | 761 return 0; |
| 749 } | 762 } |
| 750 | 763 |
| 751 int32_t ModuleRtpRtcpImpl::RequestKeyFrame() { | 764 int32_t ModuleRtpRtcpImpl::RequestKeyFrame() { |
| 752 switch (key_frame_req_method_) { | 765 switch (key_frame_req_method_) { |
| 753 case kKeyFrameReqPliRtcp: | 766 case kKeyFrameReqPliRtcp: |
| 754 return SendRTCP(kRtcpPli); | 767 return SendRTCP(kRtcpPli); |
| 755 case kKeyFrameReqFirRtcp: | 768 case kKeyFrameReqFirRtcp: |
| 756 return SendRTCP(kRtcpFir); | 769 return SendRTCP(kRtcpFir); |
| 757 } | 770 } |
| 758 return -1; | 771 return -1; |
| 759 } | 772 } |
| 760 | 773 |
| 761 int32_t ModuleRtpRtcpImpl::SendRTCPSliceLossIndication(uint8_t picture_id) { | 774 int32_t ModuleRtpRtcpImpl::SendRTCPSliceLossIndication(uint8_t picture_id) { |
| 762 return rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpSli, 0, 0, picture_id); | 775 return rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpSli, 0, 0, picture_id); |
| 763 } | 776 } |
| 764 | 777 |
| 765 void ModuleRtpRtcpImpl::SetUlpfecConfig(int red_payload_type, | 778 void ModuleRtpRtcpImpl::SetUlpfecConfig(int red_payload_type, |
| 766 int ulpfec_payload_type) { | 779 int ulpfec_payload_type) { |
| 767 rtp_sender_.SetUlpfecConfig(red_payload_type, ulpfec_payload_type); | 780 rtp_sender_->SetUlpfecConfig(red_payload_type, ulpfec_payload_type); |
| 768 } | 781 } |
| 769 | 782 |
| 770 bool ModuleRtpRtcpImpl::SetFecParameters( | 783 bool ModuleRtpRtcpImpl::SetFecParameters( |
| 771 const FecProtectionParams& delta_params, | 784 const FecProtectionParams& delta_params, |
| 772 const FecProtectionParams& key_params) { | 785 const FecProtectionParams& key_params) { |
| 773 return rtp_sender_.SetFecParameters(delta_params, key_params); | 786 return rtp_sender_->SetFecParameters(delta_params, key_params); |
| 774 } | 787 } |
| 775 | 788 |
| 776 void ModuleRtpRtcpImpl::SetRemoteSSRC(const uint32_t ssrc) { | 789 void ModuleRtpRtcpImpl::SetRemoteSSRC(const uint32_t ssrc) { |
| 777 // Inform about the incoming SSRC. | 790 // Inform about the incoming SSRC. |
| 778 rtcp_sender_.SetRemoteSSRC(ssrc); | 791 rtcp_sender_.SetRemoteSSRC(ssrc); |
| 779 rtcp_receiver_.SetRemoteSSRC(ssrc); | 792 rtcp_receiver_.SetRemoteSSRC(ssrc); |
| 780 } | 793 } |
| 781 | 794 |
| 782 void ModuleRtpRtcpImpl::BitrateSent(uint32_t* total_rate, | 795 void ModuleRtpRtcpImpl::BitrateSent(uint32_t* total_rate, |
| 783 uint32_t* video_rate, | 796 uint32_t* video_rate, |
| 784 uint32_t* fec_rate, | 797 uint32_t* fec_rate, |
| 785 uint32_t* nack_rate) const { | 798 uint32_t* nack_rate) const { |
| 786 *total_rate = rtp_sender_.BitrateSent(); | 799 *total_rate = rtp_sender_->BitrateSent(); |
| 787 *video_rate = rtp_sender_.VideoBitrateSent(); | 800 *video_rate = rtp_sender_->VideoBitrateSent(); |
| 788 *fec_rate = rtp_sender_.FecOverheadRate(); | 801 *fec_rate = rtp_sender_->FecOverheadRate(); |
| 789 *nack_rate = rtp_sender_.NackOverheadRate(); | 802 *nack_rate = rtp_sender_->NackOverheadRate(); |
| 790 } | 803 } |
| 791 | 804 |
| 792 void ModuleRtpRtcpImpl::OnRequestSendReport() { | 805 void ModuleRtpRtcpImpl::OnRequestSendReport() { |
| 793 SendRTCP(kRtcpSr); | 806 SendRTCP(kRtcpSr); |
| 794 } | 807 } |
| 795 | 808 |
| 796 int32_t ModuleRtpRtcpImpl::SendRTCPReferencePictureSelection( | 809 int32_t ModuleRtpRtcpImpl::SendRTCPReferencePictureSelection( |
| 797 const uint64_t picture_id) { | 810 const uint64_t picture_id) { |
| 798 return rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpRpsi, 0, 0, picture_id); | 811 return rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpRpsi, 0, 0, picture_id); |
| 799 } | 812 } |
| 800 | 813 |
| 801 void ModuleRtpRtcpImpl::OnReceivedNack( | 814 void ModuleRtpRtcpImpl::OnReceivedNack( |
|
danilchap
2017/03/10 15:48:12
if receive-only client get an rtcp nack message, i
nisse-webrtc
2017/03/13 08:20:10
Done.
| |
| 802 const std::vector<uint16_t>& nack_sequence_numbers) { | 815 const std::vector<uint16_t>& nack_sequence_numbers) { |
| 803 for (uint16_t nack_sequence_number : nack_sequence_numbers) { | 816 for (uint16_t nack_sequence_number : nack_sequence_numbers) { |
| 804 send_loss_stats_.AddLostPacket(nack_sequence_number); | 817 send_loss_stats_.AddLostPacket(nack_sequence_number); |
| 805 } | 818 } |
| 806 if (!rtp_sender_.StorePackets() || | 819 if (!rtp_sender_->StorePackets() || |
| 807 nack_sequence_numbers.size() == 0) { | 820 nack_sequence_numbers.size() == 0) { |
| 808 return; | 821 return; |
| 809 } | 822 } |
| 810 // Use RTT from RtcpRttStats class if provided. | 823 // Use RTT from RtcpRttStats class if provided. |
| 811 int64_t rtt = rtt_ms(); | 824 int64_t rtt = rtt_ms(); |
| 812 if (rtt == 0) { | 825 if (rtt == 0) { |
| 813 rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), NULL, &rtt, NULL, NULL); | 826 rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), NULL, &rtt, NULL, NULL); |
| 814 } | 827 } |
| 815 rtp_sender_.OnReceivedNack(nack_sequence_numbers, rtt); | 828 rtp_sender_->OnReceivedNack(nack_sequence_numbers, rtt); |
| 816 } | 829 } |
| 817 | 830 |
| 818 void ModuleRtpRtcpImpl::OnReceivedRtcpReportBlocks( | 831 void ModuleRtpRtcpImpl::OnReceivedRtcpReportBlocks( |
| 819 const ReportBlockList& report_blocks) { | 832 const ReportBlockList& report_blocks) { |
| 820 rtp_sender_.OnReceivedRtcpReportBlocks(report_blocks); | 833 if (rtp_sender_) { |
|
danilchap
2017/03/10 15:48:12
in rtp module it is more common to omit {} around
nisse-webrtc
2017/03/13 08:20:10
Done.
| |
| 834 rtp_sender_->OnReceivedRtcpReportBlocks(report_blocks); | |
| 835 } | |
| 821 } | 836 } |
| 822 | 837 |
| 823 bool ModuleRtpRtcpImpl::LastReceivedNTP( | 838 bool ModuleRtpRtcpImpl::LastReceivedNTP( |
| 824 uint32_t* rtcp_arrival_time_secs, // When we got the last report. | 839 uint32_t* rtcp_arrival_time_secs, // When we got the last report. |
| 825 uint32_t* rtcp_arrival_time_frac, | 840 uint32_t* rtcp_arrival_time_frac, |
| 826 uint32_t* remote_sr) const { | 841 uint32_t* remote_sr) const { |
| 827 // Remote SR: NTP inside the last received (mid 16 bits from sec and frac). | 842 // Remote SR: NTP inside the last received (mid 16 bits from sec and frac). |
| 828 uint32_t ntp_secs = 0; | 843 uint32_t ntp_secs = 0; |
| 829 uint32_t ntp_frac = 0; | 844 uint32_t ntp_frac = 0; |
| 830 | 845 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 848 int64_t ModuleRtpRtcpImpl::RtcpReportInterval() { | 863 int64_t ModuleRtpRtcpImpl::RtcpReportInterval() { |
| 849 if (audio_) | 864 if (audio_) |
| 850 return RTCP_INTERVAL_AUDIO_MS; | 865 return RTCP_INTERVAL_AUDIO_MS; |
| 851 else | 866 else |
| 852 return RTCP_INTERVAL_VIDEO_MS; | 867 return RTCP_INTERVAL_VIDEO_MS; |
| 853 } | 868 } |
| 854 | 869 |
| 855 void ModuleRtpRtcpImpl::SetRtcpReceiverSsrcs(uint32_t main_ssrc) { | 870 void ModuleRtpRtcpImpl::SetRtcpReceiverSsrcs(uint32_t main_ssrc) { |
| 856 std::set<uint32_t> ssrcs; | 871 std::set<uint32_t> ssrcs; |
| 857 ssrcs.insert(main_ssrc); | 872 ssrcs.insert(main_ssrc); |
| 858 if (rtp_sender_.RtxStatus() != kRtxOff) | 873 if (RtxSendStatus() != kRtxOff) |
| 859 ssrcs.insert(rtp_sender_.RtxSsrc()); | 874 ssrcs.insert(rtp_sender_->RtxSsrc()); |
| 860 rtcp_receiver_.SetSsrcs(main_ssrc, ssrcs); | 875 rtcp_receiver_.SetSsrcs(main_ssrc, ssrcs); |
| 861 } | 876 } |
| 862 | 877 |
| 863 void ModuleRtpRtcpImpl::set_rtt_ms(int64_t rtt_ms) { | 878 void ModuleRtpRtcpImpl::set_rtt_ms(int64_t rtt_ms) { |
| 864 rtc::CritScope cs(&critical_section_rtt_); | 879 rtc::CritScope cs(&critical_section_rtt_); |
| 865 rtt_ms_ = rtt_ms; | 880 rtt_ms_ = rtt_ms; |
| 866 } | 881 } |
| 867 | 882 |
| 868 int64_t ModuleRtpRtcpImpl::rtt_ms() const { | 883 int64_t ModuleRtpRtcpImpl::rtt_ms() const { |
| 869 rtc::CritScope cs(&critical_section_rtt_); | 884 rtc::CritScope cs(&critical_section_rtt_); |
| 870 return rtt_ms_; | 885 return rtt_ms_; |
| 871 } | 886 } |
| 872 | 887 |
| 873 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback( | 888 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback( |
| 874 StreamDataCountersCallback* callback) { | 889 StreamDataCountersCallback* callback) { |
| 875 rtp_sender_.RegisterRtpStatisticsCallback(callback); | 890 rtp_sender_->RegisterRtpStatisticsCallback(callback); |
| 876 } | 891 } |
| 877 | 892 |
| 878 StreamDataCountersCallback* | 893 StreamDataCountersCallback* |
| 879 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { | 894 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { |
| 880 return rtp_sender_.GetRtpStatisticsCallback(); | 895 return rtp_sender_->GetRtpStatisticsCallback(); |
| 881 } | 896 } |
| 882 | 897 |
| 883 void ModuleRtpRtcpImpl::SetVideoBitrateAllocation( | 898 void ModuleRtpRtcpImpl::SetVideoBitrateAllocation( |
| 884 const BitrateAllocation& bitrate) { | 899 const BitrateAllocation& bitrate) { |
| 885 rtcp_sender_.SetVideoBitrateAllocation(bitrate); | 900 rtcp_sender_.SetVideoBitrateAllocation(bitrate); |
| 886 } | 901 } |
| 887 } // namespace webrtc | 902 } // namespace webrtc |
| OLD | NEW |