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

Side by Side Diff: webrtc/api/objc/RTCVideoRendererAdapter.mm

Issue 1817473002: Delete VideoRendererInterface. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 years, 9 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
1 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #import "RTCVideoRendererAdapter.h" 11 #import "RTCVideoRendererAdapter.h"
12 12
13 #import "webrtc/api/objc/RTCVideoFrame+Private.h" 13 #import "webrtc/api/objc/RTCVideoFrame+Private.h"
14 #import "webrtc/api/objc/RTCVideoRendererAdapter+Private.h" 14 #import "webrtc/api/objc/RTCVideoRendererAdapter+Private.h"
15 15
16 namespace webrtc { 16 namespace webrtc {
17 17
18 class VideoRendererAdapter : public VideoRendererInterface { 18 class VideoRendererAdapter
19 : public rtc::VideoSinkInterface<cricket::VideoFrame> {
19 public: 20 public:
20 VideoRendererAdapter(RTCVideoRendererAdapter* adapter) { 21 VideoRendererAdapter(RTCVideoRendererAdapter* adapter) {
21 adapter_ = adapter; 22 adapter_ = adapter;
22 size_ = CGSizeZero; 23 size_ = CGSizeZero;
23 } 24 }
24 25
25 void RenderFrame(const cricket::VideoFrame *nativeVideoFrame) override { 26 void OnFrame(const cricket::VideoFrame& nativeVideoFrame) override {
26 const cricket::VideoFrame *frame = 27 const cricket::VideoFrame *frame =
27 nativeVideoFrame->GetCopyWithRotationApplied(); 28 nativeVideoFrame.GetCopyWithRotationApplied();
28 CGSize current_size = CGSizeMake(frame->GetWidth(), frame->GetHeight()); 29 CGSize current_size = CGSizeMake(frame->GetWidth(), frame->GetHeight());
29 if (!CGSizeEqualToSize(size_, current_size)) { 30 if (!CGSizeEqualToSize(size_, current_size)) {
30 size_ = current_size; 31 size_ = current_size;
31 [adapter_.videoRenderer setSize:size_]; 32 [adapter_.videoRenderer setSize:size_];
32 } 33 }
33 RTCVideoFrame *videoFrame = 34 RTCVideoFrame *videoFrame =
34 [[RTCVideoFrame alloc] initWithNativeFrame:frame]; 35 [[RTCVideoFrame alloc] initWithNativeFrame:frame];
35 [adapter_.videoRenderer renderFrame:videoFrame]; 36 [adapter_.videoRenderer renderFrame:videoFrame];
36 } 37 }
37 38
(...skipping 11 matching lines...) Expand all
49 50
50 - (instancetype)initWithNativeRenderer:(id<RTCVideoRenderer>)videoRenderer { 51 - (instancetype)initWithNativeRenderer:(id<RTCVideoRenderer>)videoRenderer {
51 NSParameterAssert(videoRenderer); 52 NSParameterAssert(videoRenderer);
52 if (self = [super init]) { 53 if (self = [super init]) {
53 _videoRenderer = videoRenderer; 54 _videoRenderer = videoRenderer;
54 _adapter.reset(new webrtc::VideoRendererAdapter(self)); 55 _adapter.reset(new webrtc::VideoRendererAdapter(self));
55 } 56 }
56 return self; 57 return self;
57 } 58 }
58 59
59 - (webrtc::VideoRendererInterface *)nativeVideoRenderer { 60 - (rtc::VideoSinkInterface<cricket::VideoFrame> *)nativeVideoRenderer {
60 return _adapter.get(); 61 return _adapter.get();
61 } 62 }
62 63
63 @end 64 @end
OLDNEW
« 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