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

Unified Diff: webrtc/sdk/objc/Framework/Classes/RTCNativeNV12Shader.mm

Issue 2176623002: iOS render: Handle frame rotation in OpenGL (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@nv21_texture_render
Patch Set: Keep RTCVideoFrame.h pure ObjC Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/sdk/objc/Framework/Classes/RTCI420Shader.mm ('k') | webrtc/sdk/objc/Framework/Classes/RTCShader.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/sdk/objc/Framework/Classes/RTCNativeNV12Shader.mm
diff --git a/webrtc/sdk/objc/Framework/Classes/RTCNativeNV12Shader.mm b/webrtc/sdk/objc/Framework/Classes/RTCNativeNV12Shader.mm
index cc979434e9fcee83e87430f3248811a54d755255..75a575b075eb5cfea6e5e95d821ae70e3f6b5c6a 100644
--- a/webrtc/sdk/objc/Framework/Classes/RTCNativeNV12Shader.mm
+++ b/webrtc/sdk/objc/Framework/Classes/RTCNativeNV12Shader.mm
@@ -20,6 +20,8 @@
#import "WebRTC/RTCVideoFrame.h"
#include "webrtc/base/checks.h"
+#include "webrtc/base/optional.h"
+#include "webrtc/common_video/rotation.h"
static const char kNV12FragmentShaderSource[] =
SHADER_VERSION
@@ -46,6 +48,9 @@ static const char kNV12FragmentShaderSource[] =
GLint _ySampler;
GLint _uvSampler;
CVOpenGLESTextureCacheRef _textureCache;
+ // Store current rotation and only upload new vertex data when rotation
+ // changes.
+ rtc::Optional<webrtc::VideoRotation> _currentRotation;
}
- (instancetype)initWithContext:(GlContextType *)context {
@@ -149,6 +154,11 @@ static const char kNV12FragmentShaderSource[] =
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
+ if (!_currentRotation || frame.rotation != *_currentRotation) {
+ _currentRotation = rtc::Optional<webrtc::VideoRotation>(
+ static_cast<webrtc::VideoRotation>(frame.rotation));
+ RTCSetVertexData(*_currentRotation);
+ }
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
CFRelease(chromaTexture);
« no previous file with comments | « webrtc/sdk/objc/Framework/Classes/RTCI420Shader.mm ('k') | webrtc/sdk/objc/Framework/Classes/RTCShader.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698