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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 if (!_codecDataBase.MatchesCurrentResolution(videoFrame.width(), | 341 if (!_codecDataBase.MatchesCurrentResolution(videoFrame.width(), |
342 videoFrame.height())) { | 342 videoFrame.height())) { |
343 LOG(LS_ERROR) << "Incoming frame doesn't match set resolution. Dropping."; | 343 LOG(LS_ERROR) << "Incoming frame doesn't match set resolution. Dropping."; |
344 return VCM_PARAMETER_ERROR; | 344 return VCM_PARAMETER_ERROR; |
345 } | 345 } |
346 VideoFrame converted_frame = videoFrame; | 346 VideoFrame converted_frame = videoFrame; |
347 if (converted_frame.native_handle() && !_encoder->SupportsNativeHandle()) { | 347 if (converted_frame.native_handle() && !_encoder->SupportsNativeHandle()) { |
348 // This module only supports software encoding. | 348 // This module only supports software encoding. |
349 // TODO(pbos): Offload conversion from the encoder thread. | 349 // TODO(pbos): Offload conversion from the encoder thread. |
350 converted_frame = converted_frame.ConvertNativeToI420Frame(); | 350 converted_frame = converted_frame.ConvertNativeToI420Frame(); |
351 CHECK(!converted_frame.IsZeroSize()) | 351 if (converted_frame.IsZeroSize()) |
352 << "Frame conversion failed, won't be able to encode frame."; | 352 return VCM_PARAMETER_ERROR; |
353 } | 353 } |
354 int32_t ret = | 354 int32_t ret = |
355 _encoder->Encode(converted_frame, codecSpecificInfo, _nextFrameTypes); | 355 _encoder->Encode(converted_frame, codecSpecificInfo, _nextFrameTypes); |
356 if (ret < 0) { | 356 if (ret < 0) { |
357 LOG(LS_ERROR) << "Failed to encode frame. Error code: " << ret; | 357 LOG(LS_ERROR) << "Failed to encode frame. Error code: " << ret; |
358 return ret; | 358 return ret; |
359 } | 359 } |
360 for (size_t i = 0; i < _nextFrameTypes.size(); ++i) { | 360 for (size_t i = 0; i < _nextFrameTypes.size(); ++i) { |
361 _nextFrameTypes[i] = kVideoFrameDelta; // Default frame type. | 361 _nextFrameTypes[i] = kVideoFrameDelta; // Default frame type. |
362 } | 362 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 int window_bps = std::max(threshold_bps / 10, 10000); | 402 int window_bps = std::max(threshold_bps / 10, 10000); |
403 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps); | 403 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps); |
404 } | 404 } |
405 | 405 |
406 bool VideoSender::VideoSuspended() const { | 406 bool VideoSender::VideoSuspended() const { |
407 CriticalSectionScoped cs(_sendCritSect); | 407 CriticalSectionScoped cs(_sendCritSect); |
408 return _mediaOpt.IsVideoSuspended(); | 408 return _mediaOpt.IsVideoSuspended(); |
409 } | 409 } |
410 } // namespace vcm | 410 } // namespace vcm |
411 } // namespace webrtc | 411 } // namespace webrtc |
OLD | NEW |