blob: ab0842916c4394d8eda69c5af77555b497991e77 [file] [log] [blame]
Danil Chapovalov398a7c62017-10-24 17:07:05 +02001/*
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
16namespace webrtc {
17
18RtcpTransceiverConfig::RtcpTransceiverConfig() = default;
19RtcpTransceiverConfig::RtcpTransceiverConfig(const RtcpTransceiverConfig&) =
20 default;
21RtcpTransceiverConfig& RtcpTransceiverConfig::operator=(
22 const RtcpTransceiverConfig&) = default;
23RtcpTransceiverConfig::~RtcpTransceiverConfig() = default;
24
25bool RtcpTransceiverConfig::Validate() const {
26 if (feedback_ssrc == 0)
27 LOG(LS_WARNING)
28 << debug_id
29 << "Ssrc 0 may be treated by some implementation as invalid.";
30 if (cname.size() > 255) {
31 LOG(LS_ERROR) << debug_id << "cname can be maximum 255 characters.";
32 return false;
33 }
34 if (max_packet_size < 100) {
35 LOG(LS_ERROR) << debug_id << "max packet size " << max_packet_size
36 << " is too small.";
37 return false;
38 }
39 if (max_packet_size > IP_PACKET_SIZE) {
40 LOG(LS_ERROR) << debug_id << "max packet size " << max_packet_size
41 << " more than " << IP_PACKET_SIZE << " is unsupported.";
42 return false;
43 }
44 if (outgoing_transport == nullptr) {
45 LOG(LS_ERROR) << debug_id << "outgoing transport must be set";
46 return false;
47 }
48 if (min_periodic_report_ms <= 0) {
49 LOG(LS_ERROR) << debug_id << "period " << min_periodic_report_ms
50 << "ms between reports should be positive.";
51 return false;
52 }
53 // TODO(danilchap): Remove or update the warning when RtcpTransceiver supports
54 // send-only sessions.
55 if (receive_statistics == nullptr)
56 LOG(LS_WARNING)
57 << debug_id
58 << "receive statistic should be set to generate rtcp report blocks.";
59 return true;
60}
61
62} // namespace webrtc