OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 return _codecDataBase.SendCodec(currentSendCodec) ? 0 : -1; | 150 return _codecDataBase.SendCodec(currentSendCodec) ? 0 : -1; |
151 } | 151 } |
152 | 152 |
153 VideoCodecType VideoSender::SendCodecBlocking() const { | 153 VideoCodecType VideoSender::SendCodecBlocking() const { |
154 rtc::CritScope lock(&send_crit_); | 154 rtc::CritScope lock(&send_crit_); |
155 return _codecDataBase.SendCodec(); | 155 return _codecDataBase.SendCodec(); |
156 } | 156 } |
157 | 157 |
158 // Register an external decoder object. | 158 // Register an external decoder object. |
159 // This can not be used together with external decoder callbacks. | 159 // This can not be used together with external decoder callbacks. |
160 int32_t VideoSender::RegisterExternalEncoder(VideoEncoder* externalEncoder, | 160 void VideoSender::RegisterExternalEncoder(VideoEncoder* externalEncoder, |
161 uint8_t payloadType, | 161 uint8_t payloadType, |
162 bool internalSource /*= false*/) { | 162 bool internalSource /*= false*/) { |
163 RTC_DCHECK(main_thread_.CalledOnValidThread()); | 163 RTC_DCHECK(main_thread_.CalledOnValidThread()); |
164 | 164 |
165 rtc::CritScope lock(&send_crit_); | 165 rtc::CritScope lock(&send_crit_); |
166 | 166 |
167 if (externalEncoder == nullptr) { | 167 if (externalEncoder == nullptr) { |
168 bool wasSendCodec = false; | 168 bool wasSendCodec = false; |
169 const bool ret = | 169 RTC_CHECK( |
170 _codecDataBase.DeregisterExternalEncoder(payloadType, &wasSendCodec); | 170 _codecDataBase.DeregisterExternalEncoder(payloadType, &wasSendCodec)); |
171 if (wasSendCodec) { | 171 if (wasSendCodec) { |
172 // Make sure the VCM doesn't use the de-registered codec | 172 // Make sure the VCM doesn't use the de-registered codec |
173 _encoder = nullptr; | 173 _encoder = nullptr; |
174 } | 174 } |
175 return ret ? 0 : -1; | 175 return; |
176 } | 176 } |
177 _codecDataBase.RegisterExternalEncoder( | 177 _codecDataBase.RegisterExternalEncoder( |
178 externalEncoder, payloadType, internalSource); | 178 externalEncoder, payloadType, internalSource); |
179 return 0; | |
180 } | 179 } |
181 | 180 |
182 // Get encode bitrate | 181 // Get encode bitrate |
183 int VideoSender::Bitrate(unsigned int* bitrate) const { | 182 int VideoSender::Bitrate(unsigned int* bitrate) const { |
184 RTC_DCHECK(main_thread_.CalledOnValidThread()); | 183 RTC_DCHECK(main_thread_.CalledOnValidThread()); |
185 // Since we're running on the thread that's the only thread known to modify | 184 // Since we're running on the thread that's the only thread known to modify |
186 // the value of _encoder, we don't need to grab the lock here. | 185 // the value of _encoder, we don't need to grab the lock here. |
187 | 186 |
188 if (!_encoder) | 187 if (!_encoder) |
189 return VCM_UNINITIALIZED; | 188 return VCM_UNINITIALIZED; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 // 10 kbps. | 365 // 10 kbps. |
367 int window_bps = std::max(threshold_bps / 10, 10000); | 366 int window_bps = std::max(threshold_bps / 10, 10000); |
368 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps); | 367 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps); |
369 } | 368 } |
370 | 369 |
371 bool VideoSender::VideoSuspended() const { | 370 bool VideoSender::VideoSuspended() const { |
372 return _mediaOpt.IsVideoSuspended(); | 371 return _mediaOpt.IsVideoSuspended(); |
373 } | 372 } |
374 } // namespace vcm | 373 } // namespace vcm |
375 } // namespace webrtc | 374 } // namespace webrtc |
OLD | NEW |