1 /*
2 * Copyright (c) 2018 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 "media/base/media_channel.h"
12
13 namespace cricket {
14
VideoOptions()15 VideoOptions::VideoOptions()
16 : content_hint(webrtc::VideoTrackInterface::ContentHint::kNone) {}
17 VideoOptions::~VideoOptions() = default;
18
MediaChannel(const MediaConfig & config)19 MediaChannel::MediaChannel(const MediaConfig& config)
20 : enable_dscp_(config.enable_dscp) {}
21
MediaChannel()22 MediaChannel::MediaChannel() : enable_dscp_(false) {}
23
~MediaChannel()24 MediaChannel::~MediaChannel() {}
25
SetInterface(NetworkInterface * iface)26 void MediaChannel::SetInterface(NetworkInterface* iface) {
27 webrtc::MutexLock lock(&network_interface_mutex_);
28 network_interface_ = iface;
29 UpdateDscp();
30 }
31
GetRtpSendTimeExtnId() const32 int MediaChannel::GetRtpSendTimeExtnId() const {
33 return -1;
34 }
35
SetFrameEncryptor(uint32_t ssrc,rtc::scoped_refptr<webrtc::FrameEncryptorInterface> frame_encryptor)36 void MediaChannel::SetFrameEncryptor(
37 uint32_t ssrc,
38 rtc::scoped_refptr<webrtc::FrameEncryptorInterface> frame_encryptor) {
39 // Placeholder should be pure virtual once internal supports it.
40 }
41
SetFrameDecryptor(uint32_t ssrc,rtc::scoped_refptr<webrtc::FrameDecryptorInterface> frame_decryptor)42 void MediaChannel::SetFrameDecryptor(
43 uint32_t ssrc,
44 rtc::scoped_refptr<webrtc::FrameDecryptorInterface> frame_decryptor) {
45 // Placeholder should be pure virtual once internal supports it.
46 }
47
SetVideoCodecSwitchingEnabled(bool enabled)48 void MediaChannel::SetVideoCodecSwitchingEnabled(bool enabled) {}
49
SetEncoderToPacketizerFrameTransformer(uint32_t ssrc,rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer)50 void MediaChannel::SetEncoderToPacketizerFrameTransformer(
51 uint32_t ssrc,
52 rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer) {}
SetDepacketizerToDecoderFrameTransformer(uint32_t ssrc,rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer)53 void MediaChannel::SetDepacketizerToDecoderFrameTransformer(
54 uint32_t ssrc,
55 rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer) {}
56
57 MediaSenderInfo::MediaSenderInfo() = default;
58 MediaSenderInfo::~MediaSenderInfo() = default;
59
60 MediaReceiverInfo::MediaReceiverInfo() = default;
61 MediaReceiverInfo::~MediaReceiverInfo() = default;
62
63 VoiceSenderInfo::VoiceSenderInfo() = default;
64 VoiceSenderInfo::~VoiceSenderInfo() = default;
65
66 VoiceReceiverInfo::VoiceReceiverInfo() = default;
67 VoiceReceiverInfo::~VoiceReceiverInfo() = default;
68
69 VideoSenderInfo::VideoSenderInfo() = default;
70 VideoSenderInfo::~VideoSenderInfo() = default;
71
72 VideoReceiverInfo::VideoReceiverInfo() = default;
73 VideoReceiverInfo::~VideoReceiverInfo() = default;
74
75 VoiceMediaInfo::VoiceMediaInfo() = default;
76 VoiceMediaInfo::~VoiceMediaInfo() = default;
77
78 VideoMediaInfo::VideoMediaInfo() = default;
79 VideoMediaInfo::~VideoMediaInfo() = default;
80
81 DataMediaInfo::DataMediaInfo() = default;
82 DataMediaInfo::~DataMediaInfo() = default;
83
84 AudioSendParameters::AudioSendParameters() = default;
85 AudioSendParameters::~AudioSendParameters() = default;
86
ToStringMap() const87 std::map<std::string, std::string> AudioSendParameters::ToStringMap() const {
88 auto params = RtpSendParameters<AudioCodec>::ToStringMap();
89 params["options"] = options.ToString();
90 return params;
91 }
92
media_type() const93 cricket::MediaType VoiceMediaChannel::media_type() const {
94 return cricket::MediaType::MEDIA_TYPE_AUDIO;
95 }
96
97 VideoSendParameters::VideoSendParameters() = default;
98 VideoSendParameters::~VideoSendParameters() = default;
99
ToStringMap() const100 std::map<std::string, std::string> VideoSendParameters::ToStringMap() const {
101 auto params = RtpSendParameters<VideoCodec>::ToStringMap();
102 params["conference_mode"] = (conference_mode ? "yes" : "no");
103 return params;
104 }
105
media_type() const106 cricket::MediaType VideoMediaChannel::media_type() const {
107 return cricket::MediaType::MEDIA_TYPE_VIDEO;
108 }
109
110 DataMediaChannel::DataMediaChannel() = default;
DataMediaChannel(const MediaConfig & config)111 DataMediaChannel::DataMediaChannel(const MediaConfig& config)
112 : MediaChannel(config) {}
113 DataMediaChannel::~DataMediaChannel() = default;
114
GetRtpSendParameters(uint32_t ssrc) const115 webrtc::RtpParameters DataMediaChannel::GetRtpSendParameters(
116 uint32_t ssrc) const {
117 // GetRtpSendParameters is not supported for DataMediaChannel.
118 RTC_NOTREACHED();
119 return webrtc::RtpParameters();
120 }
SetRtpSendParameters(uint32_t ssrc,const webrtc::RtpParameters & parameters)121 webrtc::RTCError DataMediaChannel::SetRtpSendParameters(
122 uint32_t ssrc,
123 const webrtc::RtpParameters& parameters) {
124 // SetRtpSendParameters is not supported for DataMediaChannel.
125 RTC_NOTREACHED();
126 return webrtc::RTCError(webrtc::RTCErrorType::UNSUPPORTED_OPERATION);
127 }
128
media_type() const129 cricket::MediaType DataMediaChannel::media_type() const {
130 return cricket::MediaType::MEDIA_TYPE_DATA;
131 }
132
GetStats(DataMediaInfo * info)133 bool DataMediaChannel::GetStats(DataMediaInfo* info) {
134 return true;
135 }
136
137 } // namespace cricket
138