Revert "Update webrtc/sdk/objc to new VideoFrameBuffer interface"

This reverts commit b008b45f1e609556a04c1aabb4e8ed6a894265af.

Reason for revert: Breaks external clients.

Original change's description:
> Update webrtc/sdk/objc to new VideoFrameBuffer interface
> 
> More thorough refactoring work is planned for RTCVideoFrame (see webrtc:7785), and this CL just unblocks removing the old interface from webrtc::VideoFrameBuffer.
> 
> Bug: webrtc:7632,webrtc:7785
> Change-Id: I351536c5ca454c2acd8944bbc2ebb1d1439dc50c
> Reviewed-on: https://chromium-review.googlesource.com/530231
> Reviewed-by: Anders Carlsson <andersc@webrtc.org>
> Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#18553}

TBR=magjed@webrtc.org,andersc@webrtc.org
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:7632,webrtc:7785

Change-Id: Ib5c6fcb939175c67c3ac7b3df7cea0f7c2bb0af0
Reviewed-on: https://chromium-review.googlesource.com/533013
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#18557}
This commit is contained in:
Magnus Jedvert
2017-06-13 09:14:36 +00:00
committed by Commit Bot
parent 1edbda09d4
commit 5b383c0ebd
4 changed files with 35 additions and 58 deletions

View File

@ -155,8 +155,9 @@ struct FrameEncodeParams {
// We receive I420Frames as input, but we need to feed CVPixelBuffers into the
// encoder. This performs the copy and format conversion.
// TODO(tkchin): See if encoder will accept i420 frames and compare performance.
bool CopyVideoFrameToPixelBuffer(const rtc::scoped_refptr<webrtc::I420BufferInterface>& frame,
CVPixelBufferRef pixel_buffer) {
bool CopyVideoFrameToPixelBuffer(
const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& frame,
CVPixelBufferRef pixel_buffer) {
RTC_DCHECK(pixel_buffer);
RTC_DCHECK_EQ(CVPixelBufferGetPixelFormatType(pixel_buffer),
kCVPixelFormatType_420YpCbCr8BiPlanarFullRange);
@ -411,12 +412,13 @@ int H264VideoToolboxEncoder::Encode(
}
#endif
CVPixelBufferRef pixel_buffer;
if (frame.video_frame_buffer()->type() == VideoFrameBuffer::Type::kNative) {
CVPixelBufferRef pixel_buffer = static_cast<CVPixelBufferRef>(
frame.video_frame_buffer()->native_handle());
if (pixel_buffer) {
// Native frame.
rtc::scoped_refptr<CoreVideoFrameBuffer> core_video_frame_buffer(
static_cast<CoreVideoFrameBuffer*>(frame.video_frame_buffer().get()));
if (!core_video_frame_buffer->RequiresCropping()) {
pixel_buffer = core_video_frame_buffer->pixel_buffer();
// This pixel buffer might have a higher resolution than what the
// compression session is configured to. The compression session can
// handle that and will output encoded frames in the configured
@ -439,7 +441,7 @@ int H264VideoToolboxEncoder::Encode(
return WEBRTC_VIDEO_CODEC_ERROR;
}
RTC_DCHECK(pixel_buffer);
if (!internal::CopyVideoFrameToPixelBuffer(frame.video_frame_buffer()->ToI420(),
if (!internal::CopyVideoFrameToPixelBuffer(frame.video_frame_buffer(),
pixel_buffer)) {
LOG(LS_ERROR) << "Failed to copy frame data.";
CVBufferRelease(pixel_buffer);