1 /* 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. 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 11 #include "modules/rtp_rtcp/source/rtcp_transceiver_config.h" 12 13 #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" 14 #include "rtc_base/logging.h" 15 16 namespace webrtc { 17 18 RtcpTransceiverConfig::RtcpTransceiverConfig() = default; 19 RtcpTransceiverConfig::RtcpTransceiverConfig(const RtcpTransceiverConfig&) = 20 default; 21 RtcpTransceiverConfig& RtcpTransceiverConfig::operator=( 22 const RtcpTransceiverConfig&) = default; 23 RtcpTransceiverConfig::~RtcpTransceiverConfig() = default; 24 Validate() const25bool RtcpTransceiverConfig::Validate() const { 26 if (feedback_ssrc == 0) { 27 RTC_LOG(LS_WARNING) 28 << debug_id 29 << "Ssrc 0 may be treated by some implementation as invalid."; 30 } 31 if (cname.size() > 255) { 32 RTC_LOG(LS_ERROR) << debug_id << "cname can be maximum 255 characters."; 33 return false; 34 } 35 if (max_packet_size < 100) { 36 RTC_LOG(LS_ERROR) << debug_id << "max packet size " << max_packet_size 37 << " is too small."; 38 return false; 39 } 40 if (max_packet_size > IP_PACKET_SIZE) { 41 RTC_LOG(LS_ERROR) << debug_id << "max packet size " << max_packet_size 42 << " more than " << IP_PACKET_SIZE << " is unsupported."; 43 return false; 44 } 45 if (clock == nullptr) { 46 RTC_LOG(LS_ERROR) << debug_id << "clock must be set"; 47 return false; 48 } 49 if (!outgoing_transport) { 50 RTC_LOG(LS_ERROR) << debug_id << "outgoing transport must be set"; 51 return false; 52 } 53 if (initial_report_delay < TimeDelta::Zero()) { 54 RTC_LOG(LS_ERROR) << debug_id << "delay " << initial_report_delay.ms() 55 << "ms before first report shouldn't be negative."; 56 return false; 57 } 58 if (report_period <= TimeDelta::Zero()) { 59 RTC_LOG(LS_ERROR) << debug_id << "period " << report_period.ms() 60 << "ms between reports should be positive."; 61 return false; 62 } 63 if (schedule_periodic_compound_packets && task_queue == nullptr) { 64 RTC_LOG(LS_ERROR) << debug_id 65 << "missing task queue for periodic compound packets"; 66 return false; 67 } 68 if (rtcp_mode != RtcpMode::kCompound && rtcp_mode != RtcpMode::kReducedSize) { 69 RTC_LOG(LS_ERROR) << debug_id << "unsupported rtcp mode"; 70 return false; 71 } 72 if (non_sender_rtt_measurement && !network_link_observer) { 73 RTC_LOG(LS_WARNING) << debug_id 74 << "Enabled special feature to calculate rtt, but no " 75 "rtt observer is provided."; 76 } 77 return true; 78 } 79 80 } // namespace webrtc 81