Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[ALSA] OSS PCM emulation - The 2nd final fix for SNDCTL_DSP_GETOPTR problem

ALSA<-OSS emulation
The problem was negative/wrong result (info.bytes) in a specific condition at
playback startup.

Signed-off-by: Jaroslav Kysela <perex@suse.cz>

+4 -4
+4 -4
sound/core/oss/pcm_oss.c
··· 1537 1537 snd_pcm_oss_simulate_fill(substream, delay); 1538 1538 info.bytes = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr) & INT_MAX; 1539 1539 } else { 1540 - delay = snd_pcm_oss_bytes(substream, delay) + fixup; 1541 - info.blocks = delay / runtime->oss.period_bytes; 1540 + delay = snd_pcm_oss_bytes(substream, delay); 1542 1541 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { 1543 - if (runtime->oss.bytes == 0) 1544 - delay = 0; 1542 + info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes; 1545 1543 info.bytes = (runtime->oss.bytes - delay) & INT_MAX; 1546 1544 } else { 1545 + delay += fixup; 1546 + info.blocks = delay / runtime->oss.period_bytes; 1547 1547 info.bytes = (runtime->oss.bytes + delay) & INT_MAX; 1548 1548 } 1549 1549 }