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

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/avfoundationvideocapturer.mm

Issue 2278883002: Move MutableDataY{,U,V} methods to I420Buffer only. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. 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 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 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 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 // TODO(magjed): Avoid converting to I420. 777 // TODO(magjed): Avoid converting to I420.
778 rtc::scoped_refptr<webrtc::I420Buffer> scaled_buffer( 778 rtc::scoped_refptr<webrtc::I420Buffer> scaled_buffer(
779 _buffer_pool.CreateBuffer(adapted_width, adapted_height)); 779 _buffer_pool.CreateBuffer(adapted_width, adapted_height));
780 scaled_buffer->CropAndScaleFrom(buffer->NativeToI420Buffer(), crop_x, 780 scaled_buffer->CropAndScaleFrom(buffer->NativeToI420Buffer(), crop_x,
781 crop_y, crop_width, crop_height); 781 crop_y, crop_width, crop_height);
782 if (!apply_rotation() || rotation == webrtc::kVideoRotation_0) { 782 if (!apply_rotation() || rotation == webrtc::kVideoRotation_0) {
783 buffer = scaled_buffer; 783 buffer = scaled_buffer;
784 } else { 784 } else {
785 // Applying rotation is only supported for legacy reasons and performance 785 // Applying rotation is only supported for legacy reasons and performance
786 // is not critical here. 786 // is not critical here.
787 buffer = (rotation == webrtc::kVideoRotation_180) 787 rtc::scoped_refptr<webrtc::I420Buffer> rotated_buffer(
788 ? I420Buffer::Create(adapted_width, adapted_height) 788 (rotation == webrtc::kVideoRotation_180)
789 : I420Buffer::Create(adapted_height, adapted_width); 789 ? I420Buffer::Create(adapted_width, adapted_height)
790 libyuv::I420Rotate(scaled_buffer->DataY(), scaled_buffer->StrideY(), 790 : I420Buffer::Create(adapted_height, adapted_width));
791 scaled_buffer->DataU(), scaled_buffer->StrideU(), 791 libyuv::I420Rotate(
792 scaled_buffer->DataV(), scaled_buffer->StrideV(), 792 scaled_buffer->DataY(), scaled_buffer->StrideY(),
793 buffer->MutableDataY(), buffer->StrideY(), 793 scaled_buffer->DataU(), scaled_buffer->StrideU(),
794 buffer->MutableDataU(), buffer->StrideU(), 794 scaled_buffer->DataV(), scaled_buffer->StrideV(),
795 buffer->MutableDataV(), buffer->StrideV(), 795 rotated_buffer->MutableDataY(), rotated_buffer->StrideY(),
796 crop_width, crop_height, 796 rotated_buffer->MutableDataU(), rotated_buffer->StrideU(),
797 static_cast<libyuv::RotationMode>(rotation)); 797 rotated_buffer->MutableDataV(), rotated_buffer->StrideV(),
798 crop_width, crop_height,
799 static_cast<libyuv::RotationMode>(rotation));
800 buffer = rotated_buffer;
798 } 801 }
799 } 802 }
800 803
801 OnFrame(cricket::WebRtcVideoFrame(buffer, rotation, 804 OnFrame(cricket::WebRtcVideoFrame(buffer, rotation,
802 translated_camera_time_us, 0), 805 translated_camera_time_us, 0),
803 captured_width, captured_height); 806 captured_width, captured_height);
804 807
805 CVBufferRelease(image_buffer); 808 CVBufferRelease(image_buffer);
806 } 809 }
807 810
808 } // namespace webrtc 811 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698