     fileprivate var glkView: GLKView?
     fileprivate var frameLock: NSLock?
     fileprivate var renderingEnabled: Bool = true
-    fileprivate var clearRenderer = 0
     fileprivate var lastVideoFrame: OTVideoFrame?
-    fileprivate var lastVideoFrameRendered: Bool = true
     fileprivate var displayLinkProxy: DisplayLinkProxy?
     fileprivate var displayLink: CADisplayLink?
     

        if let fLock = frameLock, let format = frame.format {
            fLock.lock()
            assert(format.pixelFormat == .I420)
            if lastVideoFrameRendered == false {
                deallocateFrame(lastVideoFrame ?? nil)
            }
            lastVideoFrame = OTVideoFrame(format: format)
            lastVideoFrame?.timestamp = frame.timestamp
            

        }
        frameLock?.lock()
        //Coming from bg you will double render and deallocate will crash below. Hence check for lastVideoFrameRendered == false
        guard let lastVideoFrame = lastVideoFrame
            else {
                return
        }
        
        renderer?.drawFrame(frame: lastVideoFrame, withViewport: view.frame)
        deallocateFrame(lastVideoFrame)
        self.lastVideoFrame = nil
    }
    
    func deallocateFrame(_ frame: OTVideoFrame?) -> Void {
        guard let frame = frame else {
            return
        }
        
        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)
