Allow creation of 420 Buffer using YUV data.
There currently are no Objective-C API's to create a buffer with that data.
This change allows us to create a buffer with yuv data.
Bug: webrtc:9167
Change-Id: I00f1b91b04bbaa013a88137d0f54bef44287c5aa
Reviewed-on: https://webrtc-review.googlesource.com/70563
Reviewed-by: Anders Carlsson <andersc@webrtc.org>
Reviewed-by: Zeke Chin <tkchin@webrtc.org>
Commit-Queue: Peter Slatala <psla@google.com>
Cr-Commit-Position: refs/heads/master@{#22945}
diff --git a/sdk/objc/Framework/Classes/Video/RTCI420Buffer.mm b/sdk/objc/Framework/Classes/Video/RTCI420Buffer.mm
index 65f3d5a..3d0538e 100644
--- a/sdk/objc/Framework/Classes/Video/RTCI420Buffer.mm
+++ b/sdk/objc/Framework/Classes/Video/RTCI420Buffer.mm
@@ -32,6 +32,18 @@
- (instancetype)initWithWidth:(int)width
height:(int)height
+ dataY:(const uint8_t *)dataY
+ dataU:(const uint8_t *)dataU
+ dataV:(const uint8_t *)dataV {
+ if (self = [super init]) {
+ _i420Buffer = webrtc::I420Buffer::Copy(
+ width, height, dataY, width, dataU, (width + 1) / 2, dataV, (width + 1) / 2);
+ }
+ return self;
+}
+
+- (instancetype)initWithWidth:(int)width
+ height:(int)height
strideY:(int)strideY
strideU:(int)strideU
strideV:(int)strideV {