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