Add RTCVideoFrame init function from CVPixelBufferRef

Adds a public init function in RTCVideoFrame that makes it possible to
create a frame from a CVPixelBufferRef.

BUG=webrtc:7177
NOTRY=True

Review-Url: https://codereview.webrtc.org/2700113003
Cr-Commit-Position: refs/heads/master@{#16746}
diff --git a/webrtc/sdk/objc/Framework/Classes/RTCVideoFrame.mm b/webrtc/sdk/objc/Framework/Classes/RTCVideoFrame.mm
index 0403557..ea603b9 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: