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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 RTC_DCHECK(CVPixelBufferGetHeightOfPlane(pixel_buffer, 0) == | 129 RTC_DCHECK(CVPixelBufferGetHeightOfPlane(pixel_buffer, 0) == |
130 static_cast<size_t>(frame.height())); | 130 static_cast<size_t>(frame.height())); |
131 RTC_DCHECK(CVPixelBufferGetWidthOfPlane(pixel_buffer, 0) == | 131 RTC_DCHECK(CVPixelBufferGetWidthOfPlane(pixel_buffer, 0) == |
132 static_cast<size_t>(frame.width())); | 132 static_cast<size_t>(frame.width())); |
133 | 133 |
134 CVReturn cvRet = CVPixelBufferLockBaseAddress(pixel_buffer, 0); | 134 CVReturn cvRet = CVPixelBufferLockBaseAddress(pixel_buffer, 0); |
135 if (cvRet != kCVReturnSuccess) { | 135 if (cvRet != kCVReturnSuccess) { |
136 LOG(LS_ERROR) << "Failed to lock base address: " << cvRet; | 136 LOG(LS_ERROR) << "Failed to lock base address: " << cvRet; |
137 return false; | 137 return false; |
138 } | 138 } |
139 uint8* dst_y = reinterpret_cast<uint8*>( | 139 uint8_t* dst_y = reinterpret_cast<uint8_t*>( |
140 CVPixelBufferGetBaseAddressOfPlane(pixel_buffer, 0)); | 140 CVPixelBufferGetBaseAddressOfPlane(pixel_buffer, 0)); |
141 int dst_stride_y = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer, 0); | 141 int dst_stride_y = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer, 0); |
142 uint8* dst_uv = reinterpret_cast<uint8*>( | 142 uint8_t* dst_uv = reinterpret_cast<uint8_t*>( |
143 CVPixelBufferGetBaseAddressOfPlane(pixel_buffer, 1)); | 143 CVPixelBufferGetBaseAddressOfPlane(pixel_buffer, 1)); |
144 int dst_stride_uv = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer, 1); | 144 int dst_stride_uv = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer, 1); |
145 // Convert I420 to NV12. | 145 // Convert I420 to NV12. |
146 int ret = libyuv::I420ToNV12( | 146 int ret = libyuv::I420ToNV12( |
147 frame.buffer(webrtc::kYPlane), frame.stride(webrtc::kYPlane), | 147 frame.buffer(webrtc::kYPlane), frame.stride(webrtc::kYPlane), |
148 frame.buffer(webrtc::kUPlane), frame.stride(webrtc::kUPlane), | 148 frame.buffer(webrtc::kUPlane), frame.stride(webrtc::kUPlane), |
149 frame.buffer(webrtc::kVPlane), frame.stride(webrtc::kVPlane), | 149 frame.buffer(webrtc::kVPlane), frame.stride(webrtc::kVPlane), |
150 dst_y, dst_stride_y, dst_uv, dst_stride_uv, | 150 dst_y, dst_stride_y, dst_uv, dst_stride_uv, |
151 frame.width(), frame.height()); | 151 frame.width(), frame.height()); |
152 CVPixelBufferUnlockBaseAddress(pixel_buffer, 0); | 152 CVPixelBufferUnlockBaseAddress(pixel_buffer, 0); |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 if (compression_session_) { | 429 if (compression_session_) { |
430 VTCompressionSessionInvalidate(compression_session_); | 430 VTCompressionSessionInvalidate(compression_session_); |
431 CFRelease(compression_session_); | 431 CFRelease(compression_session_); |
432 compression_session_ = nullptr; | 432 compression_session_ = nullptr; |
433 } | 433 } |
434 } | 434 } |
435 | 435 |
436 } // namespace webrtc | 436 } // namespace webrtc |
437 | 437 |
438 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) | 438 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) |
OLD | NEW |