Emmanouil Pitsidianakis <manos.pitsidiana...@linaro.org> writes:
> Handle output IO messages in the transmit (TX) virtqueue. > > It allocates a VirtIOSoundPCMBlock for each IO message and copies the > data buffer to it. When the IO buffer is written to the host's sound > card, the guest will be notified that it has been consumed. > > The lifetime of an IO message is: > > 1. Guest sends IO message to TX virtqueue. > 2. QEMU adds it to the appropriate stream's IO buffer queue. > 3. Sometime later, the host audio backend calls the output callback, > virtio_snd_pcm_out_cb(), which is defined with an AUD_open_out() > call. The callback gets an available number of bytes the backend can > receive. Then it writes data from the IO buffer queue to the backend. > If at any time a buffer is exhausted, it is returned to the guest as > completed. > 4. If the guest releases the stream, its buffer queue is flushed by > attempting to write any leftover data to the audio backend and > releasing all IO messages back to the guest. This is how according to > the spec the guest knows the release was successful. > > Based-on: > https://github.com/OpenSynergy/qemu/commit/5a2f350eec5d157b90d9c7b40a8e603f4da92471 > Signed-off-by: Igor Skalkin <igor.skal...@opensynergy.com> > Signed-off-by: Anton Yakovlev <anton.yakov...@opensynergy.com> > Signed-off-by: Emmanouil Pitsidianakis > <manos.pitsidiana...@linaro.org> Reviewed-by: Alex Bennée <alex.ben...@linaro.org> -- Alex Bennée Virtualisation Tech Lead @ Linaro