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

Side by Side Diff: webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.cc

Issue 1983583002: Revert of Delete webrtc::VideoFrame methods buffer and stride. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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 (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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 return false; 161 return false;
162 } 162 }
163 uint8_t* dst_y = reinterpret_cast<uint8_t*>( 163 uint8_t* dst_y = reinterpret_cast<uint8_t*>(
164 CVPixelBufferGetBaseAddressOfPlane(pixel_buffer, 0)); 164 CVPixelBufferGetBaseAddressOfPlane(pixel_buffer, 0));
165 int dst_stride_y = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer, 0); 165 int dst_stride_y = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer, 0);
166 uint8_t* dst_uv = reinterpret_cast<uint8_t*>( 166 uint8_t* dst_uv = reinterpret_cast<uint8_t*>(
167 CVPixelBufferGetBaseAddressOfPlane(pixel_buffer, 1)); 167 CVPixelBufferGetBaseAddressOfPlane(pixel_buffer, 1));
168 int dst_stride_uv = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer, 1); 168 int dst_stride_uv = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer, 1);
169 // Convert I420 to NV12. 169 // Convert I420 to NV12.
170 int ret = libyuv::I420ToNV12( 170 int ret = libyuv::I420ToNV12(
171 frame.video_frame_buffer()->DataY(), 171 frame.buffer(webrtc::kYPlane), frame.stride(webrtc::kYPlane),
172 frame.video_frame_buffer()->StrideY(), 172 frame.buffer(webrtc::kUPlane), frame.stride(webrtc::kUPlane),
173 frame.video_frame_buffer()->DataU(), 173 frame.buffer(webrtc::kVPlane), frame.stride(webrtc::kVPlane), dst_y,
174 frame.video_frame_buffer()->StrideU(), 174 dst_stride_y, dst_uv, dst_stride_uv, frame.width(), frame.height());
175 frame.video_frame_buffer()->DataV(),
176 frame.video_frame_buffer()->StrideV(),
177 dst_y, dst_stride_y, dst_uv, dst_stride_uv,
178 frame.width(), frame.height());
179 CVPixelBufferUnlockBaseAddress(pixel_buffer, 0); 175 CVPixelBufferUnlockBaseAddress(pixel_buffer, 0);
180 if (ret) { 176 if (ret) {
181 LOG(LS_ERROR) << "Error converting I420 VideoFrame to NV12 :" << ret; 177 LOG(LS_ERROR) << "Error converting I420 VideoFrame to NV12 :" << ret;
182 return false; 178 return false;
183 } 179 }
184 return true; 180 return true;
185 } 181 }
186 182
187 // This is the callback function that VideoToolbox calls when encode is 183 // This is the callback function that VideoToolbox calls when encode is
188 // complete. From inspection this happens on its own queue. 184 // complete. From inspection this happens on its own queue.
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 if (result != 0) { 526 if (result != 0) {
531 LOG(LS_ERROR) << "Encode callback failed: " << result; 527 LOG(LS_ERROR) << "Encode callback failed: " << result;
532 return; 528 return;
533 } 529 }
534 bitrate_adjuster_.Update(frame._size); 530 bitrate_adjuster_.Update(frame._size);
535 } 531 }
536 532
537 } // namespace webrtc 533 } // namespace webrtc
538 534
539 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) 535 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698