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

Unified Diff: webrtc/api/objc/RTCVideoRendererAdapter.mm

Issue 1533323003: Update/move RTCVideoRendererAdapter to webrtc/api/objc. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@moveRenderers
Patch Set: Created 5 years 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/api/objc/RTCVideoRendererAdapter.mm
diff --git a/webrtc/api/objc/RTCVideoRendererAdapter.mm b/webrtc/api/objc/RTCVideoRendererAdapter.mm
new file mode 100644
index 0000000000000000000000000000000000000000..d0098750f0a0be25de35f5f3a332903561bae790
--- /dev/null
+++ b/webrtc/api/objc/RTCVideoRendererAdapter.mm
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2015 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#import "RTCVideoRendererAdapter.h"
+#import "RTCI420Frame+Private.h"
+
+namespace webrtc {
+
+class RTCVideoRendererNativeAdapter : public VideoRendererInterface {
+ public:
+ RTCVideoRendererNativeAdapter(RTCVideoRendererAdapter *adapter) {
+ _adapter = adapter;
+ _size = CGSizeZero;
+ }
+
+ void RenderFrame(const cricket::VideoFrame *videoFrame) override {
+ const cricket::VideoFrame *frame = videoFrame->GetCopyWithRotationApplied();
+ CGSize currentSize = CGSizeMake(frame->GetWidth(), frame->GetHeight());
+ if (!CGSizeEqualToSize(_size, currentSize)) {
+ _size = currentSize;
+ [_adapter.videoRenderer setSize:_size];
tkchin_webrtc 2016/01/05 21:59:02 Do we need setSize? If C++ impl junked it maybe we
hjon 2016/01/08 01:00:52 Looks like the only thing setSize does in the rend
+ }
+ RTCI420Frame *i420Frame = [[RTCI420Frame alloc] initWithVideoFrame:frame];
+ [_adapter.videoRenderer renderFrame:i420Frame];
+ }
+
+ private:
+ __weak RTCVideoRendererAdapter *_adapter;
+ CGSize _size;
+};
+}
+
+@implementation RTCVideoRendererAdapter {
+ rtc::scoped_ptr<webrtc::RTCVideoRendererNativeAdapter> _adapter;
+}
+
+@synthesize videoRenderer = _videoRenderer;
+
+- (instancetype)initWithVideoRenderer:(id<RTCVideoRenderer>)videoRenderer {
+ NSParameterAssert(videoRenderer);
+ if (self = [super init]) {
+ _videoRenderer = videoRenderer;
+ _adapter.reset(new webrtc::RTCVideoRendererNativeAdapter(self));
+ }
+ return self;
+}
+
+- (webrtc::VideoRendererInterface *)nativeVideoRenderer {
+ return _adapter.get();
+}
+
+@end
« webrtc/api/objc/RTCVideoRendererAdapter.h ('K') | « webrtc/api/objc/RTCVideoRendererAdapter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698