ObjC: Add missing _lastDrawnFrame assignments
Currently there are several checks against _lastDrawnFrame in RTCEAGLVideoView.mm but this variable is not assigned anywhere. Seems like it was missed in 13941912b1 during work on injecting custom shaders.
Bug: webrtc:9133
Change-Id: Ie979a63de343e7253e4b4e70e3b98ffb0880af04
Reviewed-on: https://webrtc-review.googlesource.com/68720
Commit-Queue: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22819}
diff --git a/AUTHORS b/AUTHORS
index 6ae4803..9394364 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -60,6 +60,7 @@
Hans Knoechel <hans@hans-knoechel.de>
Korniltsev Anatoly <korniltsev.anatoly@gmail.com>
Todd Wong <todd.wong.ndq@gmail.com>
+Maxim Pavlov <pavllovmax@gmail.com>
&yet LLC <*@andyet.com>
Agora IO <*@agora.io>
diff --git a/sdk/objc/Framework/Classes/UI/RTCEAGLVideoView.m b/sdk/objc/Framework/Classes/UI/RTCEAGLVideoView.m
index 8f379c8..7655dd6 100644
--- a/sdk/objc/Framework/Classes/UI/RTCEAGLVideoView.m
+++ b/sdk/objc/Framework/Classes/UI/RTCEAGLVideoView.m
@@ -103,7 +103,9 @@
id<RTCVideoViewShading> _shader;
RTCNV12TextureCache *_nv12TextureCache;
RTCI420TextureCache *_i420TextureCache;
- RTCVideoFrame *_lastDrawnFrame;
+ // As timestamps should be unique between frames, will store last
+ // drawn frame timestamp instead of the whole frame to reduce memory usage.
+ int64_t _lastDrawnFrameTimeStampNs;
}
@synthesize delegate = _delegate;
@@ -229,7 +231,7 @@
// The renderer will draw the frame to the framebuffer corresponding to the
// one used by |view|.
RTCVideoFrame *frame = self.videoFrame;
- if (!frame || frame == _lastDrawnFrame) {
+ if (!frame || frame.timeStampNs == _lastDrawnFrameTimeStampNs) {
return;
}
[self ensureGLContext];
@@ -246,6 +248,8 @@
yPlane:_nv12TextureCache.yTexture
uvPlane:_nv12TextureCache.uvTexture];
[_nv12TextureCache releaseTextures];
+
+ _lastDrawnFrameTimeStampNs = self.videoFrame.timeStampNs;
}
} else {
if (!_i420TextureCache) {
@@ -258,6 +262,8 @@
yPlane:_i420TextureCache.yTexture
uPlane:_i420TextureCache.uTexture
vPlane:_i420TextureCache.vTexture];
+
+ _lastDrawnFrameTimeStampNs = self.videoFrame.timeStampNs;
}
}
@@ -281,7 +287,7 @@
- (void)displayLinkTimerDidFire {
// Don't render unless video frame have changed or the view content
// has explicitly been marked dirty.
- if (!_isDirty && _lastDrawnFrame == self.videoFrame) {
+ if (!_isDirty && _lastDrawnFrameTimeStampNs == self.videoFrame.timeStampNs) {
return;
}