From a72b7fc30a6e287dbade83566714be4893e31d01 Mon Sep 17 00:00:00 2001 From: Maxim Pavlov Date: Tue, 10 Apr 2018 16:57:43 +0300 Subject: [PATCH] ObjC: Add missing _lastDrawnFrame assignments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Kári Helgason Cr-Commit-Position: refs/heads/master@{#22819} --- AUTHORS | 1 + sdk/objc/Framework/Classes/UI/RTCEAGLVideoView.m | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/AUTHORS b/AUTHORS index 6ae480373a..9394364856 100644 --- a/AUTHORS +++ b/AUTHORS @@ -60,6 +60,7 @@ Yura Yaroshevich Hans Knoechel Korniltsev Anatoly Todd Wong +Maxim Pavlov &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 8f379c864a..7655dd650b 100644 --- a/sdk/objc/Framework/Classes/UI/RTCEAGLVideoView.m +++ b/sdk/objc/Framework/Classes/UI/RTCEAGLVideoView.m @@ -103,7 +103,9 @@ id _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; }