| Index: webrtc/modules/video_capture/video_capture_impl.cc
|
| diff --git a/webrtc/modules/video_capture/video_capture_impl.cc b/webrtc/modules/video_capture/video_capture_impl.cc
|
| index 6b50205c320b77d6baffdb72a172cb1526e6eb05..ead2b1568a52e9a1dec8d8d346710a2fa6b71b25 100644
|
| --- a/webrtc/modules/video_capture/video_capture_impl.cc
|
| +++ b/webrtc/modules/video_capture/video_capture_impl.cc
|
| @@ -93,7 +93,6 @@ VideoCaptureImpl::VideoCaptureImpl()
|
| _requestedCapability.height = kDefaultHeight;
|
| _requestedCapability.maxFPS = 30;
|
| _requestedCapability.rawType = kVideoI420;
|
| - _requestedCapability.codecType = kVideoCodecUnknown;
|
| memset(_incomingFrameTimesNanos, 0, sizeof(_incomingFrameTimesNanos));
|
| }
|
|
|
| @@ -139,68 +138,60 @@ int32_t VideoCaptureImpl::IncomingFrame(
|
|
|
| TRACE_EVENT1("webrtc", "VC::IncomingFrame", "capture_time", captureTime);
|
|
|
| - if (frameInfo.codecType == kVideoCodecUnknown)
|
| - {
|
| - // Not encoded, convert to I420.
|
| - const VideoType commonVideoType =
|
| - RawVideoTypeToCommonVideoVideoType(frameInfo.rawType);
|
| -
|
| - if (frameInfo.rawType != kVideoMJPEG &&
|
| - CalcBufferSize(commonVideoType, width,
|
| - abs(height)) != videoFrameLength)
|
| - {
|
| - LOG(LS_ERROR) << "Wrong incoming frame length.";
|
| - return -1;
|
| - }
|
| + // Not encoded, convert to I420.
|
| + const VideoType commonVideoType =
|
| + RawVideoTypeToCommonVideoVideoType(frameInfo.rawType);
|
|
|
| - int stride_y = width;
|
| - int stride_uv = (width + 1) / 2;
|
| - int target_width = width;
|
| - int target_height = height;
|
| -
|
| - // SetApplyRotation doesn't take any lock. Make a local copy here.
|
| - bool apply_rotation = apply_rotation_;
|
| -
|
| - if (apply_rotation) {
|
| - // Rotating resolution when for 90/270 degree rotations.
|
| - if (_rotateFrame == kVideoRotation_90 ||
|
| - _rotateFrame == kVideoRotation_270) {
|
| - target_width = abs(height);
|
| - target_height = width;
|
| - }
|
| - }
|
| -
|
| - // Setting absolute height (in case it was negative).
|
| - // In Windows, the image starts bottom left, instead of top left.
|
| - // Setting a negative source height, inverts the image (within LibYuv).
|
| -
|
| - // TODO(nisse): Use a pool?
|
| - rtc::scoped_refptr<I420Buffer> buffer = I420Buffer::Create(
|
| - target_width, abs(target_height), stride_y, stride_uv, stride_uv);
|
| - const int conversionResult = ConvertToI420(
|
| - commonVideoType, videoFrame, 0, 0, // No cropping
|
| - width, height, videoFrameLength,
|
| - apply_rotation ? _rotateFrame : kVideoRotation_0, buffer.get());
|
| - if (conversionResult < 0)
|
| - {
|
| - LOG(LS_ERROR) << "Failed to convert capture frame from type "
|
| - << frameInfo.rawType << "to I420.";
|
| - return -1;
|
| - }
|
| -
|
| - VideoFrame captureFrame(
|
| - buffer, 0, rtc::TimeMillis(),
|
| - !apply_rotation ? _rotateFrame : kVideoRotation_0);
|
| - captureFrame.set_ntp_time_ms(captureTime);
|
| + if (frameInfo.rawType != kVideoMJPEG &&
|
| + CalcBufferSize(commonVideoType, width,
|
| + abs(height)) != videoFrameLength)
|
| + {
|
| + LOG(LS_ERROR) << "Wrong incoming frame length.";
|
| + return -1;
|
| + }
|
|
|
| - DeliverCapturedFrame(captureFrame);
|
| + int stride_y = width;
|
| + int stride_uv = (width + 1) / 2;
|
| + int target_width = width;
|
| + int target_height = height;
|
| +
|
| + // SetApplyRotation doesn't take any lock. Make a local copy here.
|
| + bool apply_rotation = apply_rotation_;
|
| +
|
| + if (apply_rotation) {
|
| + // Rotating resolution when for 90/270 degree rotations.
|
| + if (_rotateFrame == kVideoRotation_90 ||
|
| + _rotateFrame == kVideoRotation_270) {
|
| + target_width = abs(height);
|
| + target_height = width;
|
| + }
|
| }
|
| - else // Encoded format
|
| +
|
| + // Setting absolute height (in case it was negative).
|
| + // In Windows, the image starts bottom left, instead of top left.
|
| + // Setting a negative source height, inverts the image (within LibYuv).
|
| +
|
| + // TODO(nisse): Use a pool?
|
| + rtc::scoped_refptr<I420Buffer> buffer = I420Buffer::Create(
|
| + target_width, abs(target_height), stride_y, stride_uv, stride_uv);
|
| + const int conversionResult = ConvertToI420(
|
| + commonVideoType, videoFrame, 0, 0, // No cropping
|
| + width, height, videoFrameLength,
|
| + apply_rotation ? _rotateFrame : kVideoRotation_0, buffer.get());
|
| + if (conversionResult < 0)
|
| {
|
| - assert(false);
|
| + LOG(LS_ERROR) << "Failed to convert capture frame from type "
|
| + << frameInfo.rawType << "to I420.";
|
| return -1;
|
| }
|
|
|
| + VideoFrame captureFrame(
|
| + buffer, 0, rtc::TimeMillis(),
|
| + !apply_rotation ? _rotateFrame : kVideoRotation_0);
|
| + captureFrame.set_ntp_time_ms(captureTime);
|
| +
|
| + DeliverCapturedFrame(captureFrame);
|
| +
|
| return 0;
|
| }
|
|
|
|
|