combine-sink: Fix unsafe message handling
authorTanu Kaskinen <tanuk@iki.fi>
Sat, 27 Jun 2015 15:36:35 +0000 (18:36 +0300)
committerTanu Kaskinen <tanuk@iki.fi>
Tue, 21 Jul 2015 17:05:13 +0000 (20:05 +0300)
commit4604af71981117854188dbb9a19f55f6b972fde6
tree3c8cc0fcf4c42355722276fd4585a62d1bfa5cf7
parent8b3b39c7d832f8fdf11798fc04061ba353393f70
combine-sink: Fix unsafe message handling

This fixes a crash. sink_input_pop_cb() drains the message queue that receives
memchunks from the combine sink thread to avoid requesting more audio too soon.
The same message queue received also SET_REQUESTED_LATENCY messages, which
generate rewind requests. Rewind requests shouldn't be issued in the pop()
callback, doing so results in an assertion error. Therefore, it was not safe to
drain the message queue in the pop() callback, but usually the queue is empty,
so this bug was not immediately detected.

This patch splits the message queue into two queues: audio_inq and control_inq.
audio_inq receives only messages containing memchunks, and control_inq receives
only the SET_REQUESTED_LATENCY messages. The pop() callback only drains the
audio queue, which avoids the rewind requests in the pop() callback.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=90489
src/modules/module-combine-sink.c