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 retransmission_rate_limiter(nullptr) {} | |
68 | 50 |
69 RtpRtcp* RtpRtcp::CreateRtpRtcp(const RtpRtcp::Configuration& configuration) { | 51 RtpRtcp* RtpRtcp::CreateRtpRtcp(const RtpRtcp::Configuration& configuration) { |
70 if (configuration.clock) { | 52 if (configuration.clock) { |
71 return new ModuleRtpRtcpImpl(configuration); | 53 return new ModuleRtpRtcpImpl(configuration); |
72 } else { | 54 } else { |
73 // No clock implementation provided, use default clock. | 55 // No clock implementation provided, use default clock. |
74 RtpRtcp::Configuration configuration_copy; | 56 RtpRtcp::Configuration configuration_copy; |
75 memcpy(&configuration_copy, &configuration, | 57 memcpy(&configuration_copy, &configuration, |
76 sizeof(RtpRtcp::Configuration)); | 58 sizeof(RtpRtcp::Configuration)); |
77 configuration_copy.clock = Clock::GetRealTimeClock(); | 59 configuration_copy.clock = Clock::GetRealTimeClock(); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 const size_t length) { | 220 const size_t length) { |
239 // Allow receive of non-compound RTCP packets. | 221 // Allow receive of non-compound RTCP packets. |
240 RTCPUtility::RTCPParserV2 rtcp_parser(rtcp_packet, length, true); | 222 RTCPUtility::RTCPParserV2 rtcp_parser(rtcp_packet, length, true); |
241 | 223 |
242 const bool valid_rtcpheader = rtcp_parser.IsValid(); | 224 const bool valid_rtcpheader = rtcp_parser.IsValid(); |
243 if (!valid_rtcpheader) { | 225 if (!valid_rtcpheader) { |
244 LOG(LS_WARNING) << "Incoming invalid RTCP packet"; | 226 LOG(LS_WARNING) << "Incoming invalid RTCP packet"; |
245 return -1; | 227 return -1; |
246 } | 228 } |
247 RTCPHelp::RTCPPacketInformation rtcp_packet_information; | 229 RTCPHelp::RTCPPacketInformation rtcp_packet_information; |
248 int32_t ret_val = rtcp_receiver_.IncomingRTCPPacket( | 230 int32_t ret_val = |
249 rtcp_packet_information, &rtcp_parser); | 231 rtcp_receiver_.IncomingRTCPPacket(rtcp_packet_information, &rtcp_parser); |
250 if (ret_val == 0) { | 232 if (ret_val == 0) { |
251 rtcp_receiver_.TriggerCallbacksFromRTCPPacket(rtcp_packet_information); | 233 rtcp_receiver_.TriggerCallbacksFromRTCPPacket(rtcp_packet_information); |
252 } | 234 } |
253 return ret_val; | 235 return ret_val; |
254 } | 236 } |
255 | 237 |
256 int32_t ModuleRtpRtcpImpl::RegisterSendPayload( | 238 int32_t ModuleRtpRtcpImpl::RegisterSendPayload( |
257 const CodecInst& voice_codec) { | 239 const CodecInst& voice_codec) { |
258 return rtp_sender_.RegisterPayload( | 240 return rtp_sender_.RegisterPayload( |
259 voice_codec.plname, | 241 voice_codec.plname, voice_codec.pltype, voice_codec.plfreq, |
260 voice_codec.pltype, | 242 voice_codec.channels, (voice_codec.rate < 0) ? 0 : voice_codec.rate); |
261 voice_codec.plfreq, | |
262 voice_codec.channels, | |
263 (voice_codec.rate < 0) ? 0 : voice_codec.rate); | |
264 } | 243 } |
265 | 244 |
266 int32_t ModuleRtpRtcpImpl::RegisterSendPayload(const VideoCodec& video_codec) { | 245 int32_t ModuleRtpRtcpImpl::RegisterSendPayload(const VideoCodec& video_codec) { |
267 return rtp_sender_.RegisterPayload(video_codec.plName, video_codec.plType, | 246 return rtp_sender_.RegisterPayload(video_codec.plName, video_codec.plType, |
268 90000, 0, 0); | 247 90000, 0, 0); |
269 } | 248 } |
270 | 249 |
271 void ModuleRtpRtcpImpl::RegisterVideoSendPayload(int payload_type, | 250 void ModuleRtpRtcpImpl::RegisterVideoSendPayload(int payload_type, |
272 const char* payload_name) { | 251 const char* payload_name) { |
273 RTC_CHECK_EQ( | 252 RTC_CHECK_EQ( |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 } | 385 } |
407 | 386 |
408 int32_t ModuleRtpRtcpImpl::SendOutgoingData( | 387 int32_t ModuleRtpRtcpImpl::SendOutgoingData( |
409 FrameType frame_type, | 388 FrameType frame_type, |
410 int8_t payload_type, | 389 int8_t payload_type, |
411 uint32_t time_stamp, | 390 uint32_t time_stamp, |
412 int64_t capture_time_ms, | 391 int64_t capture_time_ms, |
413 const uint8_t* payload_data, | 392 const uint8_t* payload_data, |
414 size_t payload_size, | 393 size_t payload_size, |
415 const RTPFragmentationHeader* fragmentation, | 394 const RTPFragmentationHeader* fragmentation, |
416 const RTPVideoHeader* rtp_video_hdr) { | 395 const RTPVideoHeader* rtp_video_header) { |
417 rtcp_sender_.SetLastRtpTime(time_stamp, capture_time_ms); | 396 rtcp_sender_.SetLastRtpTime(time_stamp, capture_time_ms); |
418 // Make sure an RTCP report isn't queued behind a key frame. | 397 // Make sure an RTCP report isn't queued behind a key frame. |
419 if (rtcp_sender_.TimeToSendRTCPReport(kVideoFrameKey == frame_type)) { | 398 if (rtcp_sender_.TimeToSendRTCPReport(kVideoFrameKey == frame_type)) { |
420 rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport); | 399 rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport); |
421 } | 400 } |
422 return rtp_sender_.SendOutgoingData( | 401 return rtp_sender_.SendOutgoingData( |
423 frame_type, payload_type, time_stamp, capture_time_ms, payload_data, | 402 frame_type, payload_type, time_stamp, capture_time_ms, payload_data, |
424 payload_size, fragmentation, rtp_video_hdr); | 403 payload_size, fragmentation, rtp_video_header); |
425 } | 404 } |
426 | 405 |
427 bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc, | 406 bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc, |
428 uint16_t sequence_number, | 407 uint16_t sequence_number, |
429 int64_t capture_time_ms, | 408 int64_t capture_time_ms, |
430 bool retransmission, | 409 bool retransmission, |
431 int probe_cluster_id) { | 410 int probe_cluster_id) { |
432 if (SendingMedia() && ssrc == rtp_sender_.SSRC()) { | 411 if (SendingMedia() && ssrc == rtp_sender_.SSRC()) { |
433 return rtp_sender_.TimeToSendPacket(sequence_number, capture_time_ms, | 412 return rtp_sender_.TimeToSendPacket(sequence_number, capture_time_ms, |
434 retransmission, probe_cluster_id); | 413 retransmission, probe_cluster_id); |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback( | 968 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback( |
990 StreamDataCountersCallback* callback) { | 969 StreamDataCountersCallback* callback) { |
991 rtp_sender_.RegisterRtpStatisticsCallback(callback); | 970 rtp_sender_.RegisterRtpStatisticsCallback(callback); |
992 } | 971 } |
993 | 972 |
994 StreamDataCountersCallback* | 973 StreamDataCountersCallback* |
995 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { | 974 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { |
996 return rtp_sender_.GetRtpStatisticsCallback(); | 975 return rtp_sender_.GetRtpStatisticsCallback(); |
997 } | 976 } |
998 } // namespace webrtc | 977 } // namespace webrtc |
OLD | NEW |