mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-01 22:58:49 -04:00
dmix: fix interleaved check
When checking that samples are properly interleaved, use the actual sample size instead of always assuming 16 bits.
This commit is contained in:
parent
45f63a8735
commit
2a438a6eec
1 changed files with 7 additions and 6 deletions
|
|
@ -1143,11 +1143,12 @@ int snd_pcm_direct_set_timer_params(snd_pcm_direct_t *dmix)
|
||||||
int snd_pcm_direct_check_interleave(snd_pcm_direct_t *dmix, snd_pcm_t *pcm)
|
int snd_pcm_direct_check_interleave(snd_pcm_direct_t *dmix, snd_pcm_t *pcm)
|
||||||
{
|
{
|
||||||
unsigned int chn, channels;
|
unsigned int chn, channels;
|
||||||
int interleaved = 1;
|
int bits, interleaved = 1;
|
||||||
const snd_pcm_channel_area_t *dst_areas;
|
const snd_pcm_channel_area_t *dst_areas;
|
||||||
const snd_pcm_channel_area_t *src_areas;
|
const snd_pcm_channel_area_t *src_areas;
|
||||||
|
|
||||||
if ((snd_pcm_format_physical_width(dmix->type) % 8) != 0)
|
bits = snd_pcm_format_physical_width(dmix->type);
|
||||||
|
if ((bits % 8) != 0)
|
||||||
interleaved = 0;
|
interleaved = 0;
|
||||||
channels = dmix->channels;
|
channels = dmix->channels;
|
||||||
dst_areas = snd_pcm_mmap_areas(dmix->spcm);
|
dst_areas = snd_pcm_mmap_areas(dmix->spcm);
|
||||||
|
|
@ -1167,13 +1168,13 @@ int snd_pcm_direct_check_interleave(snd_pcm_direct_t *dmix, snd_pcm_t *pcm)
|
||||||
interleaved = 0;
|
interleaved = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (dst_areas[chn].first != sizeof(signed short) * chn * 8 ||
|
if (dst_areas[chn].first != chn * bits ||
|
||||||
dst_areas[chn].step != channels * sizeof(signed short) * 8) {
|
dst_areas[chn].step != channels * bits) {
|
||||||
interleaved = 0;
|
interleaved = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (src_areas[chn].first != sizeof(signed short) * chn * 8 ||
|
if (src_areas[chn].first != chn * bits ||
|
||||||
src_areas[chn].step != channels * sizeof(signed short) * 8) {
|
src_areas[chn].step != channels * bits) {
|
||||||
interleaved = 0;
|
interleaved = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue