OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2016 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 28 matching lines...) Expand all Loading... |
39 new rtc::RefCountedObject<webrtc::I420Buffer>(width, height); | 39 new rtc::RefCountedObject<webrtc::I420Buffer>(width, height); |
40 CVPixelBufferLockBaseAddress(pixel_buffer_, kCVPixelBufferLock_ReadOnly); | 40 CVPixelBufferLockBaseAddress(pixel_buffer_, kCVPixelBufferLock_ReadOnly); |
41 const uint8_t* src_y = static_cast<const uint8_t*>( | 41 const uint8_t* src_y = static_cast<const uint8_t*>( |
42 CVPixelBufferGetBaseAddressOfPlane(pixel_buffer_, 0)); | 42 CVPixelBufferGetBaseAddressOfPlane(pixel_buffer_, 0)); |
43 int src_y_stride = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer_, 0); | 43 int src_y_stride = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer_, 0); |
44 const uint8_t* src_uv = static_cast<const uint8_t*>( | 44 const uint8_t* src_uv = static_cast<const uint8_t*>( |
45 CVPixelBufferGetBaseAddressOfPlane(pixel_buffer_, 1)); | 45 CVPixelBufferGetBaseAddressOfPlane(pixel_buffer_, 1)); |
46 int src_uv_stride = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer_, 1); | 46 int src_uv_stride = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer_, 1); |
47 int ret = libyuv::NV12ToI420( | 47 int ret = libyuv::NV12ToI420( |
48 src_y, src_y_stride, src_uv, src_uv_stride, | 48 src_y, src_y_stride, src_uv, src_uv_stride, |
49 buffer->MutableDataY(), buffer->StrideY(), | 49 buffer->MutableData(webrtc::kYPlane), buffer->stride(webrtc::kYPlane), |
50 buffer->MutableDataU(), buffer->StrideU(), | 50 buffer->MutableData(webrtc::kUPlane), buffer->stride(webrtc::kUPlane), |
51 buffer->MutableDataV(), buffer->StrideV(), | 51 buffer->MutableData(webrtc::kVPlane), buffer->stride(webrtc::kVPlane), |
52 width, height); | 52 width, height); |
53 CVPixelBufferUnlockBaseAddress(pixel_buffer_, kCVPixelBufferLock_ReadOnly); | 53 CVPixelBufferUnlockBaseAddress(pixel_buffer_, kCVPixelBufferLock_ReadOnly); |
54 if (ret) { | 54 if (ret) { |
55 LOG(LS_ERROR) << "Error converting NV12 to I420: " << ret; | 55 LOG(LS_ERROR) << "Error converting NV12 to I420: " << ret; |
56 return nullptr; | 56 return nullptr; |
57 } | 57 } |
58 return buffer; | 58 return buffer; |
59 } | 59 } |
60 | 60 |
61 } // namespace webrtc | 61 } // namespace webrtc |
OLD | NEW |