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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 { | 125 { |
126 rtc::CritScope cs(¶ms_crit_); | 126 rtc::CritScope cs(¶ms_crit_); |
127 next_frame_types_.clear(); | 127 next_frame_types_.clear(); |
128 next_frame_types_.resize(VCM_MAX(sendCodec->numberOfSimulcastStreams, 1), | 128 next_frame_types_.resize(VCM_MAX(sendCodec->numberOfSimulcastStreams, 1), |
129 kVideoFrameKey); | 129 kVideoFrameKey); |
130 // Cache InternalSource() to have this available from IntraFrameRequest() | 130 // Cache InternalSource() to have this available from IntraFrameRequest() |
131 // without having to acquire encoder_crit_ (avoid blocking on encoder use). | 131 // without having to acquire encoder_crit_ (avoid blocking on encoder use). |
132 encoder_has_internal_source_ = _encoder->InternalSource(); | 132 encoder_has_internal_source_ = _encoder->InternalSource(); |
133 } | 133 } |
134 | 134 |
| 135 LOG(LS_VERBOSE) << " max bitrate " << sendCodec->maxBitrate |
| 136 << " start bitrate " << sendCodec->startBitrate |
| 137 << " max frame rate " << sendCodec->maxFramerate |
| 138 << " max payload size " << maxPayloadSize; |
135 _mediaOpt.SetEncodingData(sendCodec->codecType, sendCodec->maxBitrate * 1000, | 139 _mediaOpt.SetEncodingData(sendCodec->codecType, sendCodec->maxBitrate * 1000, |
136 sendCodec->startBitrate * 1000, sendCodec->width, | 140 sendCodec->startBitrate * 1000, sendCodec->width, |
137 sendCodec->height, sendCodec->maxFramerate, | 141 sendCodec->height, sendCodec->maxFramerate, |
138 numLayers, maxPayloadSize); | 142 numLayers, maxPayloadSize); |
139 return VCM_OK; | 143 return VCM_OK; |
140 } | 144 } |
141 | 145 |
142 // Register an external decoder object. | 146 // Register an external decoder object. |
143 // This can not be used together with external decoder callbacks. | 147 // This can not be used together with external decoder callbacks. |
144 void VideoSender::RegisterExternalEncoder(VideoEncoder* externalEncoder, | 148 void VideoSender::RegisterExternalEncoder(VideoEncoder* externalEncoder, |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 { | 276 { |
273 rtc::CritScope lock(¶ms_crit_); | 277 rtc::CritScope lock(¶ms_crit_); |
274 encoder_params = encoder_params_; | 278 encoder_params = encoder_params_; |
275 next_frame_types = next_frame_types_; | 279 next_frame_types = next_frame_types_; |
276 } | 280 } |
277 rtc::CritScope lock(&encoder_crit_); | 281 rtc::CritScope lock(&encoder_crit_); |
278 if (_encoder == nullptr) | 282 if (_encoder == nullptr) |
279 return VCM_UNINITIALIZED; | 283 return VCM_UNINITIALIZED; |
280 SetEncoderParameters(encoder_params); | 284 SetEncoderParameters(encoder_params); |
281 if (_mediaOpt.DropFrame()) { | 285 if (_mediaOpt.DropFrame()) { |
| 286 LOG(LS_VERBOSE) << "Drop Frame " |
| 287 << "target bitrate " << encoder_params.target_bitrate |
| 288 << " loss rate " << encoder_params.loss_rate << " rtt " |
| 289 << encoder_params.rtt << " input frame rate " |
| 290 << encoder_params.input_frame_rate; |
282 _encoder->OnDroppedFrame(); | 291 _encoder->OnDroppedFrame(); |
283 return VCM_OK; | 292 return VCM_OK; |
284 } | 293 } |
285 _mediaOpt.UpdateContentData(contentMetrics); | 294 _mediaOpt.UpdateContentData(contentMetrics); |
286 // TODO(pbos): Make sure setting send codec is synchronized with video | 295 // TODO(pbos): Make sure setting send codec is synchronized with video |
287 // processing so frame size always matches. | 296 // processing so frame size always matches. |
288 if (!_codecDataBase.MatchesCurrentResolution(videoFrame.width(), | 297 if (!_codecDataBase.MatchesCurrentResolution(videoFrame.width(), |
289 videoFrame.height())) { | 298 videoFrame.height())) { |
290 LOG(LS_ERROR) << "Incoming frame doesn't match set resolution. Dropping."; | 299 LOG(LS_ERROR) << "Incoming frame doesn't match set resolution. Dropping."; |
291 return VCM_PARAMETER_ERROR; | 300 return VCM_PARAMETER_ERROR; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 // 10 kbps. | 378 // 10 kbps. |
370 int window_bps = std::max(threshold_bps / 10, 10000); | 379 int window_bps = std::max(threshold_bps / 10, 10000); |
371 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps); | 380 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps); |
372 } | 381 } |
373 | 382 |
374 bool VideoSender::VideoSuspended() const { | 383 bool VideoSender::VideoSuspended() const { |
375 return _mediaOpt.IsVideoSuspended(); | 384 return _mediaOpt.IsVideoSuspended(); |
376 } | 385 } |
377 } // namespace vcm | 386 } // namespace vcm |
378 } // namespace webrtc | 387 } // namespace webrtc |
OLD | NEW |