Commit 5ac0fab9 authored by Jaroslav Kysela's avatar Jaroslav Kysela

[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: default avatarJaroslav Kysela <perex@suse.cz>
parent 98c7f212
...@@ -1537,13 +1537,13 @@ static int snd_pcm_oss_get_ptr(snd_pcm_oss_file_t *pcm_oss_file, int stream, str ...@@ -1537,13 +1537,13 @@ static int snd_pcm_oss_get_ptr(snd_pcm_oss_file_t *pcm_oss_file, int stream, str
snd_pcm_oss_simulate_fill(substream, delay); snd_pcm_oss_simulate_fill(substream, delay);
info.bytes = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr) & INT_MAX; info.bytes = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr) & INT_MAX;
} else { } else {
delay = snd_pcm_oss_bytes(substream, delay) + fixup; delay = snd_pcm_oss_bytes(substream, delay);
info.blocks = delay / runtime->oss.period_bytes;
if (stream == SNDRV_PCM_STREAM_PLAYBACK) { if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
if (runtime->oss.bytes == 0) info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes;
delay = 0;
info.bytes = (runtime->oss.bytes - delay) & INT_MAX; info.bytes = (runtime->oss.bytes - delay) & INT_MAX;
} else { } else {
delay += fixup;
info.blocks = delay / runtime->oss.period_bytes;
info.bytes = (runtime->oss.bytes + delay) & INT_MAX; info.bytes = (runtime->oss.bytes + delay) & INT_MAX;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment