| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 | 86 |
| 87 - (CVPixelBufferRef)nativeHandle { | 87 - (CVPixelBufferRef)nativeHandle { |
| 88 return static_cast<CVPixelBufferRef>(_videoFrame->GetNativeHandle()); | 88 return static_cast<CVPixelBufferRef>(_videoFrame->GetNativeHandle()); |
| 89 } | 89 } |
| 90 | 90 |
| 91 - (void)convertBufferIfNeeded { | 91 - (void)convertBufferIfNeeded { |
| 92 if (!_i420Buffer) { | 92 if (!_i420Buffer) { |
| 93 if (_videoFrame->GetNativeHandle()) { | 93 if (_videoFrame->GetNativeHandle()) { |
| 94 // Convert to I420. | 94 // Convert to I420. |
| 95 _i420Buffer = _videoFrame->GetVideoFrameBuffer()->NativeToI420Buffer(); | 95 _i420Buffer = _videoFrame->video_frame_buffer()->NativeToI420Buffer(); |
| 96 } else { | 96 } else { |
| 97 // Should already be I420. | 97 // Should already be I420. |
| 98 _i420Buffer = _videoFrame->GetVideoFrameBuffer(); | 98 _i420Buffer = _videoFrame->video_frame_buffer(); |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 #pragma mark - Private | 103 #pragma mark - Private |
| 104 | 104 |
| 105 - (instancetype)initWithNativeFrame:(const cricket::VideoFrame *)nativeFrame { | 105 - (instancetype)initWithNativeFrame:(const cricket::VideoFrame *)nativeFrame { |
| 106 if (self = [super init]) { | 106 if (self = [super init]) { |
| 107 // Keep a shallow copy of the video frame. The underlying frame buffer is | 107 // Keep a shallow copy of the video frame. The underlying frame buffer is |
| 108 // not copied. | 108 // not copied. |
| 109 _videoFrame.reset(nativeFrame->Copy()); | 109 _videoFrame.reset(nativeFrame->Copy()); |
| 110 } | 110 } |
| 111 return self; | 111 return self; |
| 112 } | 112 } |
| 113 | 113 |
| 114 - (rtc::scoped_refptr<webrtc::VideoFrameBuffer>)i420Buffer { | 114 - (rtc::scoped_refptr<webrtc::VideoFrameBuffer>)i420Buffer { |
| 115 [self convertBufferIfNeeded]; | 115 [self convertBufferIfNeeded]; |
| 116 return _i420Buffer; | 116 return _i420Buffer; |
| 117 } | 117 } |
| 118 | 118 |
| 119 @end | 119 @end |
| OLD | NEW |