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

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

Issue 2695203004: Clean up RTCVideoFrame (Closed)
Patch Set: Fix memory leak. Add ObjC rotation enum. Add space in pointer types. Created 3 years, 10 months 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
(...skipping 30 matching lines...) Expand all
41 } 41 }
42 [self ensureGLContext]; 42 [self ensureGLContext];
43 glClear(GL_COLOR_BUFFER_BIT); 43 glClear(GL_COLOR_BUFFER_BIT);
44 id<RTCShader> shader = nil; 44 id<RTCShader> shader = nil;
45 #if TARGET_OS_IPHONE 45 #if TARGET_OS_IPHONE
46 if (frame.nativeHandle) { 46 if (frame.nativeHandle) {
47 if (!_nv12Shader) { 47 if (!_nv12Shader) {
48 _nv12Shader = [[RTCNativeNV12Shader alloc] initWithContext:_context]; 48 _nv12Shader = [[RTCNativeNV12Shader alloc] initWithContext:_context];
49 } 49 }
50 shader = _nv12Shader; 50 shader = _nv12Shader;
51 #else
52 // Rendering native CVPixelBuffer is not supported on OS X.
53 if (false) {
54 #endif
55 } else { 51 } else {
56 if (!_i420Shader) { 52 if (!_i420Shader) {
57 _i420Shader = [[RTCI420Shader alloc] initWithContext:_context]; 53 _i420Shader = [[RTCI420Shader alloc] initWithContext:_context];
58 } 54 }
59 shader = _i420Shader; 55 shader = _i420Shader;
60 } 56 }
57 #else
58 // Rendering native CVPixelBuffer is not supported on OS X.
59 frame = [frame newI420VideoFrame];
60 if (!_i420Shader) {
61 _i420Shader = [[RTCI420Shader alloc] initWithContext:_context];
62 }
63 shader = _i420Shader;
64 #endif
61 if (!shader || ![shader drawFrame:frame]) { 65 if (!shader || ![shader drawFrame:frame]) {
62 return NO; 66 return NO;
63 } 67 }
64 68
65 #if !TARGET_OS_IPHONE 69 #if !TARGET_OS_IPHONE
66 [_context flushBuffer]; 70 [_context flushBuffer];
67 #endif 71 #endif
68 _lastDrawnFrame = frame; 72 _lastDrawnFrame = frame;
69 73
70 return YES; 74 return YES;
(...skipping 26 matching lines...) Expand all
97 [EAGLContext setCurrentContext:_context]; 101 [EAGLContext setCurrentContext:_context];
98 } 102 }
99 #else 103 #else
100 if ([NSOpenGLContext currentContext] != _context) { 104 if ([NSOpenGLContext currentContext] != _context) {
101 [_context makeCurrentContext]; 105 [_context makeCurrentContext];
102 } 106 }
103 #endif 107 #endif
104 } 108 }
105 109
106 @end 110 @end
OLDNEW
« no previous file with comments | « webrtc/sdk/objc/Framework/Classes/RTCNativeNV12Shader.mm ('k') | webrtc/sdk/objc/Framework/Classes/RTCShader.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698