Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: voice_engine/voe_rtp_rtcp_impl.cc

Issue 3006383002: Remove VoERTP_RTCP (Closed)
Patch Set: rebase+remove Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « voice_engine/voe_rtp_rtcp_impl.h ('k') | voice_engine/voice_engine_defines.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2012 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 "system_wrappers/include/file_wrapper.h"
12 #include "system_wrappers/include/trace.h"
13 #include "voice_engine/include/voe_errors.h"
14 #include "voice_engine/voe_rtp_rtcp_impl.h"
15 #include "voice_engine/voice_engine_impl.h"
16
17 #include "voice_engine/channel.h"
18 #include "voice_engine/transmit_mixer.h"
19
20 namespace webrtc {
21
22 VoERTP_RTCP* VoERTP_RTCP::GetInterface(VoiceEngine* voiceEngine) {
23 if (NULL == voiceEngine) {
24 return NULL;
25 }
26 VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
27 s->AddRef();
28 return s;
29 }
30
31 VoERTP_RTCPImpl::VoERTP_RTCPImpl(voe::SharedData* shared) : _shared(shared) {
32 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1),
33 "VoERTP_RTCPImpl::VoERTP_RTCPImpl() - ctor");
34 }
35
36 VoERTP_RTCPImpl::~VoERTP_RTCPImpl() {
37 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1),
38 "VoERTP_RTCPImpl::~VoERTP_RTCPImpl() - dtor");
39 }
40
41 int VoERTP_RTCPImpl::SetLocalSSRC(int channel, unsigned int ssrc) {
42 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
43 "SetLocalSSRC(channel=%d, %lu)", channel, ssrc);
44 if (!_shared->statistics().Initialized()) {
45 _shared->SetLastError(VE_NOT_INITED, kTraceError);
46 return -1;
47 }
48 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
49 voe::Channel* channelPtr = ch.channel();
50 if (channelPtr == NULL) {
51 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
52 "SetLocalSSRC() failed to locate channel");
53 return -1;
54 }
55 return channelPtr->SetLocalSSRC(ssrc);
56 }
57
58 int VoERTP_RTCPImpl::GetLocalSSRC(int channel, unsigned int& ssrc) {
59 if (!_shared->statistics().Initialized()) {
60 _shared->SetLastError(VE_NOT_INITED, kTraceError);
61 return -1;
62 }
63 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
64 voe::Channel* channelPtr = ch.channel();
65 if (channelPtr == NULL) {
66 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
67 "GetLocalSSRC() failed to locate channel");
68 return -1;
69 }
70 return channelPtr->GetLocalSSRC(ssrc);
71 }
72
73 int VoERTP_RTCPImpl::GetRemoteSSRC(int channel, unsigned int& ssrc) {
74 if (!_shared->statistics().Initialized()) {
75 _shared->SetLastError(VE_NOT_INITED, kTraceError);
76 return -1;
77 }
78 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
79 voe::Channel* channelPtr = ch.channel();
80 if (channelPtr == NULL) {
81 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
82 "GetRemoteSSRC() failed to locate channel");
83 return -1;
84 }
85 return channelPtr->GetRemoteSSRC(ssrc);
86 }
87
88 int VoERTP_RTCPImpl::SetSendAudioLevelIndicationStatus(int channel,
89 bool enable,
90 unsigned char id) {
91 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
92 "SetSendAudioLevelIndicationStatus(channel=%d, enable=%d,"
93 " ID=%u)",
94 channel, enable, id);
95 if (!_shared->statistics().Initialized()) {
96 _shared->SetLastError(VE_NOT_INITED, kTraceError);
97 return -1;
98 }
99 if (enable && (id < kVoiceEngineMinRtpExtensionId ||
100 id > kVoiceEngineMaxRtpExtensionId)) {
101 // [RFC5285] The 4-bit id is the local identifier of this element in
102 // the range 1-14 inclusive.
103 _shared->SetLastError(
104 VE_INVALID_ARGUMENT, kTraceError,
105 "SetSendAudioLevelIndicationStatus() invalid ID parameter");
106 return -1;
107 }
108
109 // Set state and id for the specified channel.
110 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
111 voe::Channel* channelPtr = ch.channel();
112 if (channelPtr == NULL) {
113 _shared->SetLastError(
114 VE_CHANNEL_NOT_VALID, kTraceError,
115 "SetSendAudioLevelIndicationStatus() failed to locate channel");
116 return -1;
117 }
118 return channelPtr->SetSendAudioLevelIndicationStatus(enable, id);
119 }
120
121 int VoERTP_RTCPImpl::SetRTCPStatus(int channel, bool enable) {
122 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
123 "SetRTCPStatus(channel=%d, enable=%d)", channel, enable);
124 if (!_shared->statistics().Initialized()) {
125 _shared->SetLastError(VE_NOT_INITED, kTraceError);
126 return -1;
127 }
128 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
129 voe::Channel* channelPtr = ch.channel();
130 if (channelPtr == NULL) {
131 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
132 "SetRTCPStatus() failed to locate channel");
133 return -1;
134 }
135 channelPtr->SetRTCPStatus(enable);
136 return 0;
137 }
138
139 int VoERTP_RTCPImpl::GetRTCPStatus(int channel, bool& enabled) {
140 if (!_shared->statistics().Initialized()) {
141 _shared->SetLastError(VE_NOT_INITED, kTraceError);
142 return -1;
143 }
144 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
145 voe::Channel* channelPtr = ch.channel();
146 if (channelPtr == NULL) {
147 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
148 "GetRTCPStatus() failed to locate channel");
149 return -1;
150 }
151 return channelPtr->GetRTCPStatus(enabled);
152 }
153
154 int VoERTP_RTCPImpl::SetRTCP_CNAME(int channel, const char cName[256]) {
155 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
156 "SetRTCP_CNAME(channel=%d, cName=%s)", channel, cName);
157 if (!_shared->statistics().Initialized()) {
158 _shared->SetLastError(VE_NOT_INITED, kTraceError);
159 return -1;
160 }
161 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
162 voe::Channel* channelPtr = ch.channel();
163 if (channelPtr == NULL) {
164 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
165 "SetRTCP_CNAME() failed to locate channel");
166 return -1;
167 }
168 return channelPtr->SetRTCP_CNAME(cName);
169 }
170
171 int VoERTP_RTCPImpl::GetRemoteRTCP_CNAME(int channel, char cName[256]) {
172 if (!_shared->statistics().Initialized()) {
173 _shared->SetLastError(VE_NOT_INITED, kTraceError);
174 return -1;
175 }
176 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
177 voe::Channel* channelPtr = ch.channel();
178 if (channelPtr == NULL) {
179 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
180 "GetRemoteRTCP_CNAME() failed to locate channel");
181 return -1;
182 }
183 return channelPtr->GetRemoteRTCP_CNAME(cName);
184 }
185
186 int VoERTP_RTCPImpl::GetRTCPStatistics(int channel, CallStatistics& stats) {
187 if (!_shared->statistics().Initialized()) {
188 _shared->SetLastError(VE_NOT_INITED, kTraceError);
189 return -1;
190 }
191 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
192 voe::Channel* channelPtr = ch.channel();
193 if (channelPtr == NULL) {
194 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
195 "GetRTPStatistics() failed to locate channel");
196 return -1;
197 }
198 return channelPtr->GetRTPStatistics(stats);
199 }
200
201 } // namespace webrtc
OLDNEW
« no previous file with comments | « voice_engine/voe_rtp_rtcp_impl.h ('k') | voice_engine/voice_engine_defines.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698