             lastVideoFrame?.planes?.addPointer(uPlane)
             lastVideoFrame?.planes?.addPointer(vPlane)
             
+            lastVideoFrameRendered = false
+            
             fLock.unlock()
             
             if let delegate = delegate {

    fileprivate var renderingEnabled: Bool = true
    fileprivate var clearRenderer = 0
    fileprivate var lastVideoFrame: OTVideoFrame?
    fileprivate var displayLinkProxy: DisplayLinkProxy?
    fileprivate var displayLink: CADisplayLink?
    

            frameLock?.unlock()
        }
        frameLock?.lock()
        //Coming from bg you will double render and deallocate will crash below. Hence check for lastVideoFrameRendered == false
        guard let frame = lastVideoFrame , lastVideoFrameRendered == false
            else {
                return
        }
        
        renderer?.drawFrame(frame: frame, withViewport: view.frame)
        lastVideoFrameRendered = true
        
        let yPlane: UnsafeMutablePointer<GLubyte>? = frame.planes?.pointer(at: 0)?.assumingMemoryBound(to: GLubyte.self)
        let uPlane: UnsafeMutablePointer<GLubyte>? = frame.planes?.pointer(at: 1)?.assumingMemoryBound(to: GLubyte.self)
        let vPlane: UnsafeMutablePointer<GLubyte>? = frame.planes?.pointer(at: 2)?.assumingMemoryBound(to: GLubyte.self)
        
        yPlane?.deallocate()
        uPlane?.deallocate()
        vPlane?.deallocate()
    }
    
}
