video: OpenGL rendering of incoming frames

The previous system to display the incoming video frames was relying
on CGImage generation with raw framebuffer which were then set as the
content of the CallView. This way of doing it is not efficient as it
implies buffer copies and is discouraged by Apple for pictures that
change often. Moreover, this process was done by the
VideoReceiveThread from the daemon which was then blocked by those
copies without being able to decode further incoming frames. This is
why a lag was appearing and increasing on high resolution stream.

The new system now isolates frame delivering to the UI and their
rendering. The VideoReceiveThread just update the current frame buffer
and size without copy and another thread send those data to an OpenGL
texture on screen refresh which also enables to automatically skip
frames in case of heavy load.

Change-Id: I0b79ddce66f52a3db1eee19945733ff93e7ce34f
Reviewed-by: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d972954..6e15b51 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,6 +24,7 @@
 FIND_PACKAGE(Qt5MacExtras REQUIRED)
 FIND_PACKAGE(Qt5Widgets REQUIRED)
 FIND_PACKAGE(LibRingClient REQUIRED)
+FIND_PACKAGE(OpenGL REQUIRED)
 
 EXECUTE_PROCESS(COMMAND git submodule update --init
                 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
@@ -79,6 +80,7 @@
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
 INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR})
 INCLUDE_DIRECTORIES(${LIB_RING_CLIENT_INCLUDE_DIR})
+INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
 
 SET(CMAKE_MACOSX_RPATH ON)
 SET(CMAKE_SKIP_BUILD_RPATH FALSE)
@@ -179,6 +181,8 @@
 SET(ringclient_VIEWS
    src/views/CallView.mm
    src/views/CallView.h
+   src/views/CallLayer.mm
+   src/views/CallLayer.h
    src/views/ITProgressIndicator.mm
    src/views/ITProgressIndicator.h
    src/views/RingOutlineView.mm
@@ -420,6 +424,7 @@
    ${Qt5Core_LIBRARIES}
    ${Qt5MacExtras_LIBRARIES}
    ${Qt5Widgets_LIBRARIES}
+   ${OPENGL_LIBRARIES}
    -lqrencode
 )