blob: 76bc639cbcfb3685e40ef46bb605d1198225f4d3 [file] [log] [blame]
zsteind48dbda2017-04-04 19:45:57 -07001/*
2 * Copyright 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 "webrtc/pc/rtptransport.h"
12
13#include "webrtc/base/checks.h"
zsteind9ce7642017-04-10 16:17:57 -070014#include "webrtc/p2p/base/packettransportinterface.h"
zsteind48dbda2017-04-04 19:45:57 -070015
16namespace webrtc {
17
zsteind9ce7642017-04-10 16:17:57 -070018void RtpTransport::set_rtp_packet_transport(rtc::PacketTransportInternal* rtp) {
19 rtp_packet_transport_ = rtp;
20}
21
zsteind48dbda2017-04-04 19:45:57 -070022void RtpTransport::set_rtcp_packet_transport(
23 rtc::PacketTransportInternal* rtcp) {
24 RTC_DCHECK(!rtcp_mux_required_);
25 rtcp_packet_transport_ = rtcp;
26}
27
zsteind9ce7642017-04-10 16:17:57 -070028PacketTransportInterface* RtpTransport::GetRtpPacketTransport() const {
29 return rtp_packet_transport_;
30}
31
32PacketTransportInterface* RtpTransport::GetRtcpPacketTransport() const {
33 return rtcp_packet_transport_;
34}
35
36RTCError RtpTransport::SetRtcpParameters(const RtcpParameters& parameters) {
37 if (rtcp_parameters_.mux && !parameters.mux) {
38 LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_STATE,
39 "Disabling RTCP muxing is not allowed.");
40 }
41
42 RtcpParameters new_parameters = parameters;
43
44 if (new_parameters.cname.empty()) {
45 new_parameters.cname = rtcp_parameters_.cname;
46 }
47
48 rtcp_parameters_ = new_parameters;
49 return RTCError::OK();
50}
51
52RtcpParameters RtpTransport::GetRtcpParameters() const {
53 return rtcp_parameters_;
54}
55
56RtpTransportAdapter* RtpTransport::GetInternal() {
57 return nullptr;
58}
59
zsteind48dbda2017-04-04 19:45:57 -070060} // namespace webrtc