mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-02 09:01:48 -05:00
pcm: softvol - fix early exit in add_tlv_info()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
74c6382df6
commit
eabadf545c
1 changed files with 2 additions and 2 deletions
|
|
@ -711,13 +711,13 @@ static int add_tlv_info(snd_pcm_softvol_t *svol, snd_ctl_elem_info_t *cinfo,
|
||||||
unsigned int *old_tlv, size_t old_tlv_size)
|
unsigned int *old_tlv, size_t old_tlv_size)
|
||||||
{
|
{
|
||||||
unsigned int tlv[4];
|
unsigned int tlv[4];
|
||||||
if (sizeof(tlv) <= old_tlv_size && memcmp(tlv, old_tlv, sizeof(tlv)) == 0)
|
|
||||||
return 0;
|
|
||||||
tlv[SNDRV_CTL_TLVO_TYPE] = SND_CTL_TLVT_DB_SCALE;
|
tlv[SNDRV_CTL_TLVO_TYPE] = SND_CTL_TLVT_DB_SCALE;
|
||||||
tlv[SNDRV_CTL_TLVO_LEN] = 2 * sizeof(int);
|
tlv[SNDRV_CTL_TLVO_LEN] = 2 * sizeof(int);
|
||||||
tlv[SNDRV_CTL_TLVO_DB_SCALE_MIN] = (int)(svol->min_dB * 100);
|
tlv[SNDRV_CTL_TLVO_DB_SCALE_MIN] = (int)(svol->min_dB * 100);
|
||||||
tlv[SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP] =
|
tlv[SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP] =
|
||||||
(int)((svol->max_dB - svol->min_dB) * 100 / svol->max_val);
|
(int)((svol->max_dB - svol->min_dB) * 100 / svol->max_val);
|
||||||
|
if (sizeof(tlv) <= old_tlv_size && memcmp(tlv, old_tlv, sizeof(tlv)) == 0)
|
||||||
|
return 0;
|
||||||
return snd_ctl_elem_tlv_write(svol->ctl, &cinfo->id, tlv);
|
return snd_ctl_elem_tlv_write(svol->ctl, &cinfo->id, tlv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue