| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 target_width = abs(height); | 271 target_width = abs(height); |
| 272 target_height = width; | 272 target_height = width; |
| 273 } | 273 } |
| 274 } | 274 } |
| 275 | 275 |
| 276 // TODO(mikhal): Update correct aligned stride values. | 276 // TODO(mikhal): Update correct aligned stride values. |
| 277 //Calc16ByteAlignedStride(target_width, &stride_y, &stride_uv); | 277 //Calc16ByteAlignedStride(target_width, &stride_y, &stride_uv); |
| 278 // Setting absolute height (in case it was negative). | 278 // Setting absolute height (in case it was negative). |
| 279 // In Windows, the image starts bottom left, instead of top left. | 279 // In Windows, the image starts bottom left, instead of top left. |
| 280 // Setting a negative source height, inverts the image (within LibYuv). | 280 // Setting a negative source height, inverts the image (within LibYuv). |
| 281 int ret = _captureFrame.CreateEmptyFrame(target_width, | 281 _captureFrame.CreateEmptyFrame(target_width, |
| 282 abs(target_height), | 282 abs(target_height), |
| 283 stride_y, | 283 stride_y, |
| 284 stride_uv, stride_uv); | 284 stride_uv, stride_uv); |
| 285 if (ret < 0) | |
| 286 { | |
| 287 LOG(LS_ERROR) << "Failed to create empty frame, this should only " | |
| 288 "happen due to bad parameters."; | |
| 289 return -1; | |
| 290 } | |
| 291 const int conversionResult = ConvertToI420( | 285 const int conversionResult = ConvertToI420( |
| 292 commonVideoType, videoFrame, 0, 0, // No cropping | 286 commonVideoType, videoFrame, 0, 0, // No cropping |
| 293 width, height, videoFrameLength, | 287 width, height, videoFrameLength, |
| 294 apply_rotation ? _rotateFrame : kVideoRotation_0, &_captureFrame); | 288 apply_rotation ? _rotateFrame : kVideoRotation_0, &_captureFrame); |
| 295 if (conversionResult < 0) | 289 if (conversionResult < 0) |
| 296 { | 290 { |
| 297 LOG(LS_ERROR) << "Failed to convert capture frame from type " | 291 LOG(LS_ERROR) << "Failed to convert capture frame from type " |
| 298 << frameInfo.rawType << "to I420."; | 292 << frameInfo.rawType << "to I420."; |
| 299 return -1; | 293 return -1; |
| 300 } | 294 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 if (diff > 0) | 382 if (diff > 0) |
| 389 { | 383 { |
| 390 return uint32_t((nrOfFrames * 1000.0f / diff) + 0.5f); | 384 return uint32_t((nrOfFrames * 1000.0f / diff) + 0.5f); |
| 391 } | 385 } |
| 392 } | 386 } |
| 393 | 387 |
| 394 return nrOfFrames; | 388 return nrOfFrames; |
| 395 } | 389 } |
| 396 } // namespace videocapturemodule | 390 } // namespace videocapturemodule |
| 397 } // namespace webrtc | 391 } // namespace webrtc |
| OLD | NEW |