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

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/RTCVideoRendererAdapter.mm

Issue 2487633002: Reland of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (Closed)
Patch Set: Rebase, and update rtcstatscollector_unittest.cc. Created 4 years, 1 month 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+Private.h" 11 #import "RTCVideoRendererAdapter+Private.h"
12 12
13 #import "RTCVideoFrame+Private.h" 13 #import "RTCVideoFrame+Private.h"
14 14
15 #include <memory> 15 #include <memory>
16 16
17 #include "webrtc/media/engine/webrtcvideoframe.h"
18
19 namespace webrtc { 17 namespace webrtc {
20 18
21 class VideoRendererAdapter 19 class VideoRendererAdapter
22 : public rtc::VideoSinkInterface<cricket::VideoFrame> { 20 : public rtc::VideoSinkInterface<webrtc::VideoFrame> {
23 public: 21 public:
24 VideoRendererAdapter(RTCVideoRendererAdapter* adapter) { 22 VideoRendererAdapter(RTCVideoRendererAdapter* adapter) {
25 adapter_ = adapter; 23 adapter_ = adapter;
26 size_ = CGSizeZero; 24 size_ = CGSizeZero;
27 } 25 }
28 26
29 void OnFrame(const cricket::VideoFrame& nativeVideoFrame) override { 27 void OnFrame(const webrtc::VideoFrame& nativeVideoFrame) override {
30 RTCVideoFrame* videoFrame = [[RTCVideoFrame alloc] 28 RTCVideoFrame* videoFrame = [[RTCVideoFrame alloc]
31 initWithVideoBuffer:nativeVideoFrame.video_frame_buffer() 29 initWithVideoBuffer:nativeVideoFrame.video_frame_buffer()
32 rotation:nativeVideoFrame.rotation() 30 rotation:nativeVideoFrame.rotation()
33 timeStampNs:nativeVideoFrame.timestamp_us() * 31 timeStampNs:nativeVideoFrame.timestamp_us() *
34 rtc::kNumNanosecsPerMicrosec]; 32 rtc::kNumNanosecsPerMicrosec];
35 CGSize current_size = (videoFrame.rotation % 180 == 0) 33 CGSize current_size = (videoFrame.rotation % 180 == 0)
36 ? CGSizeMake(videoFrame.width, videoFrame.height) 34 ? CGSizeMake(videoFrame.width, videoFrame.height)
37 : CGSizeMake(videoFrame.height, videoFrame.width); 35 : CGSizeMake(videoFrame.height, videoFrame.width);
38 36
39 if (!CGSizeEqualToSize(size_, current_size)) { 37 if (!CGSizeEqualToSize(size_, current_size)) {
(...skipping 17 matching lines...) Expand all
57 55
58 - (instancetype)initWithNativeRenderer:(id<RTCVideoRenderer>)videoRenderer { 56 - (instancetype)initWithNativeRenderer:(id<RTCVideoRenderer>)videoRenderer {
59 NSParameterAssert(videoRenderer); 57 NSParameterAssert(videoRenderer);
60 if (self = [super init]) { 58 if (self = [super init]) {
61 _videoRenderer = videoRenderer; 59 _videoRenderer = videoRenderer;
62 _adapter.reset(new webrtc::VideoRendererAdapter(self)); 60 _adapter.reset(new webrtc::VideoRendererAdapter(self));
63 } 61 }
64 return self; 62 return self;
65 } 63 }
66 64
67 - (rtc::VideoSinkInterface<cricket::VideoFrame> *)nativeVideoRenderer { 65 - (rtc::VideoSinkInterface<webrtc::VideoFrame> *)nativeVideoRenderer {
68 return _adapter.get(); 66 return _adapter.get();
69 } 67 }
70 68
71 @end 69 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698