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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 return false; | 154 return false; |
155 } | 155 } |
156 uint8_t* dst_y = reinterpret_cast<uint8_t*>( | 156 uint8_t* dst_y = reinterpret_cast<uint8_t*>( |
157 CVPixelBufferGetBaseAddressOfPlane(pixel_buffer, 0)); | 157 CVPixelBufferGetBaseAddressOfPlane(pixel_buffer, 0)); |
158 int dst_stride_y = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer, 0); | 158 int dst_stride_y = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer, 0); |
159 uint8_t* dst_uv = reinterpret_cast<uint8_t*>( | 159 uint8_t* dst_uv = reinterpret_cast<uint8_t*>( |
160 CVPixelBufferGetBaseAddressOfPlane(pixel_buffer, 1)); | 160 CVPixelBufferGetBaseAddressOfPlane(pixel_buffer, 1)); |
161 int dst_stride_uv = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer, 1); | 161 int dst_stride_uv = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer, 1); |
162 // Convert I420 to NV12. | 162 // Convert I420 to NV12. |
163 int ret = libyuv::I420ToNV12( | 163 int ret = libyuv::I420ToNV12( |
164 frame.buffer(webrtc::kYPlane), frame.stride(webrtc::kYPlane), | 164 frame.video_frame_buffer()->DataY(), |
165 frame.buffer(webrtc::kUPlane), frame.stride(webrtc::kUPlane), | 165 frame.video_frame_buffer()->StrideY(), |
166 frame.buffer(webrtc::kVPlane), frame.stride(webrtc::kVPlane), dst_y, | 166 frame.video_frame_buffer()->DataU(), |
167 dst_stride_y, dst_uv, dst_stride_uv, frame.width(), frame.height()); | 167 frame.video_frame_buffer()->StrideU(), |
| 168 frame.video_frame_buffer()->DataV(), |
| 169 frame.video_frame_buffer()->StrideV(), |
| 170 dst_y, dst_stride_y, dst_uv, dst_stride_uv, |
| 171 frame.width(), frame.height()); |
168 CVPixelBufferUnlockBaseAddress(pixel_buffer, 0); | 172 CVPixelBufferUnlockBaseAddress(pixel_buffer, 0); |
169 if (ret) { | 173 if (ret) { |
170 LOG(LS_ERROR) << "Error converting I420 VideoFrame to NV12 :" << ret; | 174 LOG(LS_ERROR) << "Error converting I420 VideoFrame to NV12 :" << ret; |
171 return false; | 175 return false; |
172 } | 176 } |
173 return true; | 177 return true; |
174 } | 178 } |
175 | 179 |
176 // This is the callback function that VideoToolbox calls when encode is | 180 // This is the callback function that VideoToolbox calls when encode is |
177 // complete. From inspection this happens on its own queue. | 181 // complete. From inspection this happens on its own queue. |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 if (result != 0) { | 520 if (result != 0) { |
517 LOG(LS_ERROR) << "Encode callback failed: " << result; | 521 LOG(LS_ERROR) << "Encode callback failed: " << result; |
518 return; | 522 return; |
519 } | 523 } |
520 bitrate_adjuster_.Update(frame._size); | 524 bitrate_adjuster_.Update(frame._size); |
521 } | 525 } |
522 | 526 |
523 } // namespace webrtc | 527 } // namespace webrtc |
524 | 528 |
525 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) | 529 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) |
OLD | NEW |