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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 if (!_codecDataBase.MatchesCurrentResolution(videoFrame.width(), | 281 if (!_codecDataBase.MatchesCurrentResolution(videoFrame.width(), |
282 videoFrame.height())) { | 282 videoFrame.height())) { |
283 LOG(LS_ERROR) << "Incoming frame doesn't match set resolution. Dropping."; | 283 LOG(LS_ERROR) << "Incoming frame doesn't match set resolution. Dropping."; |
284 return VCM_PARAMETER_ERROR; | 284 return VCM_PARAMETER_ERROR; |
285 } | 285 } |
286 VideoFrame converted_frame = videoFrame; | 286 VideoFrame converted_frame = videoFrame; |
287 if (converted_frame.video_frame_buffer()->native_handle() && | 287 if (converted_frame.video_frame_buffer()->native_handle() && |
288 !_encoder->SupportsNativeHandle()) { | 288 !_encoder->SupportsNativeHandle()) { |
289 // This module only supports software encoding. | 289 // This module only supports software encoding. |
290 // TODO(pbos): Offload conversion from the encoder thread. | 290 // TODO(pbos): Offload conversion from the encoder thread. |
291 converted_frame = converted_frame.ConvertNativeToI420Frame(); | 291 rtc::scoped_refptr<VideoFrameBuffer> converted_buffer( |
292 RTC_CHECK(!converted_frame.IsZeroSize()) | 292 converted_frame.video_frame_buffer()->NativeToI420Buffer()); |
293 << "Frame conversion failed, won't be able to encode frame."; | 293 |
294 if (!converted_buffer) { | |
295 LOG(LS_WARNING) << "Frame conversion failed, dropping frame."; | |
pbos-webrtc
2016/06/16 11:21:43
LS_ERROR
nisse-webrtc
2016/06/16 13:13:07
Done.
| |
296 return VCM_PARAMETER_ERROR; | |
297 } | |
298 converted_frame = VideoFrame(converted_buffer, | |
299 converted_frame.timestamp(), | |
300 converted_frame.render_time_ms(), | |
301 converted_frame.rotation()); | |
294 } | 302 } |
295 int32_t ret = | 303 int32_t ret = |
296 _encoder->Encode(converted_frame, codecSpecificInfo, next_frame_types); | 304 _encoder->Encode(converted_frame, codecSpecificInfo, next_frame_types); |
297 if (ret < 0) { | 305 if (ret < 0) { |
298 LOG(LS_ERROR) << "Failed to encode frame. Error code: " << ret; | 306 LOG(LS_ERROR) << "Failed to encode frame. Error code: " << ret; |
299 return ret; | 307 return ret; |
300 } | 308 } |
301 | 309 |
302 { | 310 { |
303 rtc::CritScope lock(¶ms_crit_); | 311 rtc::CritScope lock(¶ms_crit_); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
363 // 10 kbps. | 371 // 10 kbps. |
364 int window_bps = std::max(threshold_bps / 10, 10000); | 372 int window_bps = std::max(threshold_bps / 10, 10000); |
365 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps); | 373 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps); |
366 } | 374 } |
367 | 375 |
368 bool VideoSender::VideoSuspended() const { | 376 bool VideoSender::VideoSuspended() const { |
369 return _mediaOpt.IsVideoSuspended(); | 377 return _mediaOpt.IsVideoSuspended(); |
370 } | 378 } |
371 } // namespace vcm | 379 } // namespace vcm |
372 } // namespace webrtc | 380 } // namespace webrtc |
OLD | NEW |