sound: Add sanity checks in snd_{playback,record}_send

Filter out commands which should not happen. Should it be a
g_warn_if_fail() or such instead?

Based on a patch from Frediano Ziglio <fziglio@redhat.com>

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
Christophe Fergeau 2017-01-09 15:10:13 +01:00
parent c4a58c90c6
commit 85b73636d9

View File

@ -851,6 +851,9 @@ static void snd_playback_send(void* data)
return;
}
client->command &= SND_PLAYBACK_MODE_MASK|SND_PLAYBACK_PCM_MASK|
SND_CTRL_MASK|SND_VOLUME_MUTE_MASK|
SND_MIGRATE_MASK|SND_PLAYBACK_LATENCY_MASK;
while (client->command) {
if (client->command & SND_PLAYBACK_MODE_MASK) {
if (!playback_send_mode(playback_client)) {
@ -910,6 +913,7 @@ static void snd_record_send(void* data)
return;
}
client->command &= SND_CTRL_MASK|SND_VOLUME_MUTE_MASK|SND_MIGRATE_MASK;
while (client->command) {
if (client->command & SND_CTRL_MASK) {
if (!snd_record_send_ctl(record_client)) {