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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 // These methods may be called on non-main thread. | 208 // These methods may be called on non-main thread. |
209 - (void)setSize:(CGSize)size { | 209 - (void)setSize:(CGSize)size { |
210 __weak RTCEAGLVideoView *weakSelf = self; | 210 __weak RTCEAGLVideoView *weakSelf = self; |
211 dispatch_async(dispatch_get_main_queue(), ^{ | 211 dispatch_async(dispatch_get_main_queue(), ^{ |
212 RTCEAGLVideoView *strongSelf = weakSelf; | 212 RTCEAGLVideoView *strongSelf = weakSelf; |
213 [strongSelf.delegate videoView:strongSelf didChangeVideoSize:size]; | 213 [strongSelf.delegate videoView:strongSelf didChangeVideoSize:size]; |
214 }); | 214 }); |
215 } | 215 } |
216 | 216 |
217 - (void)renderFrame:(RTCVideoFrame *)frame { | 217 - (void)renderFrame:(RTCVideoFrame *)frame { |
218 #if !TARGET_OS_IPHONE | |
219 // Generate the i420 frame on video send thread instead of main thread. | |
220 // TODO(tkchin): Remove this once RTCEAGLVideoView supports uploading | |
221 // CVPixelBuffer textures on OSX. | |
222 [frame convertBufferIfNeeded]; | |
223 #endif | |
224 self.videoFrame = frame; | 218 self.videoFrame = frame; |
225 } | 219 } |
226 | 220 |
227 #pragma mark - Private | 221 #pragma mark - Private |
228 | 222 |
229 - (void)displayLinkTimerDidFire { | 223 - (void)displayLinkTimerDidFire { |
230 // Don't render unless video frame have changed or the view content | 224 // Don't render unless video frame have changed or the view content |
231 // has explicitly been marked dirty. | 225 // has explicitly been marked dirty. |
232 if (!_isDirty && _glRenderer.lastDrawnFrame == self.videoFrame) { | 226 if (!_isDirty && _glRenderer.lastDrawnFrame == self.videoFrame) { |
233 return; | 227 return; |
(...skipping 27 matching lines...) Expand all Loading... |
261 | 255 |
262 - (void)didBecomeActive { | 256 - (void)didBecomeActive { |
263 [self setupGL]; | 257 [self setupGL]; |
264 } | 258 } |
265 | 259 |
266 - (void)willResignActive { | 260 - (void)willResignActive { |
267 [self teardownGL]; | 261 [self teardownGL]; |
268 } | 262 } |
269 | 263 |
270 @end | 264 @end |
OLD | NEW |