Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: webrtc/modules/video_capture/video_capture_impl.cc

Issue 1679323002: Cleanup of webrtc::VideoFrame. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 target_width = abs(height); 273 target_width = abs(height);
274 target_height = width; 274 target_height = width;
275 } 275 }
276 } 276 }
277 277
278 // TODO(mikhal): Update correct aligned stride values. 278 // TODO(mikhal): Update correct aligned stride values.
279 //Calc16ByteAlignedStride(target_width, &stride_y, &stride_uv); 279 //Calc16ByteAlignedStride(target_width, &stride_y, &stride_uv);
280 // Setting absolute height (in case it was negative). 280 // Setting absolute height (in case it was negative).
281 // In Windows, the image starts bottom left, instead of top left. 281 // In Windows, the image starts bottom left, instead of top left.
282 // Setting a negative source height, inverts the image (within LibYuv). 282 // Setting a negative source height, inverts the image (within LibYuv).
283 int ret = _captureFrame.CreateEmptyFrame(target_width, 283 _captureFrame.CreateEmptyFrame(target_width,
284 abs(target_height), 284 abs(target_height),
285 stride_y, 285 stride_y,
286 stride_uv, stride_uv); 286 stride_uv, stride_uv);
287 if (ret < 0)
288 {
289 LOG(LS_ERROR) << "Failed to create empty frame, this should only "
290 "happen due to bad parameters.";
291 return -1;
292 }
293 const int conversionResult = ConvertToI420( 287 const int conversionResult = ConvertToI420(
294 commonVideoType, videoFrame, 0, 0, // No cropping 288 commonVideoType, videoFrame, 0, 0, // No cropping
295 width, height, videoFrameLength, 289 width, height, videoFrameLength,
296 apply_rotation ? _rotateFrame : kVideoRotation_0, &_captureFrame); 290 apply_rotation ? _rotateFrame : kVideoRotation_0, &_captureFrame);
297 if (conversionResult < 0) 291 if (conversionResult < 0)
298 { 292 {
299 LOG(LS_ERROR) << "Failed to convert capture frame from type " 293 LOG(LS_ERROR) << "Failed to convert capture frame from type "
300 << frameInfo.rawType << "to I420."; 294 << frameInfo.rawType << "to I420.";
301 return -1; 295 return -1;
302 } 296 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 if (diff > 0) 384 if (diff > 0)
391 { 385 {
392 return uint32_t((nrOfFrames * 1000.0f / diff) + 0.5f); 386 return uint32_t((nrOfFrames * 1000.0f / diff) + 0.5f);
393 } 387 }
394 } 388 }
395 389
396 return nrOfFrames; 390 return nrOfFrames;
397 } 391 }
398 } // namespace videocapturemodule 392 } // namespace videocapturemodule
399 } // namespace webrtc 393 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698