| 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 _captureFrame.CreateEmptyFrame(target_width, | 281 int ret = _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 } |
| 285 const int conversionResult = ConvertToI420( | 291 const int conversionResult = ConvertToI420( |
| 286 commonVideoType, videoFrame, 0, 0, // No cropping | 292 commonVideoType, videoFrame, 0, 0, // No cropping |
| 287 width, height, videoFrameLength, | 293 width, height, videoFrameLength, |
| 288 apply_rotation ? _rotateFrame : kVideoRotation_0, &_captureFrame); | 294 apply_rotation ? _rotateFrame : kVideoRotation_0, &_captureFrame); |
| 289 if (conversionResult < 0) | 295 if (conversionResult < 0) |
| 290 { | 296 { |
| 291 LOG(LS_ERROR) << "Failed to convert capture frame from type " | 297 LOG(LS_ERROR) << "Failed to convert capture frame from type " |
| 292 << frameInfo.rawType << "to I420."; | 298 << frameInfo.rawType << "to I420."; |
| 293 return -1; | 299 return -1; |
| 294 } | 300 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 if (diff > 0) | 388 if (diff > 0) |
| 383 { | 389 { |
| 384 return uint32_t((nrOfFrames * 1000.0f / diff) + 0.5f); | 390 return uint32_t((nrOfFrames * 1000.0f / diff) + 0.5f); |
| 385 } | 391 } |
| 386 } | 392 } |
| 387 | 393 |
| 388 return nrOfFrames; | 394 return nrOfFrames; |
| 389 } | 395 } |
| 390 } // namespace videocapturemodule | 396 } // namespace videocapturemodule |
| 391 } // namespace webrtc | 397 } // namespace webrtc |
| OLD | NEW |