| 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 28 matching lines...) Expand all Loading... |
| 39 return kRtpExtensionVideoRotation; | 39 return kRtpExtensionVideoRotation; |
| 40 if (extension == RtpExtension::kTransportSequenceNumberUri) | 40 if (extension == RtpExtension::kTransportSequenceNumberUri) |
| 41 return kRtpExtensionTransportSequenceNumber; | 41 return kRtpExtensionTransportSequenceNumber; |
| 42 if (extension == RtpExtension::kPlayoutDelayUri) | 42 if (extension == RtpExtension::kPlayoutDelayUri) |
| 43 return kRtpExtensionPlayoutDelay; | 43 return kRtpExtensionPlayoutDelay; |
| 44 RTC_NOTREACHED() << "Looking up unsupported RTP extension."; | 44 RTC_NOTREACHED() << "Looking up unsupported RTP extension."; |
| 45 return kRtpExtensionNone; | 45 return kRtpExtensionNone; |
| 46 } | 46 } |
| 47 | 47 |
| 48 RtpRtcp::Configuration::Configuration() | 48 RtpRtcp::Configuration::Configuration() |
| 49 : audio(false), | 49 : receive_statistics(NullObjectReceiveStatistics()) {} |
| 50 receiver_only(false), | |
| 51 clock(nullptr), | |
| 52 receive_statistics(NullObjectReceiveStatistics()), | |
| 53 outgoing_transport(nullptr), | |
| 54 intra_frame_callback(nullptr), | |
| 55 bandwidth_callback(nullptr), | |
| 56 transport_feedback_callback(nullptr), | |
| 57 rtt_stats(nullptr), | |
| 58 rtcp_packet_type_counter_observer(nullptr), | |
| 59 remote_bitrate_estimator(nullptr), | |
| 60 paced_sender(nullptr), | |
| 61 transport_sequence_number_allocator(nullptr), | |
| 62 send_bitrate_observer(nullptr), | |
| 63 send_frame_count_observer(nullptr), | |
| 64 send_side_delay_observer(nullptr), | |
| 65 event_log(nullptr), | |
| 66 send_packet_observer(nullptr) {} | |
| 67 | 50 |
| 68 RtpRtcp* RtpRtcp::CreateRtpRtcp(const RtpRtcp::Configuration& configuration) { | 51 RtpRtcp* RtpRtcp::CreateRtpRtcp(const RtpRtcp::Configuration& configuration) { |
| 69 if (configuration.clock) { | 52 if (configuration.clock) { |
| 70 return new ModuleRtpRtcpImpl(configuration); | 53 return new ModuleRtpRtcpImpl(configuration); |
| 71 } else { | 54 } else { |
| 72 // No clock implementation provided, use default clock. | 55 // No clock implementation provided, use default clock. |
| 73 RtpRtcp::Configuration configuration_copy; | 56 RtpRtcp::Configuration configuration_copy; |
| 74 memcpy(&configuration_copy, &configuration, | 57 memcpy(&configuration_copy, &configuration, |
| 75 sizeof(RtpRtcp::Configuration)); | 58 sizeof(RtpRtcp::Configuration)); |
| 76 configuration_copy.clock = Clock::GetRealTimeClock(); | 59 configuration_copy.clock = Clock::GetRealTimeClock(); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 const size_t length) { | 224 const size_t length) { |
| 242 // Allow receive of non-compound RTCP packets. | 225 // Allow receive of non-compound RTCP packets. |
| 243 RTCPUtility::RTCPParserV2 rtcp_parser(rtcp_packet, length, true); | 226 RTCPUtility::RTCPParserV2 rtcp_parser(rtcp_packet, length, true); |
| 244 | 227 |
| 245 const bool valid_rtcpheader = rtcp_parser.IsValid(); | 228 const bool valid_rtcpheader = rtcp_parser.IsValid(); |
| 246 if (!valid_rtcpheader) { | 229 if (!valid_rtcpheader) { |
| 247 LOG(LS_WARNING) << "Incoming invalid RTCP packet"; | 230 LOG(LS_WARNING) << "Incoming invalid RTCP packet"; |
| 248 return -1; | 231 return -1; |
| 249 } | 232 } |
| 250 RTCPHelp::RTCPPacketInformation rtcp_packet_information; | 233 RTCPHelp::RTCPPacketInformation rtcp_packet_information; |
| 251 int32_t ret_val = rtcp_receiver_.IncomingRTCPPacket( | 234 int32_t ret_val = |
| 252 rtcp_packet_information, &rtcp_parser); | 235 rtcp_receiver_.IncomingRTCPPacket(rtcp_packet_information, &rtcp_parser); |
| 253 if (ret_val == 0) { | 236 if (ret_val == 0) { |
| 254 rtcp_receiver_.TriggerCallbacksFromRTCPPacket(rtcp_packet_information); | 237 rtcp_receiver_.TriggerCallbacksFromRTCPPacket(rtcp_packet_information); |
| 255 } | 238 } |
| 256 return ret_val; | 239 return ret_val; |
| 257 } | 240 } |
| 258 | 241 |
| 259 int32_t ModuleRtpRtcpImpl::RegisterSendPayload( | 242 int32_t ModuleRtpRtcpImpl::RegisterSendPayload( |
| 260 const CodecInst& voice_codec) { | 243 const CodecInst& voice_codec) { |
| 261 return rtp_sender_.RegisterPayload( | 244 return rtp_sender_.RegisterPayload( |
| 262 voice_codec.plname, | 245 voice_codec.plname, voice_codec.pltype, voice_codec.plfreq, |
| 263 voice_codec.pltype, | 246 voice_codec.channels, (voice_codec.rate < 0) ? 0 : voice_codec.rate); |
| 264 voice_codec.plfreq, | |
| 265 voice_codec.channels, | |
| 266 (voice_codec.rate < 0) ? 0 : voice_codec.rate); | |
| 267 } | 247 } |
| 268 | 248 |
| 269 int32_t ModuleRtpRtcpImpl::RegisterSendPayload(const VideoCodec& video_codec) { | 249 int32_t ModuleRtpRtcpImpl::RegisterSendPayload(const VideoCodec& video_codec) { |
| 270 return rtp_sender_.RegisterPayload(video_codec.plName, video_codec.plType, | 250 return rtp_sender_.RegisterPayload(video_codec.plName, video_codec.plType, |
| 271 90000, 0, 0); | 251 90000, 0, 0); |
| 272 } | 252 } |
| 273 | 253 |
| 274 void ModuleRtpRtcpImpl::RegisterVideoSendPayload(int payload_type, | 254 void ModuleRtpRtcpImpl::RegisterVideoSendPayload(int payload_type, |
| 275 const char* payload_name) { | 255 const char* payload_name) { |
| 276 RTC_CHECK_EQ( | 256 RTC_CHECK_EQ( |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 } | 389 } |
| 410 | 390 |
| 411 int32_t ModuleRtpRtcpImpl::SendOutgoingData( | 391 int32_t ModuleRtpRtcpImpl::SendOutgoingData( |
| 412 FrameType frame_type, | 392 FrameType frame_type, |
| 413 int8_t payload_type, | 393 int8_t payload_type, |
| 414 uint32_t time_stamp, | 394 uint32_t time_stamp, |
| 415 int64_t capture_time_ms, | 395 int64_t capture_time_ms, |
| 416 const uint8_t* payload_data, | 396 const uint8_t* payload_data, |
| 417 size_t payload_size, | 397 size_t payload_size, |
| 418 const RTPFragmentationHeader* fragmentation, | 398 const RTPFragmentationHeader* fragmentation, |
| 419 const RTPVideoHeader* rtp_video_hdr) { | 399 const RTPVideoHeader* rtp_video_header) { |
| 420 rtcp_sender_.SetLastRtpTime(time_stamp, capture_time_ms); | 400 rtcp_sender_.SetLastRtpTime(time_stamp, capture_time_ms); |
| 421 // Make sure an RTCP report isn't queued behind a key frame. | 401 // Make sure an RTCP report isn't queued behind a key frame. |
| 422 if (rtcp_sender_.TimeToSendRTCPReport(kVideoFrameKey == frame_type)) { | 402 if (rtcp_sender_.TimeToSendRTCPReport(kVideoFrameKey == frame_type)) { |
| 423 rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport); | 403 rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport); |
| 424 } | 404 } |
| 425 return rtp_sender_.SendOutgoingData( | 405 return rtp_sender_.SendOutgoingData( |
| 426 frame_type, payload_type, time_stamp, capture_time_ms, payload_data, | 406 frame_type, payload_type, time_stamp, capture_time_ms, payload_data, |
| 427 payload_size, fragmentation, rtp_video_hdr); | 407 payload_size, fragmentation, rtp_video_header); |
| 428 } | 408 } |
| 429 | 409 |
| 430 bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc, | 410 bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc, |
| 431 uint16_t sequence_number, | 411 uint16_t sequence_number, |
| 432 int64_t capture_time_ms, | 412 int64_t capture_time_ms, |
| 433 bool retransmission, | 413 bool retransmission, |
| 434 int probe_cluster_id) { | 414 int probe_cluster_id) { |
| 435 if (SendingMedia() && ssrc == rtp_sender_.SSRC()) { | 415 if (SendingMedia() && ssrc == rtp_sender_.SSRC()) { |
| 436 return rtp_sender_.TimeToSendPacket(sequence_number, capture_time_ms, | 416 return rtp_sender_.TimeToSendPacket(sequence_number, capture_time_ms, |
| 437 retransmission, probe_cluster_id); | 417 retransmission, probe_cluster_id); |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback( | 976 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback( |
| 997 StreamDataCountersCallback* callback) { | 977 StreamDataCountersCallback* callback) { |
| 998 rtp_sender_.RegisterRtpStatisticsCallback(callback); | 978 rtp_sender_.RegisterRtpStatisticsCallback(callback); |
| 999 } | 979 } |
| 1000 | 980 |
| 1001 StreamDataCountersCallback* | 981 StreamDataCountersCallback* |
| 1002 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { | 982 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { |
| 1003 return rtp_sender_.GetRtpStatisticsCallback(); | 983 return rtp_sender_.GetRtpStatisticsCallback(); |
| 1004 } | 984 } |
| 1005 } // namespace webrtc | 985 } // namespace webrtc |
| OLD | NEW |