OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 28 matching lines...) Loading... |
39 class RTCVideoRendererNativeAdapter | 39 class RTCVideoRendererNativeAdapter |
40 : public rtc::VideoSinkInterface<cricket::VideoFrame> { | 40 : public rtc::VideoSinkInterface<cricket::VideoFrame> { |
41 public: | 41 public: |
42 RTCVideoRendererNativeAdapter(RTCVideoRendererAdapter* adapter) { | 42 RTCVideoRendererNativeAdapter(RTCVideoRendererAdapter* adapter) { |
43 _adapter = adapter; | 43 _adapter = adapter; |
44 _size = CGSizeZero; | 44 _size = CGSizeZero; |
45 } | 45 } |
46 | 46 |
47 void OnFrame(const cricket::VideoFrame& videoFrame) override { | 47 void OnFrame(const cricket::VideoFrame& videoFrame) override { |
48 const cricket::VideoFrame* frame = videoFrame.GetCopyWithRotationApplied(); | 48 const cricket::VideoFrame* frame = videoFrame.GetCopyWithRotationApplied(); |
49 CGSize currentSize = CGSizeMake(frame->GetWidth(), frame->GetHeight()); | 49 CGSize currentSize = CGSizeMake(frame->width(), frame->height()); |
50 if (!CGSizeEqualToSize(_size, currentSize)) { | 50 if (!CGSizeEqualToSize(_size, currentSize)) { |
51 _size = currentSize; | 51 _size = currentSize; |
52 [_adapter.videoRenderer setSize:_size]; | 52 [_adapter.videoRenderer setSize:_size]; |
53 } | 53 } |
54 RTCI420Frame* i420Frame = [[RTCI420Frame alloc] initWithVideoFrame:frame]; | 54 RTCI420Frame* i420Frame = [[RTCI420Frame alloc] initWithVideoFrame:frame]; |
55 [_adapter.videoRenderer renderFrame:i420Frame]; | 55 [_adapter.videoRenderer renderFrame:i420Frame]; |
56 } | 56 } |
57 | 57 |
58 private: | 58 private: |
59 __weak RTCVideoRendererAdapter* _adapter; | 59 __weak RTCVideoRendererAdapter* _adapter; |
(...skipping 13 matching lines...) Loading... |
73 _adapter.reset(new webrtc::RTCVideoRendererNativeAdapter(self)); | 73 _adapter.reset(new webrtc::RTCVideoRendererNativeAdapter(self)); |
74 } | 74 } |
75 return self; | 75 return self; |
76 } | 76 } |
77 | 77 |
78 - (rtc::VideoSinkInterface<cricket::VideoFrame> *)nativeVideoRenderer { | 78 - (rtc::VideoSinkInterface<cricket::VideoFrame> *)nativeVideoRenderer { |
79 return _adapter.get(); | 79 return _adapter.get(); |
80 } | 80 } |
81 | 81 |
82 @end | 82 @end |
OLD | NEW |