Chromium Code Reviews| 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 | |
| 294 RTC_CHECK(converted_buffer) | |
|
perkj_webrtc
2016/06/15 20:43:12
in b/28636240 we are asked to replace this check w
nisse-webrtc
2016/06/16 07:22:28
Not sure what to do instead. For now, log a warnin
| |
| 293 << "Frame conversion failed, won't be able to encode frame."; | 295 << "Frame conversion failed, won't be able to encode frame."; |
| 296 | |
| 297 converted_frame = VideoFrame(converted_buffer, | |
| 298 converted_frame.timestamp(), | |
| 299 converted_frame.render_time_ms(), | |
| 300 converted_frame.rotation()); | |
| 294 } | 301 } |
| 295 int32_t ret = | 302 int32_t ret = |
| 296 _encoder->Encode(converted_frame, codecSpecificInfo, next_frame_types); | 303 _encoder->Encode(converted_frame, codecSpecificInfo, next_frame_types); |
| 297 if (ret < 0) { | 304 if (ret < 0) { |
| 298 LOG(LS_ERROR) << "Failed to encode frame. Error code: " << ret; | 305 LOG(LS_ERROR) << "Failed to encode frame. Error code: " << ret; |
| 299 return ret; | 306 return ret; |
| 300 } | 307 } |
| 301 | 308 |
| 302 { | 309 { |
| 303 rtc::CritScope lock(¶ms_crit_); | 310 rtc::CritScope lock(¶ms_crit_); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 363 // 10 kbps. | 370 // 10 kbps. |
| 364 int window_bps = std::max(threshold_bps / 10, 10000); | 371 int window_bps = std::max(threshold_bps / 10, 10000); |
| 365 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps); | 372 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps); |
| 366 } | 373 } |
| 367 | 374 |
| 368 bool VideoSender::VideoSuspended() const { | 375 bool VideoSender::VideoSuspended() const { |
| 369 return _mediaOpt.IsVideoSuspended(); | 376 return _mediaOpt.IsVideoSuspended(); |
| 370 } | 377 } |
| 371 } // namespace vcm | 378 } // namespace vcm |
| 372 } // namespace webrtc | 379 } // namespace webrtc |
| OLD | NEW |