| OLD | NEW |
| 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 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 public: | 23 public: |
| 24 VideoRendererAdapter(RTCVideoRendererAdapter* adapter) { | 24 VideoRendererAdapter(RTCVideoRendererAdapter* adapter) { |
| 25 adapter_ = adapter; | 25 adapter_ = adapter; |
| 26 size_ = CGSizeZero; | 26 size_ = CGSizeZero; |
| 27 } | 27 } |
| 28 | 28 |
| 29 void OnFrame(const cricket::VideoFrame& nativeVideoFrame) override { | 29 void OnFrame(const cricket::VideoFrame& nativeVideoFrame) override { |
| 30 RTCVideoFrame* videoFrame = [[RTCVideoFrame alloc] | 30 RTCVideoFrame* videoFrame = [[RTCVideoFrame alloc] |
| 31 initWithVideoBuffer:nativeVideoFrame.video_frame_buffer() | 31 initWithVideoBuffer:nativeVideoFrame.video_frame_buffer() |
| 32 rotation:nativeVideoFrame.rotation() | 32 rotation:nativeVideoFrame.rotation() |
| 33 timeStampNs:nativeVideoFrame.timestamp_us() * | 33 timeStampNs:nativeVideoFrame.GetTimeStamp()]; |
| 34 rtc::kNumNanosecsPerMicrosec]; | |
| 35 CGSize current_size = (videoFrame.rotation % 180 == 0) | 34 CGSize current_size = (videoFrame.rotation % 180 == 0) |
| 36 ? CGSizeMake(videoFrame.width, videoFrame.height) | 35 ? CGSizeMake(videoFrame.width, videoFrame.height) |
| 37 : CGSizeMake(videoFrame.height, videoFrame.width); | 36 : CGSizeMake(videoFrame.height, videoFrame.width); |
| 38 | 37 |
| 39 if (!CGSizeEqualToSize(size_, current_size)) { | 38 if (!CGSizeEqualToSize(size_, current_size)) { |
| 40 size_ = current_size; | 39 size_ = current_size; |
| 41 [adapter_.videoRenderer setSize:size_]; | 40 [adapter_.videoRenderer setSize:size_]; |
| 42 } | 41 } |
| 43 [adapter_.videoRenderer renderFrame:videoFrame]; | 42 [adapter_.videoRenderer renderFrame:videoFrame]; |
| 44 } | 43 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 62 _adapter.reset(new webrtc::VideoRendererAdapter(self)); | 61 _adapter.reset(new webrtc::VideoRendererAdapter(self)); |
| 63 } | 62 } |
| 64 return self; | 63 return self; |
| 65 } | 64 } |
| 66 | 65 |
| 67 - (rtc::VideoSinkInterface<cricket::VideoFrame> *)nativeVideoRenderer { | 66 - (rtc::VideoSinkInterface<cricket::VideoFrame> *)nativeVideoRenderer { |
| 68 return _adapter.get(); | 67 return _adapter.get(); |
| 69 } | 68 } |
| 70 | 69 |
| 71 @end | 70 @end |
| OLD | NEW |