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

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

Issue 2354223002: Revert of Move MutableDataY{,U,V} methods to I420Buffer only. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 3 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 if (_rotateFrame == kVideoRotation_90 || 268 if (_rotateFrame == kVideoRotation_90 ||
269 _rotateFrame == kVideoRotation_270) { 269 _rotateFrame == kVideoRotation_270) {
270 target_width = abs(height); 270 target_width = abs(height);
271 target_height = width; 271 target_height = width;
272 } 272 }
273 } 273 }
274 274
275 // Setting absolute height (in case it was negative). 275 // Setting absolute height (in case it was negative).
276 // In Windows, the image starts bottom left, instead of top left. 276 // In Windows, the image starts bottom left, instead of top left.
277 // Setting a negative source height, inverts the image (within LibYuv). 277 // Setting a negative source height, inverts the image (within LibYuv).
278 278 _captureFrame.CreateEmptyFrame(target_width,
279 // TODO(nisse): Use a pool? 279 abs(target_height),
280 rtc::scoped_refptr<I420Buffer> buffer = I420Buffer::Create( 280 stride_y,
281 target_width, abs(target_height), stride_y, stride_uv, stride_uv); 281 stride_uv, stride_uv);
282 const int conversionResult = ConvertToI420( 282 const int conversionResult = ConvertToI420(
283 commonVideoType, videoFrame, 0, 0, // No cropping 283 commonVideoType, videoFrame, 0, 0, // No cropping
284 width, height, videoFrameLength, 284 width, height, videoFrameLength,
285 apply_rotation ? _rotateFrame : kVideoRotation_0, buffer.get()); 285 apply_rotation ? _rotateFrame : kVideoRotation_0, &_captureFrame);
286 if (conversionResult < 0) 286 if (conversionResult < 0)
287 { 287 {
288 LOG(LS_ERROR) << "Failed to convert capture frame from type " 288 LOG(LS_ERROR) << "Failed to convert capture frame from type "
289 << frameInfo.rawType << "to I420."; 289 << frameInfo.rawType << "to I420.";
290 return -1; 290 return -1;
291 } 291 }
292 292
293 VideoFrame captureFrame( 293 if (!apply_rotation) {
294 buffer, 0, rtc::TimeMillis(), 294 _captureFrame.set_rotation(_rotateFrame);
295 !apply_rotation ? _rotateFrame : kVideoRotation_0); 295 } else {
296 captureFrame.set_ntp_time_ms(captureTime); 296 _captureFrame.set_rotation(kVideoRotation_0);
297 }
298 _captureFrame.set_ntp_time_ms(captureTime);
299 _captureFrame.set_render_time_ms(rtc::TimeMillis());
297 300
298 DeliverCapturedFrame(captureFrame); 301 DeliverCapturedFrame(_captureFrame);
299 } 302 }
300 else // Encoded format 303 else // Encoded format
301 { 304 {
302 assert(false); 305 assert(false);
303 return -1; 306 return -1;
304 } 307 }
305 308
306 return 0; 309 return 0;
307 } 310 }
308 311
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 if (diff > 0) 382 if (diff > 0)
380 { 383 {
381 return uint32_t((nrOfFrames * 1000.0f / diff) + 0.5f); 384 return uint32_t((nrOfFrames * 1000.0f / diff) + 0.5f);
382 } 385 }
383 } 386 }
384 387
385 return nrOfFrames; 388 return nrOfFrames;
386 } 389 }
387 } // namespace videocapturemodule 390 } // namespace videocapturemodule
388 } // namespace webrtc 391 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_capture/video_capture_impl.h ('k') | webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698