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

Side by Side 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 4 years, 12 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #import "RTCVideoRendererAdapter.h"
12 #import "RTCI420Frame+Private.h"
13
14 namespace webrtc {
15
16 class RTCVideoRendererNativeAdapter : public VideoRendererInterface {
17 public:
18 RTCVideoRendererNativeAdapter(RTCVideoRendererAdapter *adapter) {
19 _adapter = adapter;
20 _size = CGSizeZero;
21 }
22
23 void RenderFrame(const cricket::VideoFrame *videoFrame) override {
24 const cricket::VideoFrame *frame = videoFrame->GetCopyWithRotationApplied();
25 CGSize currentSize = CGSizeMake(frame->GetWidth(), frame->GetHeight());
26 if (!CGSizeEqualToSize(_size, currentSize)) {
27 _size = currentSize;
28 [_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
29 }
30 RTCI420Frame *i420Frame = [[RTCI420Frame alloc] initWithVideoFrame:frame];
31 [_adapter.videoRenderer renderFrame:i420Frame];
32 }
33
34 private:
35 __weak RTCVideoRendererAdapter *_adapter;
36 CGSize _size;
37 };
38 }
39
40 @implementation RTCVideoRendererAdapter {
41 rtc::scoped_ptr<webrtc::RTCVideoRendererNativeAdapter> _adapter;
42 }
43
44 @synthesize videoRenderer = _videoRenderer;
45
46 - (instancetype)initWithVideoRenderer:(id<RTCVideoRenderer>)videoRenderer {
47 NSParameterAssert(videoRenderer);
48 if (self = [super init]) {
49 _videoRenderer = videoRenderer;
50 _adapter.reset(new webrtc::RTCVideoRendererNativeAdapter(self));
51 }
52 return self;
53 }
54
55 - (webrtc::VideoRendererInterface *)nativeVideoRenderer {
56 return _adapter.get();
57 }
58
59 @end
OLDNEW
« 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