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

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

Issue 2695203004: Clean up RTCVideoFrame (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/sdk/objc/Framework/Classes/RTCI420Shader.mm
diff --git a/webrtc/sdk/objc/Framework/Classes/RTCI420Shader.mm b/webrtc/sdk/objc/Framework/Classes/RTCI420Shader.mm
index d325840cf5d5853e8c019e16b3c4bc622e39f5d9..3665a8cfb9b5b2ca320c105f8d2eb795735fe2d1 100644
--- a/webrtc/sdk/objc/Framework/Classes/RTCI420Shader.mm
+++ b/webrtc/sdk/objc/Framework/Classes/RTCI420Shader.mm
@@ -188,32 +188,34 @@ static const char kI420FragmentShaderSource[] =
GLint textureOffset = _currentTextureSet * 3;
NSAssert(textureOffset + 3 <= kNumTextures, @"invalid offset");
- if (frame.yPitch != static_cast<int32_t>(frame.width) ||
- frame.uPitch != static_cast<int32_t>(frame.chromaWidth) ||
- frame.vPitch != static_cast<int32_t>(frame.chromaWidth)) {
+ const int chromaWidth = (frame.width + 1) / 2;
+ const int chromaHeight = (frame.height + 1) / 2;
+ if (frame.strideY != frame.width ||
+ frame.strideU != chromaWidth ||
+ frame.strideV != chromaWidth) {
_planeBuffer.resize(frame.width * frame.height);
}
- [self uploadPlane:frame.yPlane
+ [self uploadPlane:frame.dataY
sampler:_ySampler
offset:textureOffset
width:frame.width
height:frame.height
- stride:frame.yPitch];
+ stride:frame.strideY];
- [self uploadPlane:frame.uPlane
+ [self uploadPlane:frame.dataU
sampler:_uSampler
offset:textureOffset + 1
- width:frame.chromaWidth
- height:frame.chromaHeight
- stride:frame.uPitch];
+ width:chromaWidth
+ height:chromaHeight
+ stride:frame.strideU];
- [self uploadPlane:frame.vPlane
+ [self uploadPlane:frame.dataV
sampler:_vSampler
offset:textureOffset + 2
- width:frame.chromaWidth
- height:frame.chromaHeight
- stride:frame.vPitch];
+ width:chromaWidth
+ height:chromaHeight
+ stride:frame.strideV];
_currentTextureSet = (_currentTextureSet + 1) % kNumTextureSets;
return YES;

Powered by Google App Engine
This is Rietveld 408576698