OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 new rtc::RefCountedObject<webrtc::I420Buffer>(width, height); | 57 new rtc::RefCountedObject<webrtc::I420Buffer>(width, height); |
58 CVPixelBufferLockBaseAddress(pixel_buffer, kCVPixelBufferLock_ReadOnly); | 58 CVPixelBufferLockBaseAddress(pixel_buffer, kCVPixelBufferLock_ReadOnly); |
59 const uint8* src_y = reinterpret_cast<const uint8*>( | 59 const uint8* src_y = reinterpret_cast<const uint8*>( |
60 CVPixelBufferGetBaseAddressOfPlane(pixel_buffer, 0)); | 60 CVPixelBufferGetBaseAddressOfPlane(pixel_buffer, 0)); |
61 int src_y_stride = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer, 0); | 61 int src_y_stride = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer, 0); |
62 const uint8* src_uv = reinterpret_cast<const uint8*>( | 62 const uint8* src_uv = reinterpret_cast<const uint8*>( |
63 CVPixelBufferGetBaseAddressOfPlane(pixel_buffer, 1)); | 63 CVPixelBufferGetBaseAddressOfPlane(pixel_buffer, 1)); |
64 int src_uv_stride = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer, 1); | 64 int src_uv_stride = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer, 1); |
65 int ret = libyuv::NV12ToI420( | 65 int ret = libyuv::NV12ToI420( |
66 src_y, src_y_stride, src_uv, src_uv_stride, | 66 src_y, src_y_stride, src_uv, src_uv_stride, |
67 buffer->data(webrtc::kYPlane), buffer->stride(webrtc::kYPlane), | 67 buffer->MutableData(webrtc::kYPlane), buffer->stride(webrtc::kYPlane), |
68 buffer->data(webrtc::kUPlane), buffer->stride(webrtc::kUPlane), | 68 buffer->MutableData(webrtc::kUPlane), buffer->stride(webrtc::kUPlane), |
69 buffer->data(webrtc::kVPlane), buffer->stride(webrtc::kVPlane), | 69 buffer->MutableData(webrtc::kVPlane), buffer->stride(webrtc::kVPlane), |
70 width, height); | 70 width, height); |
71 CVPixelBufferUnlockBaseAddress(pixel_buffer, kCVPixelBufferLock_ReadOnly); | 71 CVPixelBufferUnlockBaseAddress(pixel_buffer, kCVPixelBufferLock_ReadOnly); |
72 if (ret) { | 72 if (ret) { |
73 LOG(LS_ERROR) << "Error converting NV12 to I420: " << ret; | 73 LOG(LS_ERROR) << "Error converting NV12 to I420: " << ret; |
74 return nullptr; | 74 return nullptr; |
75 } | 75 } |
76 return buffer; | 76 return buffer; |
77 } | 77 } |
78 | 78 |
79 // This is the callback function that VideoToolbox calls when decode is | 79 // This is the callback function that VideoToolbox calls when decode is |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 } | 262 } |
263 video_format_ = video_format; | 263 video_format_ = video_format; |
264 if (video_format_) { | 264 if (video_format_) { |
265 CFRetain(video_format_); | 265 CFRetain(video_format_); |
266 } | 266 } |
267 } | 267 } |
268 | 268 |
269 } // namespace webrtc | 269 } // namespace webrtc |
270 | 270 |
271 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) | 271 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) |
OLD | NEW |