| 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 14 matching lines...) Expand all Loading... |
| 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 = nil; | 30 RTCVideoFrame *videoFrame = nil; |
| 31 // Rotation of native handles is unsupported right now. Convert to CPU | 31 // Rotation of native handles is unsupported right now. Convert to CPU |
| 32 // I420 buffer for rotation before calling the rotation method otherwise | 32 // I420 buffer for rotation before calling the rotation method otherwise |
| 33 // it will hit a DCHECK. | 33 // it will hit a DCHECK. |
| 34 if (nativeVideoFrame.rotation() != webrtc::kVideoRotation_0 && | 34 if (nativeVideoFrame.rotation() != webrtc::kVideoRotation_0 && |
| 35 nativeVideoFrame.GetNativeHandle()) { | 35 nativeVideoFrame.video_frame_buffer()->native_handle()) { |
| 36 rtc::scoped_refptr<webrtc::VideoFrameBuffer> i420Buffer = | 36 rtc::scoped_refptr<webrtc::VideoFrameBuffer> i420Buffer = |
| 37 nativeVideoFrame.video_frame_buffer()->NativeToI420Buffer(); | 37 nativeVideoFrame.video_frame_buffer()->NativeToI420Buffer(); |
| 38 std::unique_ptr<cricket::VideoFrame> cpuFrame( | 38 std::unique_ptr<cricket::VideoFrame> cpuFrame( |
| 39 new cricket::WebRtcVideoFrame(i420Buffer, | 39 new cricket::WebRtcVideoFrame(i420Buffer, |
| 40 nativeVideoFrame.rotation(), | 40 nativeVideoFrame.rotation(), |
| 41 nativeVideoFrame.timestamp_us())); | 41 nativeVideoFrame.timestamp_us())); |
| 42 const cricket::VideoFrame *rotatedFrame = | 42 const cricket::VideoFrame *rotatedFrame = |
| 43 cpuFrame->GetCopyWithRotationApplied(); | 43 cpuFrame->GetCopyWithRotationApplied(); |
| 44 videoFrame = [[RTCVideoFrame alloc] initWithNativeFrame:rotatedFrame]; | 44 videoFrame = [[RTCVideoFrame alloc] initWithNativeFrame:rotatedFrame]; |
| 45 } else { | 45 } else { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 74 _adapter.reset(new webrtc::VideoRendererAdapter(self)); | 74 _adapter.reset(new webrtc::VideoRendererAdapter(self)); |
| 75 } | 75 } |
| 76 return self; | 76 return self; |
| 77 } | 77 } |
| 78 | 78 |
| 79 - (rtc::VideoSinkInterface<cricket::VideoFrame> *)nativeVideoRenderer { | 79 - (rtc::VideoSinkInterface<cricket::VideoFrame> *)nativeVideoRenderer { |
| 80 return _adapter.get(); | 80 return _adapter.get(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 @end | 83 @end |
| OLD | NEW |