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 | |
pbos@webrtc.org | f5d4cb1 | 2013-05-17 13:44:48 +0000 | [diff] [blame] | 11 | #include "webrtc/video_engine/vie_rtp_rtcp_impl.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 12 | |
pbos@webrtc.org | f5d4cb1 | 2013-05-17 13:44:48 +0000 | [diff] [blame] | 13 | #include "webrtc/engine_configurations.h" |
| 14 | #include "webrtc/system_wrappers/interface/file_wrapper.h" |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 15 | #include "webrtc/system_wrappers/interface/logging.h" |
pbos@webrtc.org | f5d4cb1 | 2013-05-17 13:44:48 +0000 | [diff] [blame] | 16 | #include "webrtc/video_engine/include/vie_errors.h" |
| 17 | #include "webrtc/video_engine/vie_channel.h" |
| 18 | #include "webrtc/video_engine/vie_channel_manager.h" |
| 19 | #include "webrtc/video_engine/vie_defines.h" |
| 20 | #include "webrtc/video_engine/vie_encoder.h" |
| 21 | #include "webrtc/video_engine/vie_impl.h" |
| 22 | #include "webrtc/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 | } |
andrew@webrtc.org | d72262d | 2013-05-09 02:12:07 +0000 | [diff] [blame] | 82 | VideoEngineImpl* vie_impl = static_cast<VideoEngineImpl*>(video_engine); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 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 | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 93 | // Decrease ref count. |
| 94 | (*this)--; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 95 | |
pbos@webrtc.org | b238d12 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 96 | int32_t ref_count = GetCount(); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 97 | if (ref_count < 0) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 98 | LOG(LS_ERROR) << "ViERTP_RTCP released too many times."; |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 99 | shared_data_->SetLastError(kViEAPIDoesNotExist); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 100 | return -1; |
| 101 | } |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 102 | return ref_count; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 103 | } |
| 104 | |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 105 | ViERTP_RTCPImpl::ViERTP_RTCPImpl(ViESharedData* shared_data) |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 106 | : shared_data_(shared_data) {} |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 107 | |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 108 | ViERTP_RTCPImpl::~ViERTP_RTCPImpl() {} |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 109 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 110 | int ViERTP_RTCPImpl::SetLocalSSRC(const int video_channel, |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 111 | const unsigned int SSRC, |
| 112 | const StreamType usage, |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 113 | const unsigned char simulcast_idx) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 114 | LOG_F(LS_INFO) << "channel: " << video_channel << " ssrc: " << SSRC << ""; |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 115 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 116 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 117 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 118 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 119 | return -1; |
| 120 | } |
| 121 | if (vie_channel->SetSSRC(SSRC, usage, simulcast_idx) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 122 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 123 | return -1; |
| 124 | } |
| 125 | return 0; |
| 126 | } |
| 127 | |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 128 | int ViERTP_RTCPImpl::SetRemoteSSRCType(const int videoChannel, |
| 129 | const StreamType usage, |
| 130 | const unsigned int SSRC) const { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 131 | LOG_F(LS_INFO) << "channel: " << videoChannel |
| 132 | << " usage: " << static_cast<int>(usage) << " ssrc: " << SSRC; |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 133 | |
| 134 | // Get the channel |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 135 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 136 | ViEChannel* ptrViEChannel = cs.Channel(videoChannel); |
| 137 | if (ptrViEChannel == NULL) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 138 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 139 | return -1; |
| 140 | } |
| 141 | if (ptrViEChannel->SetRemoteSSRCType(usage, SSRC) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 142 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 143 | return -1; |
| 144 | } |
| 145 | return 0; |
| 146 | } |
| 147 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 148 | int ViERTP_RTCPImpl::GetLocalSSRC(const int video_channel, |
| 149 | unsigned int& SSRC) const { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 150 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 151 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 152 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 153 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 154 | return -1; |
| 155 | } |
mflodman@webrtc.org | d6ec386 | 2012-10-25 11:30:29 +0000 | [diff] [blame] | 156 | uint8_t idx = 0; |
| 157 | if (vie_channel->GetLocalSSRC(idx, &SSRC) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 158 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 159 | return -1; |
| 160 | } |
| 161 | return 0; |
| 162 | } |
| 163 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 164 | int ViERTP_RTCPImpl::GetRemoteSSRC(const int video_channel, |
| 165 | unsigned int& SSRC) const { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 166 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 167 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 168 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 169 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 170 | return -1; |
| 171 | } |
mflodman@webrtc.org | f5e99db | 2012-06-27 09:49:37 +0000 | [diff] [blame] | 172 | if (vie_channel->GetRemoteSSRC(&SSRC) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 173 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 174 | return -1; |
| 175 | } |
| 176 | return 0; |
| 177 | } |
| 178 | |
| 179 | int ViERTP_RTCPImpl::GetRemoteCSRCs(const int video_channel, |
| 180 | unsigned int CSRCs[kRtpCsrcSize]) const { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 181 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 182 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 183 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 184 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 185 | return -1; |
| 186 | } |
| 187 | if (vie_channel->GetRemoteCSRC(CSRCs) != 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 | 9f5ebb5 | 2013-04-12 14:55:46 +0000 | [diff] [blame] | 194 | int ViERTP_RTCPImpl::SetRtxSendPayloadType(const int video_channel, |
| 195 | const uint8_t payload_type) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 196 | LOG_F(LS_INFO) << "channel: " << video_channel |
| 197 | << " payload_type: " << payload_type; |
mflodman@webrtc.org | 9f5ebb5 | 2013-04-12 14:55:46 +0000 | [diff] [blame] | 198 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 199 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 200 | if (!vie_channel) { |
mflodman@webrtc.org | 9f5ebb5 | 2013-04-12 14:55:46 +0000 | [diff] [blame] | 201 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 202 | return -1; |
| 203 | } |
stefan@webrtc.org | c74c3c2 | 2013-05-23 13:48:22 +0000 | [diff] [blame] | 204 | if (vie_channel->SetRtxSendPayloadType(payload_type) != 0) { |
mflodman@webrtc.org | 9f5ebb5 | 2013-04-12 14:55:46 +0000 | [diff] [blame] | 205 | return -1; |
| 206 | } |
| 207 | return 0; |
| 208 | } |
| 209 | |
| 210 | int ViERTP_RTCPImpl::SetRtxReceivePayloadType(const int video_channel, |
| 211 | const uint8_t payload_type) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 212 | LOG_F(LS_INFO) << "channel: " << video_channel |
| 213 | << " payload_type: " << payload_type; |
mflodman@webrtc.org | 9f5ebb5 | 2013-04-12 14:55:46 +0000 | [diff] [blame] | 214 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 215 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 216 | if (!vie_channel) { |
mflodman@webrtc.org | 9f5ebb5 | 2013-04-12 14:55:46 +0000 | [diff] [blame] | 217 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 218 | return -1; |
| 219 | } |
| 220 | vie_channel->SetRtxReceivePayloadType(payload_type); |
| 221 | return 0; |
| 222 | } |
| 223 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 224 | int ViERTP_RTCPImpl::SetStartSequenceNumber(const int video_channel, |
mflodman@webrtc.org | 9ba151b | 2012-06-21 10:02:13 +0000 | [diff] [blame] | 225 | uint16_t sequence_number) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 226 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 227 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 228 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 229 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 230 | return -1; |
| 231 | } |
| 232 | if (vie_channel->Sending()) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 233 | LOG_F(LS_ERROR) << "channel " << video_channel << " is already sending."; |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 234 | shared_data_->SetLastError(kViERtpRtcpAlreadySending); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 235 | return -1; |
| 236 | } |
| 237 | if (vie_channel->SetStartSequenceNumber(sequence_number) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 238 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 239 | return -1; |
| 240 | } |
| 241 | return 0; |
| 242 | } |
| 243 | |
| 244 | int ViERTP_RTCPImpl::SetRTCPStatus(const int video_channel, |
| 245 | const ViERTCPMode rtcp_mode) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 246 | LOG_F(LS_INFO) << "channel: " << video_channel |
| 247 | << " mode: " << static_cast<int>(rtcp_mode); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 248 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 249 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 250 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 251 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
stefan@webrtc.org | d0bdab0 | 2011-10-14 14:24:54 +0000 | [diff] [blame] | 252 | return -1; |
| 253 | } |
| 254 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 255 | RTCPMethod module_mode = ViERTCPModeToRTCPMethod(rtcp_mode); |
| 256 | if (vie_channel->SetRTCPMode(module_mode) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 257 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 258 | return -1; |
| 259 | } |
| 260 | return 0; |
| 261 | } |
| 262 | |
| 263 | int ViERTP_RTCPImpl::GetRTCPStatus(const int video_channel, |
| 264 | ViERTCPMode& rtcp_mode) const { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 265 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 266 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 267 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 268 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 269 | return -1; |
| 270 | } |
| 271 | RTCPMethod module_mode = kRtcpOff; |
mflodman@webrtc.org | f5e99db | 2012-06-27 09:49:37 +0000 | [diff] [blame] | 272 | if (vie_channel->GetRTCPMode(&module_mode) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 273 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 274 | return -1; |
| 275 | } |
| 276 | rtcp_mode = RTCPMethodToViERTCPMode(module_mode); |
| 277 | return 0; |
| 278 | } |
| 279 | |
| 280 | int ViERTP_RTCPImpl::SetRTCPCName(const int video_channel, |
| 281 | const char rtcp_cname[KMaxRTCPCNameLength]) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 282 | LOG_F(LS_INFO) << "channel: " << video_channel |
| 283 | << " rtcp_cname: " << rtcp_cname; |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 284 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 285 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 286 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 287 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 288 | return -1; |
| 289 | } |
| 290 | if (vie_channel->Sending()) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 291 | LOG_F(LS_ERROR) << "channel " << video_channel << " is already sending."; |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 292 | shared_data_->SetLastError(kViERtpRtcpAlreadySending); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 293 | return -1; |
| 294 | } |
| 295 | if (vie_channel->SetRTCPCName(rtcp_cname) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 296 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 297 | return -1; |
| 298 | } |
| 299 | return 0; |
| 300 | } |
| 301 | |
| 302 | int ViERTP_RTCPImpl::GetRTCPCName(const int video_channel, |
| 303 | char rtcp_cname[KMaxRTCPCNameLength]) const { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 304 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 305 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 306 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 307 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 308 | return -1; |
| 309 | } |
| 310 | if (vie_channel->GetRTCPCName(rtcp_cname) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 311 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 312 | return -1; |
| 313 | } |
| 314 | return 0; |
| 315 | } |
| 316 | |
| 317 | int ViERTP_RTCPImpl::GetRemoteRTCPCName( |
| 318 | const int video_channel, |
| 319 | char rtcp_cname[KMaxRTCPCNameLength]) const { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 320 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 321 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 322 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 323 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 324 | return -1; |
| 325 | } |
| 326 | if (vie_channel->GetRemoteRTCPCName(rtcp_cname) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 327 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 328 | return -1; |
| 329 | } |
| 330 | return 0; |
| 331 | } |
| 332 | |
| 333 | int ViERTP_RTCPImpl::SendApplicationDefinedRTCPPacket( |
| 334 | const int video_channel, |
| 335 | const unsigned char sub_type, |
| 336 | unsigned int name, |
| 337 | const char* data, |
mflodman@webrtc.org | 9ba151b | 2012-06-21 10:02:13 +0000 | [diff] [blame] | 338 | uint16_t data_length_in_bytes) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 339 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 340 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 341 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 342 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 343 | return -1; |
| 344 | } |
| 345 | if (!vie_channel->Sending()) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 346 | shared_data_->SetLastError(kViERtpRtcpNotSending); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 347 | return -1; |
| 348 | } |
| 349 | RTCPMethod method; |
mflodman@webrtc.org | f5e99db | 2012-06-27 09:49:37 +0000 | [diff] [blame] | 350 | if (vie_channel->GetRTCPMode(&method) != 0 || method == kRtcpOff) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 351 | shared_data_->SetLastError(kViERtpRtcpRtcpDisabled); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 352 | return -1; |
| 353 | } |
| 354 | if (vie_channel->SendApplicationDefinedRTCPPacket( |
pbos@webrtc.org | b238d12 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 355 | sub_type, name, reinterpret_cast<const uint8_t*>(data), |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 356 | data_length_in_bytes) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 357 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 358 | return -1; |
| 359 | } |
| 360 | return 0; |
| 361 | } |
| 362 | |
| 363 | int ViERTP_RTCPImpl::SetNACKStatus(const int video_channel, const bool enable) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 364 | LOG_F(LS_INFO) << "channel: " << video_channel << " " |
| 365 | << (enable ? "on" : "off"); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 366 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 367 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 368 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 369 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 370 | return -1; |
| 371 | } |
| 372 | if (vie_channel->SetNACKStatus(enable) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 373 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 374 | return -1; |
| 375 | } |
| 376 | |
| 377 | // Update the encoder |
| 378 | ViEEncoder* vie_encoder = cs.Encoder(video_channel); |
| 379 | if (!vie_encoder) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 380 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 381 | return -1; |
| 382 | } |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 383 | vie_encoder->UpdateProtectionMethod(enable); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 384 | return 0; |
| 385 | } |
| 386 | |
| 387 | int ViERTP_RTCPImpl::SetFECStatus(const int video_channel, const bool enable, |
| 388 | const unsigned char payload_typeRED, |
| 389 | const unsigned char payload_typeFEC) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 390 | LOG_F(LS_INFO) << "channel: " << video_channel |
| 391 | << " enable: " << (enable ? "on" : "off") |
| 392 | << " payload_typeRED: " << payload_typeRED |
| 393 | << " payload_typeFEC: " << payload_typeFEC; |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 394 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 395 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 396 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 397 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 398 | return -1; |
| 399 | } |
| 400 | if (vie_channel->SetFECStatus(enable, payload_typeRED, |
| 401 | payload_typeFEC) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 402 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 403 | return -1; |
| 404 | } |
| 405 | // Update the encoder. |
| 406 | ViEEncoder* vie_encoder = cs.Encoder(video_channel); |
| 407 | if (!vie_encoder) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 408 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 409 | return -1; |
| 410 | } |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 411 | vie_encoder->UpdateProtectionMethod(false); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 412 | return 0; |
| 413 | } |
| 414 | |
| 415 | int ViERTP_RTCPImpl::SetHybridNACKFECStatus( |
| 416 | const int video_channel, |
| 417 | const bool enable, |
| 418 | const unsigned char payload_typeRED, |
| 419 | const unsigned char payload_typeFEC) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 420 | LOG_F(LS_INFO) << "channel: " << video_channel |
| 421 | << " enable: " << (enable ? "on" : "off") |
| 422 | << " payload_typeRED: " << payload_typeRED |
| 423 | << " payload_typeFEC: " << payload_typeFEC; |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 424 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 425 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 426 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 427 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 428 | return -1; |
| 429 | } |
| 430 | |
| 431 | // Update the channel status with hybrid NACK FEC mode. |
| 432 | if (vie_channel->SetHybridNACKFECStatus(enable, payload_typeRED, |
| 433 | payload_typeFEC) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 434 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 435 | return -1; |
| 436 | } |
| 437 | |
| 438 | // Update the encoder. |
| 439 | ViEEncoder* vie_encoder = cs.Encoder(video_channel); |
| 440 | if (!vie_encoder) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 441 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 442 | return -1; |
| 443 | } |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 444 | vie_encoder->UpdateProtectionMethod(enable); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 445 | return 0; |
| 446 | } |
| 447 | |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 448 | int ViERTP_RTCPImpl::SetSenderBufferingMode(int video_channel, |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 449 | int target_delay_ms) { |
| 450 | LOG_F(LS_INFO) << "channel: " << video_channel |
| 451 | << " target_delay_ms: " << target_delay_ms; |
mikhal@webrtc.org | dbe97d2 | 2013-02-01 19:33:21 +0000 | [diff] [blame] | 452 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 453 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 454 | if (!vie_channel) { |
mikhal@webrtc.org | dbe97d2 | 2013-02-01 19:33:21 +0000 | [diff] [blame] | 455 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 456 | return -1; |
| 457 | } |
mikhal@webrtc.org | 3d305c6 | 2013-02-10 18:42:55 +0000 | [diff] [blame] | 458 | ViEEncoder* vie_encoder = cs.Encoder(video_channel); |
| 459 | if (!vie_encoder) { |
mikhal@webrtc.org | 3d305c6 | 2013-02-10 18:42:55 +0000 | [diff] [blame] | 460 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 461 | return -1; |
| 462 | } |
mikhal@webrtc.org | dbe97d2 | 2013-02-01 19:33:21 +0000 | [diff] [blame] | 463 | |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 464 | // Update the channel with buffering mode settings. |
| 465 | if (vie_channel->SetSenderBufferingMode(target_delay_ms) != 0) { |
mikhal@webrtc.org | dbe97d2 | 2013-02-01 19:33:21 +0000 | [diff] [blame] | 466 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
| 467 | return -1; |
| 468 | } |
mikhal@webrtc.org | 3d305c6 | 2013-02-10 18:42:55 +0000 | [diff] [blame] | 469 | |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 470 | // Update the encoder's buffering mode settings. |
| 471 | vie_encoder->SetSenderBufferingMode(target_delay_ms); |
| 472 | return 0; |
| 473 | } |
| 474 | |
| 475 | int ViERTP_RTCPImpl::SetReceiverBufferingMode(int video_channel, |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 476 | int target_delay_ms) { |
| 477 | LOG_F(LS_INFO) << "channel: " << video_channel |
| 478 | << " target_delay_ms: " << target_delay_ms; |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 479 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 480 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 481 | if (!vie_channel) { |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 482 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 483 | return -1; |
| 484 | } |
stefan@webrtc.org | 8ca8a71 | 2013-04-23 16:48:32 +0000 | [diff] [blame] | 485 | |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 486 | // Update the channel with buffering mode settings. |
| 487 | if (vie_channel->SetReceiverBufferingMode(target_delay_ms) != 0) { |
mikhal@webrtc.org | ef9f76a | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 488 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
| 489 | return -1; |
| 490 | } |
mikhal@webrtc.org | dbe97d2 | 2013-02-01 19:33:21 +0000 | [diff] [blame] | 491 | return 0; |
| 492 | } |
| 493 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 494 | int ViERTP_RTCPImpl::SetKeyFrameRequestMethod( |
| 495 | const int video_channel, |
| 496 | const ViEKeyFrameRequestMethod method) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 497 | LOG_F(LS_INFO) << "channel: " << video_channel |
| 498 | << " method: " << static_cast<int>(method); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 499 | |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 500 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 501 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 502 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 503 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 504 | return -1; |
| 505 | } |
| 506 | KeyFrameRequestMethod module_method = APIRequestToModuleRequest(method); |
| 507 | if (vie_channel->SetKeyFrameRequestMethod(module_method) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 508 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 509 | return -1; |
| 510 | } |
| 511 | return 0; |
| 512 | } |
| 513 | |
| 514 | int ViERTP_RTCPImpl::SetTMMBRStatus(const int video_channel, |
| 515 | const bool enable) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 516 | LOG_F(LS_INFO) << "channel: " << video_channel |
| 517 | << "enable: " << (enable ? "on" : "off"); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 518 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 519 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 520 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 521 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 522 | return -1; |
| 523 | } |
| 524 | if (vie_channel->EnableTMMBR(enable) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 525 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 526 | return -1; |
| 527 | } |
| 528 | return 0; |
| 529 | } |
| 530 | |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 531 | int ViERTP_RTCPImpl::SetRembStatus(int video_channel, |
| 532 | bool sender, |
mflodman@webrtc.org | 84dc3d1 | 2011-12-22 10:26:13 +0000 | [diff] [blame] | 533 | bool receiver) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 534 | LOG_F(LS_INFO) << "channel: " << video_channel |
| 535 | << " sender: " << (sender ? "on" : "off") |
| 536 | << " receiver: " << (receiver ? "on" : "off"); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 537 | if (!shared_data_->channel_manager()->SetRembStatus(video_channel, sender, |
| 538 | receiver)) { |
mflodman@webrtc.org | 6cf529d | 2012-01-24 06:16:16 +0000 | [diff] [blame] | 539 | return -1; |
| 540 | } |
| 541 | return 0; |
mflodman@webrtc.org | 84dc3d1 | 2011-12-22 10:26:13 +0000 | [diff] [blame] | 542 | } |
| 543 | |
mflodman@webrtc.org | 90071dd | 2012-08-13 17:13:27 +0000 | [diff] [blame] | 544 | int ViERTP_RTCPImpl::SetSendTimestampOffsetStatus(int video_channel, |
| 545 | bool enable, |
| 546 | int id) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 547 | LOG_F(LS_INFO) << "channel: " << video_channel |
| 548 | << "enable: " << (enable ? "on" : "off") << " id: " << id; |
mflodman@webrtc.org | 90071dd | 2012-08-13 17:13:27 +0000 | [diff] [blame] | 549 | |
| 550 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 551 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 552 | if (!vie_channel) { |
mflodman@webrtc.org | 90071dd | 2012-08-13 17:13:27 +0000 | [diff] [blame] | 553 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 554 | return -1; |
| 555 | } |
| 556 | if (vie_channel->SetSendTimestampOffsetStatus(enable, id) != 0) { |
| 557 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
| 558 | return -1; |
| 559 | } |
| 560 | return 0; |
| 561 | } |
| 562 | |
| 563 | int ViERTP_RTCPImpl::SetReceiveTimestampOffsetStatus(int video_channel, |
| 564 | bool enable, |
| 565 | int id) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 566 | LOG_F(LS_INFO) << "channel: " << video_channel |
| 567 | << "enable: " << (enable ? "on" : "off") << " id: " << id; |
mflodman@webrtc.org | 90071dd | 2012-08-13 17:13:27 +0000 | [diff] [blame] | 568 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 569 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 570 | if (!vie_channel) { |
mflodman@webrtc.org | 90071dd | 2012-08-13 17:13:27 +0000 | [diff] [blame] | 571 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 572 | return -1; |
| 573 | } |
| 574 | if (vie_channel->SetReceiveTimestampOffsetStatus(enable, id) != 0) { |
| 575 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
| 576 | return -1; |
| 577 | } |
| 578 | return 0; |
| 579 | } |
| 580 | |
solenberg@webrtc.org | cb9cff0 | 2013-05-20 12:00:23 +0000 | [diff] [blame] | 581 | int ViERTP_RTCPImpl::SetSendAbsoluteSendTimeStatus(int video_channel, |
| 582 | bool enable, |
| 583 | int id) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 584 | LOG_F(LS_INFO) << "channel: " << video_channel |
| 585 | << "enable: " << (enable ? "on" : "off") << " id: " << id; |
solenberg@webrtc.org | cb9cff0 | 2013-05-20 12:00:23 +0000 | [diff] [blame] | 586 | |
| 587 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 588 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 589 | if (!vie_channel) { |
solenberg@webrtc.org | cb9cff0 | 2013-05-20 12:00:23 +0000 | [diff] [blame] | 590 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 591 | return -1; |
| 592 | } |
| 593 | if (vie_channel->SetSendAbsoluteSendTimeStatus(enable, id) != 0) { |
| 594 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
| 595 | return -1; |
| 596 | } |
| 597 | return 0; |
| 598 | } |
| 599 | |
| 600 | int ViERTP_RTCPImpl::SetReceiveAbsoluteSendTimeStatus(int video_channel, |
| 601 | bool enable, |
| 602 | int id) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 603 | LOG_F(LS_INFO) << "channel: " << video_channel |
| 604 | << "enable: " << (enable ? "on" : "off") << " id: " << id; |
pbos@webrtc.org | 5ab7567 | 2013-12-16 12:24:44 +0000 | [diff] [blame] | 605 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 606 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 607 | if (!vie_channel) { |
pbos@webrtc.org | 5ab7567 | 2013-12-16 12:24:44 +0000 | [diff] [blame] | 608 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 609 | return -1; |
| 610 | } |
| 611 | if (vie_channel->SetReceiveAbsoluteSendTimeStatus(enable, id) != 0) { |
solenberg@webrtc.org | cb9cff0 | 2013-05-20 12:00:23 +0000 | [diff] [blame] | 612 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
| 613 | return -1; |
| 614 | } |
| 615 | return 0; |
| 616 | } |
| 617 | |
asapersson@webrtc.org | 8d02f5d | 2013-11-21 08:57:04 +0000 | [diff] [blame] | 618 | int ViERTP_RTCPImpl::SetRtcpXrRrtrStatus(int video_channel, bool enable) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 619 | LOG_F(LS_INFO) << "channel: " << video_channel |
| 620 | << " enable: " << (enable ? "on" : "off"); |
asapersson@webrtc.org | 8d02f5d | 2013-11-21 08:57:04 +0000 | [diff] [blame] | 621 | |
| 622 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 623 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 624 | if (!vie_channel) { |
asapersson@webrtc.org | 8d02f5d | 2013-11-21 08:57:04 +0000 | [diff] [blame] | 625 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 626 | return -1; |
| 627 | } |
| 628 | vie_channel->SetRtcpXrRrtrStatus(enable); |
| 629 | return 0; |
| 630 | } |
| 631 | |
mflodman@webrtc.org | 5a7507f | 2012-09-12 13:47:06 +0000 | [diff] [blame] | 632 | int ViERTP_RTCPImpl::SetTransmissionSmoothingStatus(int video_channel, |
| 633 | bool enable) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 634 | LOG_F(LS_INFO) << "channel: " << video_channel |
| 635 | << " enable: " << (enable ? "on" : "off"); |
mflodman@webrtc.org | 5a7507f | 2012-09-12 13:47:06 +0000 | [diff] [blame] | 636 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 637 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 638 | if (!vie_channel) { |
mflodman@webrtc.org | 5a7507f | 2012-09-12 13:47:06 +0000 | [diff] [blame] | 639 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 640 | return -1; |
| 641 | } |
| 642 | vie_channel->SetTransmissionSmoothingStatus(enable); |
| 643 | return 0; |
| 644 | } |
| 645 | |
pbos@webrtc.org | 3349ae0 | 2014-03-13 12:52:27 +0000 | [diff] [blame] | 646 | int ViERTP_RTCPImpl::SetMinTransmitBitrate(int video_channel, |
| 647 | int min_transmit_bitrate_kbps) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 648 | LOG_F(LS_INFO) << "channel: " << video_channel |
| 649 | << " min_transmit_bitrate_kbps: " << min_transmit_bitrate_kbps; |
pbos@webrtc.org | 3349ae0 | 2014-03-13 12:52:27 +0000 | [diff] [blame] | 650 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 651 | ViEEncoder* vie_encoder = cs.Encoder(video_channel); |
| 652 | if (vie_encoder == NULL) |
| 653 | return -1; |
| 654 | vie_encoder->SetMinTransmitBitrate(min_transmit_bitrate_kbps); |
| 655 | return 0; |
| 656 | } |
| 657 | |
solenberg@webrtc.org | 4e65602 | 2014-03-26 14:32:47 +0000 | [diff] [blame] | 658 | int ViERTP_RTCPImpl::SetReservedTransmitBitrate( |
| 659 | int video_channel, unsigned int reserved_transmit_bitrate_bps) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 660 | LOG_F(LS_INFO) << "channel: " << video_channel |
| 661 | << " reserved_transmit_bitrate_bps: " |
| 662 | << reserved_transmit_bitrate_bps; |
solenberg@webrtc.org | 4e65602 | 2014-03-26 14:32:47 +0000 | [diff] [blame] | 663 | if (!shared_data_->channel_manager()->SetReservedTransmitBitrate( |
| 664 | video_channel, reserved_transmit_bitrate_bps)) { |
| 665 | return -1; |
| 666 | } |
| 667 | return 0; |
| 668 | } |
| 669 | |
sprang@webrtc.org | 7f73280 | 2013-12-06 11:56:55 +0000 | [diff] [blame] | 670 | int ViERTP_RTCPImpl::GetReceiveChannelRtcpStatistics( |
| 671 | const int video_channel, |
| 672 | RtcpStatistics& basic_stats, |
| 673 | int& rtt_ms) const { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 674 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 675 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 676 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 677 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 678 | return -1; |
| 679 | } |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 +0000 | [diff] [blame] | 680 | |
| 681 | // TODO(sprang): Clean this up when stats struct is propagated all the way. |
sprang@webrtc.org | 7f73280 | 2013-12-06 11:56:55 +0000 | [diff] [blame] | 682 | uint16_t frac_lost; |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 +0000 | [diff] [blame] | 683 | if (vie_channel->GetReceivedRtcpStatistics( |
sprang@webrtc.org | 7f73280 | 2013-12-06 11:56:55 +0000 | [diff] [blame] | 684 | &frac_lost, |
| 685 | &basic_stats.cumulative_lost, |
| 686 | &basic_stats.extended_max_sequence_number, |
| 687 | &basic_stats.jitter, |
| 688 | &rtt_ms) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 689 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 690 | return -1; |
| 691 | } |
sprang@webrtc.org | 7f73280 | 2013-12-06 11:56:55 +0000 | [diff] [blame] | 692 | basic_stats.fraction_lost = frac_lost; |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 693 | return 0; |
| 694 | } |
| 695 | |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 +0000 | [diff] [blame] | 696 | int ViERTP_RTCPImpl::GetSendChannelRtcpStatistics(const int video_channel, |
sprang@webrtc.org | 7f73280 | 2013-12-06 11:56:55 +0000 | [diff] [blame] | 697 | RtcpStatistics& basic_stats, |
| 698 | int& rtt_ms) const { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 699 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 700 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 701 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 702 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 703 | return -1; |
| 704 | } |
| 705 | |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 +0000 | [diff] [blame] | 706 | // TODO(sprang): Clean this up when stats struct is propagated all the way. |
sprang@webrtc.org | 7f73280 | 2013-12-06 11:56:55 +0000 | [diff] [blame] | 707 | uint16_t frac_lost; |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 +0000 | [diff] [blame] | 708 | if (vie_channel->GetSendRtcpStatistics( |
sprang@webrtc.org | 7f73280 | 2013-12-06 11:56:55 +0000 | [diff] [blame] | 709 | &frac_lost, |
| 710 | &basic_stats.cumulative_lost, |
| 711 | &basic_stats.extended_max_sequence_number, |
| 712 | &basic_stats.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 | } |
sprang@webrtc.org | 7f73280 | 2013-12-06 11:56:55 +0000 | [diff] [blame] | 717 | basic_stats.fraction_lost = frac_lost; |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 718 | return 0; |
| 719 | } |
| 720 | |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 +0000 | [diff] [blame] | 721 | int ViERTP_RTCPImpl::GetRtpStatistics(const int video_channel, |
| 722 | StreamDataCounters& sent, |
| 723 | StreamDataCounters& received) const { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 724 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 725 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 726 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 727 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 728 | return -1; |
| 729 | } |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 +0000 | [diff] [blame] | 730 | if (vie_channel->GetRtpStatistics(&sent.bytes, |
| 731 | &sent.packets, |
| 732 | &received.bytes, |
| 733 | &received.packets) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 734 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 735 | return -1; |
| 736 | } |
| 737 | return 0; |
| 738 | } |
| 739 | |
asapersson@webrtc.org | 8098e07 | 2014-02-19 11:59:02 +0000 | [diff] [blame] | 740 | int ViERTP_RTCPImpl::GetRtcpPacketTypeCounters( |
| 741 | int video_channel, |
| 742 | RtcpPacketTypeCounter* packets_sent, |
| 743 | RtcpPacketTypeCounter* packets_received) const { |
| 744 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 745 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 746 | if (!vie_channel) { |
asapersson@webrtc.org | 8098e07 | 2014-02-19 11:59:02 +0000 | [diff] [blame] | 747 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 748 | return -1; |
| 749 | } |
| 750 | vie_channel->GetRtcpPacketTypeCounters(packets_sent, packets_received); |
| 751 | return 0; |
| 752 | } |
| 753 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 754 | int ViERTP_RTCPImpl::GetBandwidthUsage(const int video_channel, |
| 755 | unsigned int& total_bitrate_sent, |
| 756 | unsigned int& video_bitrate_sent, |
| 757 | unsigned int& fec_bitrate_sent, |
| 758 | unsigned int& nackBitrateSent) const { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 759 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 760 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 761 | if (!vie_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 | vie_channel->GetBandwidthUsage(&total_bitrate_sent, |
| 766 | &video_bitrate_sent, |
| 767 | &fec_bitrate_sent, |
| 768 | &nackBitrateSent); |
stefan@webrtc.org | d0bdab0 | 2011-10-14 14:24:54 +0000 | [diff] [blame] | 769 | return 0; |
| 770 | } |
| 771 | |
stefan@webrtc.org | 439be29 | 2012-02-16 14:45:37 +0000 | [diff] [blame] | 772 | int ViERTP_RTCPImpl::GetEstimatedSendBandwidth( |
stefan@webrtc.org | 07b45a5 | 2012-02-02 08:37:48 +0000 | [diff] [blame] | 773 | const int video_channel, |
| 774 | unsigned int* estimated_bandwidth) const { |
stefan@webrtc.org | 24bd364 | 2014-05-02 12:35:37 +0000 | [diff] [blame] | 775 | if (!shared_data_->channel_manager()->GetEstimatedSendBandwidth( |
| 776 | video_channel, estimated_bandwidth)) { |
stefan@webrtc.org | 07b45a5 | 2012-02-02 08:37:48 +0000 | [diff] [blame] | 777 | return -1; |
| 778 | } |
stefan@webrtc.org | 24bd364 | 2014-05-02 12:35:37 +0000 | [diff] [blame] | 779 | return 0; |
stefan@webrtc.org | 439be29 | 2012-02-16 14:45:37 +0000 | [diff] [blame] | 780 | } |
| 781 | |
| 782 | int ViERTP_RTCPImpl::GetEstimatedReceiveBandwidth( |
| 783 | const int video_channel, |
| 784 | unsigned int* estimated_bandwidth) const { |
stefan@webrtc.org | 24bd364 | 2014-05-02 12:35:37 +0000 | [diff] [blame] | 785 | if (!shared_data_->channel_manager()->GetEstimatedReceiveBandwidth( |
| 786 | video_channel, estimated_bandwidth)) { |
stefan@webrtc.org | 439be29 | 2012-02-16 14:45:37 +0000 | [diff] [blame] | 787 | return -1; |
| 788 | } |
mflodman@webrtc.org | 4fd5527 | 2013-02-06 17:46:39 +0000 | [diff] [blame] | 789 | return 0; |
stefan@webrtc.org | 07b45a5 | 2012-02-02 08:37:48 +0000 | [diff] [blame] | 790 | } |
| 791 | |
jiayl@webrtc.org | 1f64f06 | 2014-02-10 19:12:14 +0000 | [diff] [blame] | 792 | int ViERTP_RTCPImpl::GetReceiveBandwidthEstimatorStats( |
| 793 | const int video_channel, |
| 794 | ReceiveBandwidthEstimatorStats* output) const { |
jiayl@webrtc.org | 1f64f06 | 2014-02-10 19:12:14 +0000 | [diff] [blame] | 795 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 796 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 797 | if (!vie_channel) { |
jiayl@webrtc.org | 1f64f06 | 2014-02-10 19:12:14 +0000 | [diff] [blame] | 798 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 799 | return -1; |
| 800 | } |
| 801 | vie_channel->GetReceiveBandwidthEstimatorStats(output); |
| 802 | return 0; |
| 803 | } |
| 804 | |
jiayl@webrtc.org | 9fd8d87 | 2014-02-27 22:32:40 +0000 | [diff] [blame] | 805 | int ViERTP_RTCPImpl::GetPacerQueuingDelayMs( |
| 806 | const int video_channel, int* delay_ms) const { |
jiayl@webrtc.org | 9fd8d87 | 2014-02-27 22:32:40 +0000 | [diff] [blame] | 807 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 808 | ViEEncoder* vie_encoder = cs.Encoder(video_channel); |
| 809 | if (!vie_encoder) { |
jiayl@webrtc.org | 9fd8d87 | 2014-02-27 22:32:40 +0000 | [diff] [blame] | 810 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 811 | return -1; |
| 812 | } |
| 813 | *delay_ms = vie_encoder->PacerQueuingDelayMs(); |
| 814 | return 0; |
| 815 | } |
| 816 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 817 | int ViERTP_RTCPImpl::StartRTPDump(const int video_channel, |
| 818 | const char file_nameUTF8[1024], |
| 819 | RTPDirections direction) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 820 | LOG_F(LS_INFO) << "channel: " << video_channel |
| 821 | << " filename: " << file_nameUTF8 |
| 822 | << " direction: " << static_cast<int>(direction); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 823 | assert(FileWrapper::kMaxFileNameSize == 1024); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 824 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 825 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 826 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 827 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 828 | return -1; |
| 829 | } |
| 830 | if (vie_channel->StartRTPDump(file_nameUTF8, direction) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 831 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 832 | return -1; |
| 833 | } |
| 834 | return 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 835 | } |
| 836 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 837 | int ViERTP_RTCPImpl::StopRTPDump(const int video_channel, |
| 838 | RTPDirections direction) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 839 | LOG_F(LS_INFO) << "channel: " << video_channel |
| 840 | << " direction: " << static_cast<int>(direction); |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 841 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 842 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 843 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 844 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 845 | return -1; |
| 846 | } |
| 847 | if (vie_channel->StopRTPDump(direction) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 848 | shared_data_->SetLastError(kViERtpRtcpUnknownError); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 849 | return -1; |
| 850 | } |
| 851 | return 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 852 | } |
| 853 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 854 | int ViERTP_RTCPImpl::RegisterRTPObserver(const int video_channel, |
| 855 | ViERTPObserver& observer) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 856 | LOG_F(LS_INFO) << "channel " << video_channel; |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 857 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 858 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 859 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 860 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 861 | return -1; |
| 862 | } |
| 863 | if (vie_channel->RegisterRtpObserver(&observer) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 864 | shared_data_->SetLastError(kViERtpRtcpObserverAlreadyRegistered); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 865 | return -1; |
| 866 | } |
| 867 | return 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 868 | } |
| 869 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 870 | int ViERTP_RTCPImpl::DeregisterRTPObserver(const int video_channel) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 871 | LOG_F(LS_INFO) << "channel " << video_channel; |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 872 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 873 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 874 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 875 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 876 | return -1; |
| 877 | } |
| 878 | if (vie_channel->RegisterRtpObserver(NULL) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 879 | shared_data_->SetLastError(kViERtpRtcpObserverNotRegistered); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 880 | return -1; |
| 881 | } |
| 882 | return 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 883 | } |
| 884 | |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 885 | int ViERTP_RTCPImpl::RegisterRTCPObserver(const int video_channel, |
| 886 | ViERTCPObserver& observer) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 887 | LOG_F(LS_INFO) << "channel " << video_channel; |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 888 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 889 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 890 | if (!vie_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->RegisterRtcpObserver(&observer) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 895 | shared_data_->SetLastError(kViERtpRtcpObserverAlreadyRegistered); |
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::DeregisterRTCPObserver(const int video_channel) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 902 | LOG_F(LS_INFO) << "channel " << video_channel; |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 903 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 904 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 905 | if (!vie_channel) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 906 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 907 | return -1; |
| 908 | } |
| 909 | if (vie_channel->RegisterRtcpObserver(NULL) != 0) { |
mflodman@webrtc.org | b11424b | 2012-01-25 13:42:03 +0000 | [diff] [blame] | 910 | shared_data_->SetLastError(kViERtpRtcpObserverNotRegistered); |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 911 | return -1; |
| 912 | } |
| 913 | return 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 914 | } |
| 915 | |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 +0000 | [diff] [blame] | 916 | int ViERTP_RTCPImpl::RegisterSendChannelRtcpStatisticsCallback( |
sprang@webrtc.org | a6ad6e5 | 2013-12-05 09:48:44 +0000 | [diff] [blame] | 917 | int video_channel, RtcpStatisticsCallback* callback) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 918 | LOG_F(LS_INFO) << "channel " << video_channel; |
sprang@webrtc.org | a6ad6e5 | 2013-12-05 09:48:44 +0000 | [diff] [blame] | 919 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 920 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 921 | if (!vie_channel) { |
sprang@webrtc.org | a6ad6e5 | 2013-12-05 09:48:44 +0000 | [diff] [blame] | 922 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 923 | return -1; |
| 924 | } |
| 925 | vie_channel->RegisterSendChannelRtcpStatisticsCallback(callback); |
| 926 | return 0; |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 +0000 | [diff] [blame] | 927 | } |
| 928 | |
| 929 | int ViERTP_RTCPImpl::DeregisterSendChannelRtcpStatisticsCallback( |
sprang@webrtc.org | a6ad6e5 | 2013-12-05 09:48:44 +0000 | [diff] [blame] | 930 | int video_channel, RtcpStatisticsCallback* callback) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 931 | LOG_F(LS_INFO) << "channel " << video_channel; |
sprang@webrtc.org | a6ad6e5 | 2013-12-05 09:48:44 +0000 | [diff] [blame] | 932 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 933 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 934 | if (!vie_channel) { |
sprang@webrtc.org | a6ad6e5 | 2013-12-05 09:48:44 +0000 | [diff] [blame] | 935 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 936 | return -1; |
| 937 | } |
| 938 | vie_channel->RegisterSendChannelRtcpStatisticsCallback(NULL); |
| 939 | return 0; |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 +0000 | [diff] [blame] | 940 | } |
| 941 | |
| 942 | int ViERTP_RTCPImpl::RegisterReceiveChannelRtcpStatisticsCallback( |
sprang@webrtc.org | 54ae4ff | 2013-12-19 13:26:02 +0000 | [diff] [blame] | 943 | const int video_channel, |
| 944 | RtcpStatisticsCallback* callback) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 945 | LOG_F(LS_INFO) << "channel " << video_channel; |
sprang@webrtc.org | 54ae4ff | 2013-12-19 13:26:02 +0000 | [diff] [blame] | 946 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 947 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 948 | assert(vie_channel != NULL); |
| 949 | vie_channel->RegisterReceiveChannelRtcpStatisticsCallback(callback); |
| 950 | return 0; |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 +0000 | [diff] [blame] | 951 | } |
| 952 | |
| 953 | int ViERTP_RTCPImpl::DeregisterReceiveChannelRtcpStatisticsCallback( |
sprang@webrtc.org | 54ae4ff | 2013-12-19 13:26:02 +0000 | [diff] [blame] | 954 | const int video_channel, |
| 955 | RtcpStatisticsCallback* callback) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 956 | LOG_F(LS_INFO) << "channel " << video_channel; |
sprang@webrtc.org | 54ae4ff | 2013-12-19 13:26:02 +0000 | [diff] [blame] | 957 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 958 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 959 | assert(vie_channel != NULL); |
| 960 | vie_channel->RegisterReceiveChannelRtcpStatisticsCallback(NULL); |
| 961 | return 0; |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 +0000 | [diff] [blame] | 962 | } |
| 963 | |
| 964 | int ViERTP_RTCPImpl::RegisterSendChannelRtpStatisticsCallback( |
sprang@webrtc.org | ebad765 | 2013-12-05 14:29:02 +0000 | [diff] [blame] | 965 | int video_channel, StreamDataCountersCallback* callback) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 966 | LOG_F(LS_INFO) << "channel " << video_channel; |
sprang@webrtc.org | ebad765 | 2013-12-05 14:29:02 +0000 | [diff] [blame] | 967 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 968 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 969 | assert(vie_channel != NULL); |
| 970 | vie_channel->RegisterSendChannelRtpStatisticsCallback(callback); |
| 971 | return 0; |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 +0000 | [diff] [blame] | 972 | } |
| 973 | |
| 974 | int ViERTP_RTCPImpl::DeregisterSendChannelRtpStatisticsCallback( |
sprang@webrtc.org | ebad765 | 2013-12-05 14:29:02 +0000 | [diff] [blame] | 975 | int video_channel, StreamDataCountersCallback* callback) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 976 | LOG_F(LS_INFO) << "channel " << video_channel; |
sprang@webrtc.org | ebad765 | 2013-12-05 14:29:02 +0000 | [diff] [blame] | 977 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 978 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 979 | assert(vie_channel != NULL); |
| 980 | vie_channel->RegisterSendChannelRtpStatisticsCallback(NULL); |
| 981 | return 0; |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 +0000 | [diff] [blame] | 982 | } |
| 983 | |
| 984 | int ViERTP_RTCPImpl::RegisterReceiveChannelRtpStatisticsCallback( |
sprang@webrtc.org | 0e93257 | 2014-01-23 10:00:39 +0000 | [diff] [blame] | 985 | const int video_channel, |
| 986 | StreamDataCountersCallback* callback) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 987 | LOG_F(LS_INFO) << "channel " << video_channel; |
sprang@webrtc.org | 0e93257 | 2014-01-23 10:00:39 +0000 | [diff] [blame] | 988 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 989 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 990 | assert(vie_channel != NULL); |
| 991 | vie_channel->RegisterReceiveChannelRtpStatisticsCallback(callback); |
| 992 | return 0; |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 +0000 | [diff] [blame] | 993 | } |
| 994 | |
| 995 | int ViERTP_RTCPImpl::DeregisterReceiveChannelRtpStatisticsCallback( |
sprang@webrtc.org | 0e93257 | 2014-01-23 10:00:39 +0000 | [diff] [blame] | 996 | const int video_channel, |
| 997 | StreamDataCountersCallback* callback) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 998 | LOG_F(LS_INFO) << "channel " << video_channel; |
sprang@webrtc.org | 0e93257 | 2014-01-23 10:00:39 +0000 | [diff] [blame] | 999 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 1000 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 1001 | assert(vie_channel != NULL); |
| 1002 | vie_channel->RegisterReceiveChannelRtpStatisticsCallback(NULL); |
| 1003 | return 0; |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 +0000 | [diff] [blame] | 1004 | } |
sprang@webrtc.org | 6811b6e | 2013-12-13 09:46:59 +0000 | [diff] [blame] | 1005 | |
| 1006 | // Called whenever the send bitrate is updated. |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 +0000 | [diff] [blame] | 1007 | int ViERTP_RTCPImpl::RegisterSendBitrateObserver( |
sprang@webrtc.org | 6811b6e | 2013-12-13 09:46:59 +0000 | [diff] [blame] | 1008 | const int video_channel, |
| 1009 | BitrateStatisticsObserver* observer) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 1010 | LOG_F(LS_INFO) << "channel " << video_channel; |
sprang@webrtc.org | 6811b6e | 2013-12-13 09:46:59 +0000 | [diff] [blame] | 1011 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 1012 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 1013 | assert(vie_channel != NULL); |
| 1014 | vie_channel->RegisterSendBitrateObserver(observer); |
| 1015 | return 0; |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 +0000 | [diff] [blame] | 1016 | } |
| 1017 | |
| 1018 | int ViERTP_RTCPImpl::DeregisterSendBitrateObserver( |
sprang@webrtc.org | 6811b6e | 2013-12-13 09:46:59 +0000 | [diff] [blame] | 1019 | const int video_channel, |
| 1020 | BitrateStatisticsObserver* observer) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 1021 | LOG_F(LS_INFO) << "channel " << video_channel; |
sprang@webrtc.org | 6811b6e | 2013-12-13 09:46:59 +0000 | [diff] [blame] | 1022 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 1023 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 1024 | assert(vie_channel != NULL); |
| 1025 | vie_channel->RegisterSendBitrateObserver(NULL); |
| 1026 | return 0; |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 +0000 | [diff] [blame] | 1027 | } |
| 1028 | |
| 1029 | int ViERTP_RTCPImpl::RegisterSendFrameCountObserver( |
sprang@webrtc.org | 71f055f | 2013-12-04 15:09:27 +0000 | [diff] [blame] | 1030 | int video_channel, FrameCountObserver* callback) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 1031 | LOG_F(LS_INFO) << "channel " << video_channel; |
sprang@webrtc.org | 71f055f | 2013-12-04 15:09:27 +0000 | [diff] [blame] | 1032 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 1033 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 1034 | if (!vie_channel) { |
sprang@webrtc.org | 71f055f | 2013-12-04 15:09:27 +0000 | [diff] [blame] | 1035 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 1036 | return -1; |
| 1037 | } |
| 1038 | vie_channel->RegisterSendFrameCountObserver(callback); |
| 1039 | return 0; |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 +0000 | [diff] [blame] | 1040 | } |
| 1041 | |
| 1042 | int ViERTP_RTCPImpl::DeregisterSendFrameCountObserver( |
sprang@webrtc.org | 71f055f | 2013-12-04 15:09:27 +0000 | [diff] [blame] | 1043 | int video_channel, FrameCountObserver* callback) { |
pbos@webrtc.org | 4e2806d | 2014-05-14 08:02:22 +0000 | [diff] [blame^] | 1044 | LOG_F(LS_INFO) << "channel " << video_channel; |
sprang@webrtc.org | 71f055f | 2013-12-04 15:09:27 +0000 | [diff] [blame] | 1045 | ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); |
| 1046 | ViEChannel* vie_channel = cs.Channel(video_channel); |
| 1047 | if (!vie_channel) { |
sprang@webrtc.org | 71f055f | 2013-12-04 15:09:27 +0000 | [diff] [blame] | 1048 | shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); |
| 1049 | return -1; |
| 1050 | } |
| 1051 | vie_channel->RegisterSendFrameCountObserver(NULL); |
| 1052 | return 0; |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 +0000 | [diff] [blame] | 1053 | } |
mflodman@webrtc.org | 8da2417 | 2011-12-19 14:18:41 +0000 | [diff] [blame] | 1054 | } // namespace webrtc |