niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
stefan@webrtc.org | 07b45a5 | 2012-02-02 08:37:48 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 11 | #include "video_engine/vie_rtp_rtcp_impl.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 12 | |
mflodman@webrtc.org | 9ba151b | 2012-06-21 10:02:13 +0000 | [diff] [blame] | 13 | #include "engine_configurations.h" // NOLINT |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 14 | #include "system_wrappers/interface/file_wrapper.h" |
| 15 | #include "system_wrappers/interface/trace.h" |
mflodman@webrtc.org | a4863db | 2011-12-22 08:51:52 +0000 | [diff] [blame] | 16 | #include "video_engine/include/vie_errors.h" |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 17 | #include "video_engine/vie_channel.h" |
| 18 | #include "video_engine/vie_channel_manager.h" |
| 19 | #include "video_engine/vie_defines.h" |
| 20 | #include "video_engine/vie_encoder.h" |
| 21 | #include "video_engine/vie_impl.h" |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 22 | #include "video_engine/vie_shared_data.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 23 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 24 | namespace webrtc { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 25 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 26 | // Helper methods for converting between module format and ViE API format. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 27 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 28 | static RTCPMethod ViERTCPModeToRTCPMethod(ViERTCPMode api_mode) { |
| 29 | switch (api_mode) { |
| 30 | case kRtcpNone: |
| 31 | return kRtcpOff; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 32 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 33 | case kRtcpCompound_RFC4585: |
| 34 | return kRtcpCompound; |
| 35 | |
| 36 | case kRtcpNonCompound_RFC5506: |
| 37 | return kRtcpNonCompound; |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 38 | } |
mflodman@webrtc.org | 657b2a4 | 2012-02-06 11:06:01 +0000 | [diff] [blame] | 39 | assert(false); |
| 40 | return kRtcpOff; |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | static ViERTCPMode RTCPMethodToViERTCPMode(RTCPMethod module_method) { |
| 44 | switch (module_method) { |
| 45 | case kRtcpOff: |
| 46 | return kRtcpNone; |
| 47 | |
| 48 | case kRtcpCompound: |
| 49 | return kRtcpCompound_RFC4585; |
| 50 | |
| 51 | case kRtcpNonCompound: |
| 52 | return kRtcpNonCompound_RFC5506; |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 53 | } |
mflodman@webrtc.org | 657b2a4 | 2012-02-06 11:06:01 +0000 | [diff] [blame] | 54 | assert(false); |
| 55 | return kRtcpNone; |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 56 | } |
| 57 | |
| 58 | static KeyFrameRequestMethod APIRequestToModuleRequest( |
| 59 | ViEKeyFrameRequestMethod api_method) { |
| 60 | switch (api_method) { |
| 61 | case kViEKeyFrameRequestNone: |
| 62 | return kKeyFrameReqFirRtp; |
| 63 | |
| 64 | case kViEKeyFrameRequestPliRtcp: |
| 65 | return kKeyFrameReqPliRtcp; |
| 66 | |
| 67 | case kViEKeyFrameRequestFirRtp: |
| 68 | return kKeyFrameReqFirRtp; |
| 69 | |
| 70 | case kViEKeyFrameRequestFirRtcp: |
| 71 | return kKeyFrameReqFirRtcp; |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 72 | } |
mflodman@webrtc.org | 657b2a4 | 2012-02-06 11:06:01 +0000 | [diff] [blame] | 73 | assert(false); |
| 74 | return kKeyFrameReqFirRtp; |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | ViERTP_RTCP* ViERTP_RTCP::GetInterface(VideoEngine* video_engine) { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 78 | #ifdef WEBRTC_VIDEO_ENGINE_RTP_RTCP_API |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 79 | if (!video_engine) { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 80 | return NULL; |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 81 | } |
| 82 | VideoEngineImpl* vie_impl = reinterpret_cast<VideoEngineImpl*>(video_engine); |
| 83 | ViERTP_RTCPImpl* vie_rtpimpl = vie_impl; |
| 84 | // Increase ref count. |
| 85 | (*vie_rtpimpl)++; |
| 86 | return vie_rtpimpl; |
| 87 | #else |
| 88 | return NULL; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 89 | #endif |
| 90 | } |
| 91 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 92 | int ViERTP_RTCPImpl::Release() { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 93 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, shared_data_->instance_id(), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 94 | "ViERTP_RTCP::Release()"); |
| 95 | // Decrease ref count. |
| 96 | (*this)--; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 97 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 98 | WebRtc_Word32 ref_count = GetCount(); |
| 99 | if (ref_count < 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 100 | WEBRTC_TRACE(kTraceWarning, kTraceVideo, shared_data_->instance_id(), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 101 | "ViERTP_RTCP release too many times"); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 102 | shared_data_->SetLastError(kViEAPIDoesNotExist); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 103 | return -1; |
| 104 | } |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 105 | WEBRTC_TRACE(kTraceInfo, kTraceVideo, shared_data_->instance_id(), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 106 | "ViERTP_RTCP reference count: %d", ref_count); |
| 107 | return ref_count; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 108 | } |
| 109 | |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 110 | ViERTP_RTCPImpl::ViERTP_RTCPImpl(ViESharedData* shared_data) |
| 111 | : shared_data_(shared_data) { |
| 112 | WEBRTC_TRACE(kTraceMemory, kTraceVideo, shared_data_->instance_id(), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 113 | "ViERTP_RTCPImpl::ViERTP_RTCPImpl() Ctor"); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 114 | } |
| 115 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 116 | ViERTP_RTCPImpl::~ViERTP_RTCPImpl() { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 117 | WEBRTC_TRACE(kTraceMemory, kTraceVideo, shared_data_->instance_id(), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 118 | "ViERTP_RTCPImpl::~ViERTP_RTCPImpl() Dtor"); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 119 | } |
| 120 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 121 | int ViERTP_RTCPImpl::SetLocalSSRC(const int video_channel, |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 122 | const unsigned int SSRC, |
| 123 | const StreamType usage, |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 124 | const unsigned char simulcast_idx) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 125 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 126 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 127 | "%s(channel: %d, SSRC: %d)", __FUNCTION__, video_channel, SSRC); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 128 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 129 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 130 | if (!vie_channel) { |
stefan@webrtc.org | d0bdab0 | 2011-10-14 14:24:54 +0000 | [diff] [blame] | 131 | // The channel doesn't exists |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 132 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 133 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 134 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 135 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 136 | return -1; |
| 137 | } |
| 138 | if (vie_channel->SetSSRC(SSRC, usage, simulcast_idx) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 139 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 140 | return -1; |
| 141 | } |
| 142 | return 0; |
| 143 | } |
| 144 | |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 145 | int ViERTP_RTCPImpl::SetRemoteSSRCType(const int videoChannel, |
| 146 | const StreamType usage, |
| 147 | const unsigned int SSRC) const { |
| 148 | WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 149 | ViEId(shared_data_->instance_id(), videoChannel), |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 150 | "%s(channel: %d, usage:%d SSRC: 0x%x)", |
| 151 | __FUNCTION__, usage, videoChannel, SSRC); |
| 152 | |
| 153 | // Get the channel |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 154 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 155 | ViEChannel* ptrViEChannel = cs.Channel(videoChannel); |
| 156 | if (ptrViEChannel == NULL) { |
| 157 | // The channel doesn't exists |
| 158 | WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 159 | ViEId(shared_data_->instance_id(), videoChannel), |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 160 | "%s: Channel %d doesn't exist", |
| 161 | __FUNCTION__, videoChannel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 162 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 163 | return -1; |
| 164 | } |
| 165 | if (ptrViEChannel->SetRemoteSSRCType(usage, SSRC) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 166 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 167 | return -1; |
| 168 | } |
| 169 | return 0; |
| 170 | } |
| 171 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 172 | int ViERTP_RTCPImpl::GetLocalSSRC(const int video_channel, |
| 173 | unsigned int& SSRC) const { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 174 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 175 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 176 | "%s(channel: %d, SSRC: %d)", __FUNCTION__, video_channel, SSRC); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 177 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 178 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 179 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 180 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 181 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 182 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 183 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 184 | return -1; |
| 185 | } |
vikasmarwaha@webrtc.org | 8239ca5 | 2012-10-24 22:35:52 +0000 | [diff] [blame^] | 186 | if (vie_channel->GetLocalSSRC(&SSRC) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 187 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 188 | return -1; |
| 189 | } |
| 190 | return 0; |
| 191 | } |
| 192 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 193 | int ViERTP_RTCPImpl::GetRemoteSSRC(const int video_channel, |
| 194 | unsigned int& SSRC) const { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 195 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 196 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 197 | "%s(channel: %d)", __FUNCTION__, video_channel, SSRC); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 198 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 199 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 200 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 201 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 202 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 203 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 204 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 205 | return -1; |
| 206 | } |
mflodman@webrtc.org | f5e99db | 2012-06-27 09:49:37 +0000 | [diff] [blame] | 207 | if (vie_channel->GetRemoteSSRC(&SSRC) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 208 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 209 | return -1; |
| 210 | } |
| 211 | return 0; |
| 212 | } |
| 213 | |
| 214 | int ViERTP_RTCPImpl::GetRemoteCSRCs(const int video_channel, |
| 215 | unsigned int CSRCs[kRtpCsrcSize]) const { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 216 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 217 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 218 | "%s(channel: %d)", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 219 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 220 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 221 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 222 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 223 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 224 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 225 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 226 | return -1; |
| 227 | } |
| 228 | if (vie_channel->GetRemoteCSRC(CSRCs) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 229 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 230 | return -1; |
| 231 | } |
| 232 | return 0; |
| 233 | } |
| 234 | |
| 235 | int ViERTP_RTCPImpl::SetStartSequenceNumber(const int video_channel, |
mflodman@webrtc.org | 9ba151b | 2012-06-21 10:02:13 +0000 | [diff] [blame] | 236 | uint16_t sequence_number) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 237 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 238 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 239 | "%s(channel: %d, sequence_number: %u)", __FUNCTION__, |
| 240 | video_channel, sequence_number); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 241 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 242 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 243 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 244 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 245 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 246 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 247 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 248 | return -1; |
| 249 | } |
| 250 | if (vie_channel->Sending()) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 251 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 252 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 253 | "%s: Channel %d already sending.", __FUNCTION__, |
| 254 | video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 255 | shared_data_->SetLastError(kViERtpRtcpAlreadySending); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 256 | return -1; |
| 257 | } |
| 258 | if (vie_channel->SetStartSequenceNumber(sequence_number) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 259 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 260 | return -1; |
| 261 | } |
| 262 | return 0; |
| 263 | } |
| 264 | |
| 265 | int ViERTP_RTCPImpl::SetRTCPStatus(const int video_channel, |
| 266 | const ViERTCPMode rtcp_mode) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 267 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 268 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 269 | "%s(channel: %d, mode: %d)", __FUNCTION__, video_channel, |
| 270 | rtcp_mode); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 271 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 272 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 273 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 274 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 275 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 276 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 277 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
stefan@webrtc.org | d0bdab0 | 2011-10-14 14:24:54 +0000 | [diff] [blame] | 278 | return -1; |
| 279 | } |
| 280 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 281 | RTCPMethod module_mode = ViERTCPModeToRTCPMethod(rtcp_mode); |
| 282 | if (vie_channel->SetRTCPMode(module_mode) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 283 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 284 | return -1; |
| 285 | } |
| 286 | return 0; |
| 287 | } |
| 288 | |
| 289 | int ViERTP_RTCPImpl::GetRTCPStatus(const int video_channel, |
| 290 | ViERTCPMode& rtcp_mode) const { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 291 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 292 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 293 | "%s(channel: %d)", __FUNCTION__, video_channel, rtcp_mode); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 294 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 295 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 296 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 297 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 298 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 299 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 300 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 301 | return -1; |
| 302 | } |
| 303 | RTCPMethod module_mode = kRtcpOff; |
mflodman@webrtc.org | f5e99db | 2012-06-27 09:49:37 +0000 | [diff] [blame] | 304 | if (vie_channel->GetRTCPMode(&module_mode) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 305 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 306 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 307 | "%s: could not get current RTCP mode", __FUNCTION__); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 308 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 309 | return -1; |
| 310 | } |
| 311 | rtcp_mode = RTCPMethodToViERTCPMode(module_mode); |
| 312 | return 0; |
| 313 | } |
| 314 | |
| 315 | int ViERTP_RTCPImpl::SetRTCPCName(const int video_channel, |
| 316 | const char rtcp_cname[KMaxRTCPCNameLength]) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 317 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 318 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 319 | "%s(channel: %d, name: %s)", __FUNCTION__, video_channel, |
| 320 | rtcp_cname); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 321 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 322 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 323 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 324 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 325 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 326 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 327 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 328 | return -1; |
| 329 | } |
| 330 | if (vie_channel->Sending()) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 331 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 332 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 333 | "%s: Channel %d already sending.", __FUNCTION__, |
| 334 | video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 335 | shared_data_->SetLastError(kViERtpRtcpAlreadySending); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 336 | return -1; |
| 337 | } |
| 338 | if (vie_channel->SetRTCPCName(rtcp_cname) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 339 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 340 | return -1; |
| 341 | } |
| 342 | return 0; |
| 343 | } |
| 344 | |
| 345 | int ViERTP_RTCPImpl::GetRTCPCName(const int video_channel, |
| 346 | char rtcp_cname[KMaxRTCPCNameLength]) const { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 347 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 348 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 349 | "%s(channel: %d)", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 350 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 351 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 352 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 353 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 354 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 355 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 356 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 357 | return -1; |
| 358 | } |
| 359 | if (vie_channel->GetRTCPCName(rtcp_cname) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 360 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 361 | return -1; |
| 362 | } |
| 363 | return 0; |
| 364 | } |
| 365 | |
| 366 | int ViERTP_RTCPImpl::GetRemoteRTCPCName( |
| 367 | const int video_channel, |
| 368 | char rtcp_cname[KMaxRTCPCNameLength]) const { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 369 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 370 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 371 | "%s(channel: %d)", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 372 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 373 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 374 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 375 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 376 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 377 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 378 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 379 | return -1; |
| 380 | } |
| 381 | if (vie_channel->GetRemoteRTCPCName(rtcp_cname) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 382 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 383 | return -1; |
| 384 | } |
| 385 | return 0; |
| 386 | } |
| 387 | |
| 388 | int ViERTP_RTCPImpl::SendApplicationDefinedRTCPPacket( |
| 389 | const int video_channel, |
| 390 | const unsigned char sub_type, |
| 391 | unsigned int name, |
| 392 | const char* data, |
mflodman@webrtc.org | 9ba151b | 2012-06-21 10:02:13 +0000 | [diff] [blame] | 393 | uint16_t data_length_in_bytes) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 394 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 395 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 396 | "%s(channel: %d, sub_type: %c, name: %d, data: x, length: %u)", |
| 397 | __FUNCTION__, video_channel, sub_type, name, |
| 398 | data_length_in_bytes); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 399 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 400 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 401 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 402 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 403 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 404 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 405 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 406 | return -1; |
| 407 | } |
| 408 | if (!vie_channel->Sending()) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 409 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 410 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 411 | "%s: Channel %d not sending", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 412 | shared_data_->SetLastError(kViERtpRtcpNotSending); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 413 | return -1; |
| 414 | } |
| 415 | RTCPMethod method; |
mflodman@webrtc.org | f5e99db | 2012-06-27 09:49:37 +0000 | [diff] [blame] | 416 | if (vie_channel->GetRTCPMode(&method) != 0 || method == kRtcpOff) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 417 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 418 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 419 | "%s: RTCP disabled on channel %d.", __FUNCTION__, |
| 420 | video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 421 | shared_data_->SetLastError(kViERtpRtcpRtcpDisabled); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 422 | return -1; |
| 423 | } |
| 424 | if (vie_channel->SendApplicationDefinedRTCPPacket( |
| 425 | sub_type, name, reinterpret_cast<const WebRtc_UWord8*>(data), |
| 426 | data_length_in_bytes) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 427 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 428 | return -1; |
| 429 | } |
| 430 | return 0; |
| 431 | } |
| 432 | |
| 433 | int ViERTP_RTCPImpl::SetNACKStatus(const int video_channel, const bool enable) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 434 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 435 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 436 | "%s(channel: %d, enable: %d)", __FUNCTION__, video_channel, |
| 437 | enable); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 438 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 439 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 440 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 441 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 442 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 443 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 444 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 445 | return -1; |
| 446 | } |
| 447 | if (vie_channel->SetNACKStatus(enable) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 448 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 449 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 450 | "%s: failed for channel %d", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 451 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 452 | return -1; |
| 453 | } |
| 454 | |
| 455 | // Update the encoder |
| 456 | ViEEncoder* vie_encoder = cs.Encoder(video_channel); |
| 457 | if (!vie_encoder) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 458 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 459 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 460 | "%s: Could not get encoder for channel %d", __FUNCTION__, |
| 461 | video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 462 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 463 | return -1; |
| 464 | } |
| 465 | vie_encoder->UpdateProtectionMethod(); |
| 466 | return 0; |
| 467 | } |
| 468 | |
| 469 | int ViERTP_RTCPImpl::SetFECStatus(const int video_channel, const bool enable, |
| 470 | const unsigned char payload_typeRED, |
| 471 | const unsigned char payload_typeFEC) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 472 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 473 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 474 | "%s(channel: %d, enable: %d, payload_typeRED: %u, " |
| 475 | "payloadTypeFEC: %u)", |
| 476 | __FUNCTION__, video_channel, enable, payload_typeRED, |
| 477 | payload_typeFEC); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 478 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 479 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 480 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 481 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 482 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 483 | "%s: Channel %d doesn't exist", __FUNCTION__, |
| 484 | video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 485 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 486 | return -1; |
| 487 | } |
| 488 | if (vie_channel->SetFECStatus(enable, payload_typeRED, |
| 489 | payload_typeFEC) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 490 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 491 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 492 | "%s: failed for channel %d", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 493 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 494 | return -1; |
| 495 | } |
| 496 | // Update the encoder. |
| 497 | ViEEncoder* vie_encoder = cs.Encoder(video_channel); |
| 498 | if (!vie_encoder) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 499 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 500 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 501 | "%s: Could not get encoder for channel %d", __FUNCTION__, |
| 502 | video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 503 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 504 | return -1; |
| 505 | } |
| 506 | vie_encoder->UpdateProtectionMethod(); |
| 507 | return 0; |
| 508 | } |
| 509 | |
| 510 | int ViERTP_RTCPImpl::SetHybridNACKFECStatus( |
| 511 | const int video_channel, |
| 512 | const bool enable, |
| 513 | const unsigned char payload_typeRED, |
| 514 | const unsigned char payload_typeFEC) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 515 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 516 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 517 | "%s(channel: %d, enable: %d, payload_typeRED: %u, " |
| 518 | "payloadTypeFEC: %u)", |
| 519 | __FUNCTION__, video_channel, enable, payload_typeRED, |
| 520 | payload_typeFEC); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 521 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 522 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 523 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 524 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 525 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 526 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 527 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 528 | return -1; |
| 529 | } |
| 530 | |
| 531 | // Update the channel status with hybrid NACK FEC mode. |
| 532 | if (vie_channel->SetHybridNACKFECStatus(enable, payload_typeRED, |
| 533 | payload_typeFEC) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 534 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 535 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 536 | "%s: failed for channel %d", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 537 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 538 | return -1; |
| 539 | } |
| 540 | |
| 541 | // Update the encoder. |
| 542 | ViEEncoder* vie_encoder = cs.Encoder(video_channel); |
| 543 | if (!vie_encoder) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 544 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 545 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 546 | "%s: Could not get encoder for channel %d", __FUNCTION__, |
| 547 | video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 548 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 549 | return -1; |
| 550 | } |
| 551 | vie_encoder->UpdateProtectionMethod(); |
| 552 | return 0; |
| 553 | } |
| 554 | |
| 555 | int ViERTP_RTCPImpl::SetKeyFrameRequestMethod( |
| 556 | const int video_channel, |
| 557 | const ViEKeyFrameRequestMethod method) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 558 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 559 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 560 | "%s(channel: %d, method: %d)", __FUNCTION__, video_channel, |
| 561 | method); |
| 562 | |
| 563 | // Get the channel. |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 564 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 565 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 566 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 567 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 568 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 569 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 570 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 571 | return -1; |
| 572 | } |
| 573 | KeyFrameRequestMethod module_method = APIRequestToModuleRequest(method); |
| 574 | if (vie_channel->SetKeyFrameRequestMethod(module_method) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 575 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 576 | return -1; |
| 577 | } |
| 578 | return 0; |
| 579 | } |
| 580 | |
| 581 | int ViERTP_RTCPImpl::SetTMMBRStatus(const int video_channel, |
| 582 | const bool enable) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 583 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 584 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 585 | "%s(channel: %d, enable: %d)", __FUNCTION__, video_channel, |
| 586 | enable); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 587 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 588 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 589 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 590 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 591 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 592 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 593 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 594 | return -1; |
| 595 | } |
| 596 | if (vie_channel->EnableTMMBR(enable) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 597 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 598 | return -1; |
| 599 | } |
| 600 | return 0; |
| 601 | } |
| 602 | |
mflodman@webrtc.org | 6cf529d | 2012-01-24 06:16:16 +0000 | [diff] [blame] | 603 | int ViERTP_RTCPImpl::SetRembStatus(int video_channel, bool sender, |
mflodman@webrtc.org | 84dc3d1 | 2011-12-22 10:26:13 +0000 | [diff] [blame] | 604 | bool receiver) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 605 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 606 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 84dc3d1 | 2011-12-22 10:26:13 +0000 | [diff] [blame] | 607 | "ViERTP_RTCPImpl::SetRembStatus(%d, %d, %d)", video_channel, |
| 608 | sender, receiver); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 609 | if (!shared_data_->channel_manager()->SetRembStatus(video_channel, sender, |
| 610 | receiver)) { |
mflodman@webrtc.org | 6cf529d | 2012-01-24 06:16:16 +0000 | [diff] [blame] | 611 | return -1; |
| 612 | } |
| 613 | return 0; |
mflodman@webrtc.org | 84dc3d1 | 2011-12-22 10:26:13 +0000 | [diff] [blame] | 614 | } |
| 615 | |
stefan@webrtc.org | 976a7e6 | 2012-09-21 13:20:21 +0000 | [diff] [blame] | 616 | int ViERTP_RTCPImpl::SetBandwidthEstimationMode(BandwidthEstimationMode mode) { |
| 617 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, shared_data_->instance_id(), |
| 618 | "ViERTP_RTCPImpl::SetBandwidthEstimationMode(%d)", mode); |
| 619 | if (!shared_data_->channel_manager()->SetBandwidthEstimationMode(mode)) { |
| 620 | return -1; |
| 621 | } |
| 622 | return 0; |
| 623 | } |
| 624 | |
mflodman@webrtc.org | 90071dd | 2012-08-13 17:13:27 +0000 | [diff] [blame] | 625 | int ViERTP_RTCPImpl::SetSendTimestampOffsetStatus(int video_channel, |
| 626 | bool enable, |
| 627 | int id) { |
| 628 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 629 | ViEId(shared_data_->instance_id(), video_channel), |
| 630 | "ViERTP_RTCPImpl::SetSendTimestampOffsetStatus(%d, %d, %d)", |
| 631 | video_channel, enable, id); |
| 632 | |
| 633 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 634 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 635 | if (!vie_channel) { |
| 636 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 637 | ViEId(shared_data_->instance_id(), video_channel), |
| 638 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
| 639 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 640 | return -1; |
| 641 | } |
| 642 | if (vie_channel->SetSendTimestampOffsetStatus(enable, id) != 0) { |
| 643 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
| 644 | return -1; |
| 645 | } |
| 646 | return 0; |
| 647 | } |
| 648 | |
| 649 | int ViERTP_RTCPImpl::SetReceiveTimestampOffsetStatus(int video_channel, |
| 650 | bool enable, |
| 651 | int id) { |
| 652 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 653 | ViEId(shared_data_->instance_id(), video_channel), |
| 654 | "ViERTP_RTCPImpl::SetReceiveTimestampOffsetStatus(%d, %d, %d)", |
| 655 | video_channel, enable, id); |
| 656 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 657 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 658 | if (!vie_channel) { |
| 659 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 660 | ViEId(shared_data_->instance_id(), video_channel), |
| 661 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
| 662 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 663 | return -1; |
| 664 | } |
| 665 | if (vie_channel->SetReceiveTimestampOffsetStatus(enable, id) != 0) { |
| 666 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
| 667 | return -1; |
| 668 | } |
| 669 | return 0; |
| 670 | } |
| 671 | |
mflodman@webrtc.org | 5a7507f | 2012-09-12 13:47:06 +0000 | [diff] [blame] | 672 | int ViERTP_RTCPImpl::SetTransmissionSmoothingStatus(int video_channel, |
| 673 | bool enable) { |
| 674 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 675 | ViEId(shared_data_->instance_id(), video_channel), |
| 676 | "%s(channel: %d, enble: %d)", __FUNCTION__, video_channel, |
| 677 | enable); |
| 678 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 679 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 680 | if (!vie_channel) { |
| 681 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 682 | ViEId(shared_data_->instance_id(), video_channel), |
| 683 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
| 684 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 685 | return -1; |
| 686 | } |
| 687 | vie_channel->SetTransmissionSmoothingStatus(enable); |
| 688 | return 0; |
| 689 | } |
| 690 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 691 | int ViERTP_RTCPImpl::GetReceivedRTCPStatistics(const int video_channel, |
mflodman@webrtc.org | 9ba151b | 2012-06-21 10:02:13 +0000 | [diff] [blame] | 692 | uint16_t& fraction_lost, |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 693 | unsigned int& cumulative_lost, |
| 694 | unsigned int& extended_max, |
| 695 | unsigned int& jitter, |
| 696 | int& rtt_ms) const { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 697 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 698 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 699 | "%s(channel: %d)", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 700 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 701 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 702 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 703 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 704 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 705 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 706 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 707 | return -1; |
| 708 | } |
mflodman@webrtc.org | f5e99db | 2012-06-27 09:49:37 +0000 | [diff] [blame] | 709 | if (vie_channel->GetReceivedRtcpStatistics(&fraction_lost, |
| 710 | &cumulative_lost, |
| 711 | &extended_max, |
| 712 | &jitter, |
| 713 | &rtt_ms) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 714 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 715 | return -1; |
| 716 | } |
| 717 | return 0; |
| 718 | } |
| 719 | |
| 720 | int ViERTP_RTCPImpl::GetSentRTCPStatistics(const int video_channel, |
mflodman@webrtc.org | 9ba151b | 2012-06-21 10:02:13 +0000 | [diff] [blame] | 721 | uint16_t& fraction_lost, |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 722 | unsigned int& cumulative_lost, |
| 723 | unsigned int& extended_max, |
| 724 | unsigned int& jitter, |
| 725 | int& rtt_ms) const { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 726 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 727 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 728 | "%s(channel: %d)", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 729 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 730 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 731 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 732 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 733 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 734 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 735 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 736 | return -1; |
| 737 | } |
| 738 | |
mflodman@webrtc.org | f5e99db | 2012-06-27 09:49:37 +0000 | [diff] [blame] | 739 | if (vie_channel->GetSendRtcpStatistics(&fraction_lost, &cumulative_lost, |
| 740 | &extended_max, &jitter, |
| 741 | &rtt_ms) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 742 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 743 | return -1; |
| 744 | } |
| 745 | return 0; |
| 746 | } |
| 747 | |
| 748 | int ViERTP_RTCPImpl::GetRTPStatistics(const int video_channel, |
| 749 | unsigned int& bytes_sent, |
| 750 | unsigned int& packets_sent, |
| 751 | unsigned int& bytes_received, |
| 752 | unsigned int& packets_received) const { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 753 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 754 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 755 | "%s(channel: %d)", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 756 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 757 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 758 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 759 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 760 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 761 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 762 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 763 | return -1; |
| 764 | } |
mflodman@webrtc.org | f5e99db | 2012-06-27 09:49:37 +0000 | [diff] [blame] | 765 | if (vie_channel->GetRtpStatistics(&bytes_sent, |
| 766 | &packets_sent, |
| 767 | &bytes_received, |
| 768 | &packets_received) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 769 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 770 | return -1; |
| 771 | } |
| 772 | return 0; |
| 773 | } |
| 774 | |
| 775 | int ViERTP_RTCPImpl::GetBandwidthUsage(const int video_channel, |
| 776 | unsigned int& total_bitrate_sent, |
| 777 | unsigned int& video_bitrate_sent, |
| 778 | unsigned int& fec_bitrate_sent, |
| 779 | unsigned int& nackBitrateSent) const { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 780 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 781 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 782 | "%s(channel: %d)", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 783 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 784 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 785 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 786 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 787 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 788 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 789 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 790 | return -1; |
| 791 | } |
mflodman@webrtc.org | f5e99db | 2012-06-27 09:49:37 +0000 | [diff] [blame] | 792 | vie_channel->GetBandwidthUsage(&total_bitrate_sent, |
| 793 | &video_bitrate_sent, |
| 794 | &fec_bitrate_sent, |
| 795 | &nackBitrateSent); |
stefan@webrtc.org | d0bdab0 | 2011-10-14 14:24:54 +0000 | [diff] [blame] | 796 | return 0; |
| 797 | } |
| 798 | |
stefan@webrtc.org | 439be29 | 2012-02-16 14:45:37 +0000 | [diff] [blame] | 799 | int ViERTP_RTCPImpl::GetEstimatedSendBandwidth( |
stefan@webrtc.org | 07b45a5 | 2012-02-02 08:37:48 +0000 | [diff] [blame] | 800 | const int video_channel, |
| 801 | unsigned int* estimated_bandwidth) const { |
| 802 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 803 | ViEId(shared_data_->instance_id(), video_channel), |
| 804 | "%s(channel: %d)", __FUNCTION__, video_channel); |
| 805 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 806 | ViEEncoder* vie_encoder = cs.Encoder(video_channel); |
| 807 | if (!vie_encoder) { |
| 808 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 809 | ViEId(shared_data_->instance_id(), video_channel), |
| 810 | "%s: Could not get encoder for channel %d", __FUNCTION__, |
| 811 | video_channel); |
| 812 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 813 | return -1; |
| 814 | } |
stefan@webrtc.org | 439be29 | 2012-02-16 14:45:37 +0000 | [diff] [blame] | 815 | return vie_encoder->EstimatedSendBandwidth( |
| 816 | static_cast<WebRtc_UWord32*>(estimated_bandwidth)); |
| 817 | } |
| 818 | |
| 819 | int ViERTP_RTCPImpl::GetEstimatedReceiveBandwidth( |
| 820 | const int video_channel, |
| 821 | unsigned int* estimated_bandwidth) const { |
| 822 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 823 | ViEId(shared_data_->instance_id(), video_channel), |
| 824 | "%s(channel: %d)", __FUNCTION__, video_channel); |
| 825 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 826 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 827 | if (!vie_channel) { |
| 828 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 829 | ViEId(shared_data_->instance_id(), video_channel), |
| 830 | "%s: Could not get channel %d", __FUNCTION__, |
| 831 | video_channel); |
| 832 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 833 | return -1; |
| 834 | } |
| 835 | return vie_channel->GetEstimatedReceiveBandwidth( |
stefan@webrtc.org | 07b45a5 | 2012-02-02 08:37:48 +0000 | [diff] [blame] | 836 | static_cast<WebRtc_UWord32*>(estimated_bandwidth)); |
| 837 | } |
| 838 | |
astor@webrtc.org | c0496e6 | 2012-08-10 10:14:43 +0000 | [diff] [blame] | 839 | int ViERTP_RTCPImpl::SetOverUseDetectorOptions( |
| 840 | const OverUseDetectorOptions& options) const { |
| 841 | if (!shared_data_->Initialized()) { |
| 842 | shared_data_->SetLastError(kViENotInitialized); |
| 843 | WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()), |
| 844 | "%s - ViE instance %d not initialized", __FUNCTION__, |
| 845 | shared_data_->instance_id()); |
| 846 | return -1; |
| 847 | } |
| 848 | // Lock the channel manager to avoid creating a channel with |
| 849 | // "undefined" bwe settings (atomic copy). |
| 850 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 851 | shared_data_->SetOverUseDetectorOptions(options); |
| 852 | return 0; |
| 853 | } |
| 854 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 855 | int ViERTP_RTCPImpl::StartRTPDump(const int video_channel, |
| 856 | const char file_nameUTF8[1024], |
| 857 | RTPDirections direction) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 858 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 859 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 860 | "%s(channel: %d, file_name: %s, direction: %d)", __FUNCTION__, |
| 861 | video_channel, file_nameUTF8, direction); |
| 862 | assert(FileWrapper::kMaxFileNameSize == 1024); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 863 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 864 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 865 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 866 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 867 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 868 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 869 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 870 | return -1; |
| 871 | } |
| 872 | if (vie_channel->StartRTPDump(file_nameUTF8, direction) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 873 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 874 | return -1; |
| 875 | } |
| 876 | return 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 877 | } |
| 878 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 879 | int ViERTP_RTCPImpl::StopRTPDump(const int video_channel, |
| 880 | RTPDirections direction) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 881 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 882 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 883 | "%s(channel: %d, direction: %d)", __FUNCTION__, video_channel, |
| 884 | direction); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 885 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 886 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 887 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 888 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 889 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 890 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 891 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 892 | return -1; |
| 893 | } |
| 894 | if (vie_channel->StopRTPDump(direction) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 895 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 896 | return -1; |
| 897 | } |
| 898 | return 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 899 | } |
| 900 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 901 | int ViERTP_RTCPImpl::RegisterRTPObserver(const int video_channel, |
| 902 | ViERTPObserver& observer) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 903 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 904 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 905 | "%s(channel: %d)", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 906 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 907 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 908 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 909 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 910 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 911 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 912 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 913 | return -1; |
| 914 | } |
| 915 | if (vie_channel->RegisterRtpObserver(&observer) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 916 | shared_data_->SetLastError(kViERtpRtcpObserverAlreadyRegistered); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 917 | return -1; |
| 918 | } |
| 919 | return 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 920 | } |
| 921 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 922 | int ViERTP_RTCPImpl::DeregisterRTPObserver(const int video_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 923 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 924 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 925 | "%s(channel: %d)", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 926 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 927 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 928 | if (!vie_channel) { |
| 929 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 930 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 931 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 932 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 933 | return -1; |
| 934 | } |
| 935 | if (vie_channel->RegisterRtpObserver(NULL) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 936 | shared_data_->SetLastError(kViERtpRtcpObserverNotRegistered); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 937 | return -1; |
| 938 | } |
| 939 | return 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 940 | } |
| 941 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 942 | int ViERTP_RTCPImpl::RegisterRTCPObserver(const int video_channel, |
| 943 | ViERTCPObserver& observer) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 944 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 945 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 946 | "%s(channel: %d)", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 947 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 948 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 949 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 950 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 951 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 952 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 953 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 954 | return -1; |
| 955 | } |
| 956 | if (vie_channel->RegisterRtcpObserver(&observer) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 957 | shared_data_->SetLastError(kViERtpRtcpObserverAlreadyRegistered); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 958 | return -1; |
| 959 | } |
| 960 | return 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 961 | } |
| 962 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 963 | int ViERTP_RTCPImpl::DeregisterRTCPObserver(const int video_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 964 | WEBRTC_TRACE(kTraceApiCall, kTraceVideo, |
| 965 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 966 | "%s(channel: %d)", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 967 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 968 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 969 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 970 | WEBRTC_TRACE(kTraceError, kTraceVideo, |
| 971 | ViEId(shared_data_->instance_id(), video_channel), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 972 | "%s: Channel %d doesn't exist", __FUNCTION__, video_channel); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 973 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 974 | return -1; |
| 975 | } |
| 976 | if (vie_channel->RegisterRtcpObserver(NULL) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 977 | shared_data_->SetLastError(kViERtpRtcpObserverNotRegistered); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 978 | return -1; |
| 979 | } |
| 980 | return 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 981 | } |
| 982 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 983 | } // namespace webrtc |