diff --git a/sdk/objc/components/renderer/opengl/RTCEAGLVideoView.h b/sdk/objc/components/renderer/opengl/RTCEAGLVideoView.h index 30764b54cd..73cd3a1a26 100644 --- a/sdk/objc/components/renderer/opengl/RTCEAGLVideoView.h +++ b/sdk/objc/components/renderer/opengl/RTCEAGLVideoView.h @@ -35,6 +35,9 @@ NS_EXTENSION_UNAVAILABLE_IOS("Rendering not available in app extensions.") - (instancetype)initWithCoder:(NSCoder *)aDecoder shader:(id)shader NS_DESIGNATED_INITIALIZER; +/** @abstract Wrapped RTCVideoRotation, or nil. + */ +@property(nonatomic, nullable) NSValue *rotationOverride; @end NS_ASSUME_NONNULL_END diff --git a/sdk/objc/components/renderer/opengl/RTCEAGLVideoView.m b/sdk/objc/components/renderer/opengl/RTCEAGLVideoView.m index 0ccbf9dd6f..6a01d48f32 100644 --- a/sdk/objc/components/renderer/opengl/RTCEAGLVideoView.m +++ b/sdk/objc/components/renderer/opengl/RTCEAGLVideoView.m @@ -57,6 +57,7 @@ @synthesize delegate = _delegate; @synthesize videoFrame = _videoFrame; @synthesize glkView = _glkView; +@synthesize rotationOverride = _rotationOverride; - (instancetype)initWithFrame:(CGRect)frame { return [self initWithFrame:frame shader:[[RTCDefaultShader alloc] init]]; @@ -185,6 +186,10 @@ if (!frame || frame.timeStampNs == _lastDrawnFrameTimeStampNs) { return; } + RTCVideoRotation rotation = frame.rotation; + if(_rotationOverride != nil) { + [_rotationOverride getValue: &rotation]; + } [self ensureGLContext]; glClear(GL_COLOR_BUFFER_BIT); if ([frame.buffer isKindOfClass:[RTCCVPixelBuffer class]]) { @@ -195,7 +200,7 @@ [_nv12TextureCache uploadFrameToTextures:frame]; [_shader applyShadingForFrameWithWidth:frame.width height:frame.height - rotation:frame.rotation + rotation:rotation yPlane:_nv12TextureCache.yTexture uvPlane:_nv12TextureCache.uvTexture]; [_nv12TextureCache releaseTextures]; @@ -209,7 +214,7 @@ [_i420TextureCache uploadFrameToTextures:frame]; [_shader applyShadingForFrameWithWidth:frame.width height:frame.height - rotation:frame.rotation + rotation:rotation yPlane:_i420TextureCache.yTexture uPlane:_i420TextureCache.uTexture vPlane:_i420TextureCache.vTexture];