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

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

Issue 2812613003: ObjC: Remove RTCOpenGLVideoRenderer (Closed)
Patch Set: Fix pointer typo and add include. Created 3 years, 8 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 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2016 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
11 #import "RTCShader.h" 11 #import "RTCShader.h"
12 12
13 #include <vector> 13 #include <vector>
14 14
15 #import "RTCShader+Private.h" 15 #import "RTCShader+Private.h"
16 #import "WebRTC/RTCLogging.h"
16 #import "WebRTC/RTCVideoFrame.h" 17 #import "WebRTC/RTCVideoFrame.h"
17 18
18 #include "webrtc/base/optional.h" 19 #include "webrtc/base/optional.h"
19 20
20 // |kNumTextures| must not exceed 8, which is the limit in OpenGLES2. Two sets 21 // |kNumTextures| must not exceed 8, which is the limit in OpenGLES2. Two sets
21 // of 3 textures are used here, one for each of the Y, U and V planes. Having 22 // of 3 textures are used here, one for each of the Y, U and V planes. Having
22 // two sets alleviates CPU blockage in the event that the GPU is asked to render 23 // two sets alleviates CPU blockage in the event that the GPU is asked to render
23 // to a texture that is already in use. 24 // to a texture that is already in use.
24 static const GLsizei kNumTextureSets = 2; 25 static const GLsizei kNumTextureSets = 2;
25 static const GLsizei kNumTexturesPerSet = 3; 26 static const GLsizei kNumTexturesPerSet = 3;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 - (instancetype)initWithContext:(GlContextType *)context { 71 - (instancetype)initWithContext:(GlContextType *)context {
71 if (self = [super init]) { 72 if (self = [super init]) {
72 #if TARGET_OS_IPHONE 73 #if TARGET_OS_IPHONE
73 _hasUnpackRowLength = (context.API == kEAGLRenderingAPIOpenGLES3); 74 _hasUnpackRowLength = (context.API == kEAGLRenderingAPIOpenGLES3);
74 #else 75 #else
75 _hasUnpackRowLength = YES; 76 _hasUnpackRowLength = YES;
76 #endif 77 #endif
77 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 78 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
78 if (![self setupI420Program] || ![self setupTextures] || 79 if (![self setupI420Program] || ![self setupTextures] ||
79 !RTCSetupVerticesForProgram(_i420Program, &_vertexBuffer, &_vertexArray) ) { 80 !RTCSetupVerticesForProgram(_i420Program, &_vertexBuffer, &_vertexArray) ) {
81 RTCLog(@"Failed to initialize RTCI420Shader.");
80 self = nil; 82 self = nil;
81 } 83 }
82 } 84 }
83 return self; 85 return self;
84 } 86 }
85 87
86 - (void)dealloc { 88 - (void)dealloc {
87 glDeleteProgram(_i420Program); 89 glDeleteProgram(_i420Program);
88 glDeleteTextures(kNumTextures, _textures); 90 glDeleteTextures(kNumTextures, _textures);
89 glDeleteBuffers(1, &_vertexBuffer); 91 glDeleteBuffers(1, &_vertexBuffer);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 offset:textureOffset + 2 215 offset:textureOffset + 2
214 width:chromaWidth 216 width:chromaWidth
215 height:chromaHeight 217 height:chromaHeight
216 stride:frame.strideV]; 218 stride:frame.strideV];
217 219
218 _currentTextureSet = (_currentTextureSet + 1) % kNumTextureSets; 220 _currentTextureSet = (_currentTextureSet + 1) % kNumTextureSets;
219 return YES; 221 return YES;
220 } 222 }
221 223
222 @end 224 @end
OLDNEW
« no previous file with comments | « webrtc/sdk/objc/Framework/Classes/RTCEAGLVideoView.m ('k') | webrtc/sdk/objc/Framework/Classes/RTCNSGLVideoView.m » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698