use a control structure instead of a bare rwlock

Signed-off-by: Tomas Neme <lacrymology@gmail.com>
use cond wait for synchronization between consumer and producer

Signed-off-by: Tomas Neme <lacrymology@gmail.com>
if frame is not consecutive, empty the queue before continuing

Signed-off-by: Tomas Neme <lacrymology@gmail.com>
use cond waiting on the queue as well

Signed-off-by: Tomas Neme <lacrymology@gmail.com>
set up some more properties

Signed-off-by: Tomas Neme <lacrymology@gmail.com>