blob: 0cd0abed67bf3c4d51b4411e33703a265fe0fd59 [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.";
Danil Chapovalov78161ca2017-10-26 12:09:41 +020030 if (cname.empty())
31 LOG(LS_WARNING) << debug_id << "missing cname for ssrc " << feedback_ssrc;
Danil Chapovalov398a7c62017-10-24 17:07:05 +020032 if (cname.size() > 255) {
33 LOG(LS_ERROR) << debug_id << "cname can be maximum 255 characters.";
34 return false;
35 }
36 if (max_packet_size < 100) {
37 LOG(LS_ERROR) << debug_id << "max packet size " << max_packet_size
38 << " is too small.";
39 return false;
40 }
41 if (max_packet_size > IP_PACKET_SIZE) {
42 LOG(LS_ERROR) << debug_id << "max packet size " << max_packet_size
43 << " more than " << IP_PACKET_SIZE << " is unsupported.";
44 return false;
45 }
Danil Chapovalov8c8d49e2017-10-30 15:21:41 +010046 if (!outgoing_transport) {
Danil Chapovalov398a7c62017-10-24 17:07:05 +020047 LOG(LS_ERROR) << debug_id << "outgoing transport must be set";
48 return false;
49 }
Danil Chapovalov8c8d49e2017-10-30 15:21:41 +010050 if (report_period_ms <= 0) {
51 LOG(LS_ERROR) << debug_id << "period " << report_period_ms
Danil Chapovalov398a7c62017-10-24 17:07:05 +020052 << "ms between reports should be positive.";
53 return false;
54 }
Danil Chapovalov8c8d49e2017-10-30 15:21:41 +010055 if (schedule_periodic_compound_packets && !task_queue) {
56 LOG(LS_ERROR) << debug_id
57 << "missing task queue for periodic compound packets";
58 return false;
59 }
Danil Chapovalov398a7c62017-10-24 17:07:05 +020060 // TODO(danilchap): Remove or update the warning when RtcpTransceiver supports
61 // send-only sessions.
62 if (receive_statistics == nullptr)
63 LOG(LS_WARNING)
64 << debug_id
65 << "receive statistic should be set to generate rtcp report blocks.";
66 return true;
67}
68
69} // namespace webrtc