add rotationOverride for RTCEAGLVideoView

Bug: webrtc:11221
Change-Id: I105b93de21fd2faeaf072c947c08006857c7a654
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/162460
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Commit-Queue: Kári Helgason <kthelgason@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30117}
This commit is contained in:
CZ Theng
2019-12-20 11:33:21 +08:00
committed by Commit Bot
parent 2e8e1c699e
commit 41875aa686
2 changed files with 10 additions and 2 deletions

View File

@ -35,6 +35,9 @@ NS_EXTENSION_UNAVAILABLE_IOS("Rendering not available in app extensions.")
- (instancetype)initWithCoder:(NSCoder *)aDecoder
shader:(id<RTCVideoViewShading>)shader NS_DESIGNATED_INITIALIZER;
/** @abstract Wrapped RTCVideoRotation, or nil.
*/
@property(nonatomic, nullable) NSValue *rotationOverride;
@end
NS_ASSUME_NONNULL_END

View File

@ -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];