Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(763)

Unified Diff: webrtc/sdk/objc/Framework/Classes/RTCVideoFrame.mm

Issue 2700113003: Add RTCVideoFrame init function from CVPixelBufferRef (Closed)
Patch Set: Rebase, and add '(instancetype)new NS_UNAVAILABLE'. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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:

Powered by Google App Engine
This is Rietveld 408576698