Index: webrtc/sdk/objc/Framework/Classes/RTCVideoFrame.mm |
diff --git a/webrtc/sdk/objc/Framework/Classes/RTCVideoFrame.mm b/webrtc/sdk/objc/Framework/Classes/RTCVideoFrame.mm |
index 0403557f75128996f122cd6b802708ca2f7ec929..ea603b9cce4c4ede5824c25fd8283cd049af2d87 100644 |
--- a/webrtc/sdk/objc/Framework/Classes/RTCVideoFrame.mm |
+++ b/webrtc/sdk/objc/Framework/Classes/RTCVideoFrame.mm |
@@ -10,6 +10,8 @@ |
#import "RTCVideoFrame+Private.h" |
+#include "webrtc/common_video/include/corevideo_frame_buffer.h" |
+ |
@implementation RTCVideoFrame { |
rtc::scoped_refptr<webrtc::VideoFrameBuffer> _videoBuffer; |
RTCVideoRotation _rotation; |
@@ -67,6 +69,36 @@ |
timeStampNs:_timeStampNs]; |
} |
+- (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer |
+ rotation:(RTCVideoRotation)rotation |
+ timeStampNs:(int64_t)timeStampNs { |
+ rtc::scoped_refptr<webrtc::VideoFrameBuffer> videoBuffer( |
+ new rtc::RefCountedObject<webrtc::CoreVideoFrameBuffer>(pixelBuffer)); |
+ return [self initWithVideoBuffer:videoBuffer |
+ rotation:rotation |
+ timeStampNs:timeStampNs]; |
+} |
+ |
+- (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer |
+ scaledWidth:(int)scaledWidth |
+ scaledHeight:(int)scaledHeight |
+ cropWidth:(int)cropWidth |
+ cropHeight:(int)cropHeight |
+ cropX:(int)cropX |
+ cropY:(int)cropY |
+ rotation:(RTCVideoRotation)rotation |
+ timeStampNs:(int64_t)timeStampNs { |
+ rtc::scoped_refptr<webrtc::VideoFrameBuffer> videoBuffer( |
+ new rtc::RefCountedObject<webrtc::CoreVideoFrameBuffer>( |
+ pixelBuffer, |
+ scaledWidth, scaledHeight, |
+ cropWidth, cropHeight, |
+ cropX, cropY)); |
+ return [self initWithVideoBuffer:videoBuffer |
+ rotation:rotation |
+ timeStampNs:timeStampNs]; |
+} |
+ |
#pragma mark - Private |
- (instancetype)initWithVideoBuffer: |