Locking the frame_buffer mutex to reference the input frame into the tmp_frame is unnecessary. This also fixes the missing unlock on error.
Add a special LOG_OOM() function to log all OutOfMemory errors (i.e. allocations returning NULL).
The current video buffer only stores one pending frame. In order to add a new buffering feature, move this part to a separate "frame buffer". Keep the video_buffer, which currently delegates all its calls to the frame_buffer.