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 |
11 #import "RTCVideoFrame+Private.h" | 11 #import "RTCVideoFrame+Private.h" |
12 | 12 |
13 #include <memory> | 13 #include <memory> |
14 | 14 |
| 15 #include "webrtc/media/engine/webrtcvideoframe.h" |
| 16 |
15 @implementation RTCVideoFrame { | 17 @implementation RTCVideoFrame { |
16 std::unique_ptr<cricket::VideoFrame> _videoFrame; | 18 std::unique_ptr<cricket::VideoFrame> _videoFrame; |
17 rtc::scoped_refptr<webrtc::VideoFrameBuffer> _i420Buffer; | 19 rtc::scoped_refptr<webrtc::VideoFrameBuffer> _i420Buffer; |
18 } | 20 } |
19 | 21 |
20 - (size_t)width { | 22 - (size_t)width { |
21 return _videoFrame->width(); | 23 return _videoFrame->width(); |
22 } | 24 } |
23 | 25 |
24 - (size_t)height { | 26 - (size_t)height { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 100 } |
99 } | 101 } |
100 } | 102 } |
101 | 103 |
102 #pragma mark - Private | 104 #pragma mark - Private |
103 | 105 |
104 - (instancetype)initWithNativeFrame:(const cricket::VideoFrame *)nativeFrame { | 106 - (instancetype)initWithNativeFrame:(const cricket::VideoFrame *)nativeFrame { |
105 if (self = [super init]) { | 107 if (self = [super init]) { |
106 // Keep a shallow copy of the video frame. The underlying frame buffer is | 108 // Keep a shallow copy of the video frame. The underlying frame buffer is |
107 // not copied. | 109 // not copied. |
108 _videoFrame.reset(nativeFrame->Copy()); | 110 _videoFrame.reset(new cricket::WebRtcVideoFrame( |
| 111 nativeFrame->video_frame_buffer(), |
| 112 nativeFrame->rotation(), |
| 113 nativeFrame->timestamp_us())); |
109 } | 114 } |
110 return self; | 115 return self; |
111 } | 116 } |
112 | 117 |
113 - (rtc::scoped_refptr<webrtc::VideoFrameBuffer>)i420Buffer { | 118 - (rtc::scoped_refptr<webrtc::VideoFrameBuffer>)i420Buffer { |
114 [self convertBufferIfNeeded]; | 119 [self convertBufferIfNeeded]; |
115 return _i420Buffer; | 120 return _i420Buffer; |
116 } | 121 } |
117 | 122 |
118 @end | 123 @end |
OLD | NEW |