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

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: Update against master Created 4 years, 11 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
« no previous file with comments | « webrtc/api/objc/RTCVideoRendererAdapter.h ('k') | webrtc/api/objc/RTCVideoRendererAdapter+Private.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b01792d1bd462fd32754efa34980384847576330
--- /dev/null
+++ b/webrtc/api/objc/RTCVideoRendererAdapter.mm
@@ -0,0 +1,63 @@
+/*
+ * 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 "webrtc/api/objc/RTCVideoRendererAdapter+Private.h"
tkchin_webrtc 2016/01/20 21:45:22 alphabetical
hjon 2016/01/20 21:48:25 Done.
+#import "webrtc/api/objc/RTCVideoFrame+Private.h"
+
+namespace webrtc {
+
+class VideoRendererAdapter : public VideoRendererInterface {
+ public:
+ VideoRendererAdapter(RTCVideoRendererAdapter *adapter) {
tkchin_webrtc 2016/01/20 21:45:23 RTCVideoRendererAdapter* adapter (C++ rules in C++
hjon 2016/01/20 21:48:25 Done.
+ _adapter = adapter;
+ _size = CGSizeZero;
+ }
+
+ void RenderFrame(const cricket::VideoFrame *nativeVideoFrame) override {
+ const cricket::VideoFrame *frame =
+ nativeVideoFrame->GetCopyWithRotationApplied();
+ CGSize currentSize = CGSizeMake(frame->GetWidth(), frame->GetHeight());
tkchin_webrtc 2016/01/20 21:45:23 current_size
hjon 2016/01/20 21:48:25 Done.
+ if (!CGSizeEqualToSize(_size, currentSize)) {
+ _size = currentSize;
+ [_adapter.videoRenderer setSize:_size];
+ }
+ RTCVideoFrame *videoFrame =
+ [[RTCVideoFrame alloc] initWithNativeFrame:frame];
+ [_adapter.videoRenderer renderFrame:videoFrame];
+ }
+
+ private:
+ __weak RTCVideoRendererAdapter *_adapter;
tkchin_webrtc 2016/01/20 21:45:23 adapter_ size_
hjon 2016/01/20 21:48:25 Done.
+ CGSize _size;
+};
+}
+
+@implementation RTCVideoRendererAdapter {
+ rtc::scoped_ptr<webrtc::VideoRendererAdapter> _adapter;
+}
+
+@synthesize videoRenderer = _videoRenderer;
+
+- (instancetype)initWithNativeRenderer:(id<RTCVideoRenderer>)videoRenderer {
+ NSParameterAssert(videoRenderer);
+ if (self = [super init]) {
+ _videoRenderer = videoRenderer;
+ _adapter.reset(new webrtc::VideoRendererAdapter(self));
+ }
+ return self;
+}
+
+- (webrtc::VideoRendererInterface *)nativeVideoRenderer {
+ return _adapter.get();
+}
+
+@end
« no previous file with comments | « webrtc/api/objc/RTCVideoRendererAdapter.h ('k') | webrtc/api/objc/RTCVideoRendererAdapter+Private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698