Commit dbecaea6 authored by Jaroslav Kysela's avatar Jaroslav Kysela

ALSA CVS update - Jaroslav Kysela <perex@suse.cz>

ALSA<-OSS emulation
Added period_frames to fix poll behavior
parent 5287a1ad
...@@ -50,6 +50,7 @@ typedef struct _snd_pcm_oss_runtime { ...@@ -50,6 +50,7 @@ typedef struct _snd_pcm_oss_runtime {
unsigned int maxfrags; unsigned int maxfrags;
unsigned int subdivision; /* requested subdivision */ unsigned int subdivision; /* requested subdivision */
size_t period_bytes; /* requested period size */ size_t period_bytes; /* requested period size */
size_t period_frames; /* period frames for poll */
size_t period_ptr; /* actual write pointer to period */ size_t period_ptr; /* actual write pointer to period */
unsigned int periods; unsigned int periods;
size_t buffer_bytes; /* requested buffer size */ size_t buffer_bytes; /* requested buffer size */
......
...@@ -254,6 +254,7 @@ static int snd_pcm_oss_period_size(snd_pcm_substream_t *substream, ...@@ -254,6 +254,7 @@ static int snd_pcm_oss_period_size(snd_pcm_substream_t *substream,
snd_assert(oss_period_size >= 16, return -EINVAL); snd_assert(oss_period_size >= 16, return -EINVAL);
runtime->oss.period_bytes = oss_period_size; runtime->oss.period_bytes = oss_period_size;
runtime->oss.period_frames = oss_period_size / oss_frame_size;
runtime->oss.periods = oss_periods; runtime->oss.periods = oss_periods;
return 0; return 0;
} }
...@@ -2098,7 +2099,7 @@ static int snd_pcm_oss_playback_ready(snd_pcm_substream_t *substream) ...@@ -2098,7 +2099,7 @@ static int snd_pcm_oss_playback_ready(snd_pcm_substream_t *substream)
if (atomic_read(&runtime->mmap_count)) if (atomic_read(&runtime->mmap_count))
return runtime->oss.prev_hw_ptr_interrupt != runtime->hw_ptr_interrupt; return runtime->oss.prev_hw_ptr_interrupt != runtime->hw_ptr_interrupt;
else else
return snd_pcm_playback_ready(substream); return snd_pcm_playback_avail(runtime) >= runtime->oss.period_frames;
} }
static int snd_pcm_oss_capture_ready(snd_pcm_substream_t *substream) static int snd_pcm_oss_capture_ready(snd_pcm_substream_t *substream)
...@@ -2107,7 +2108,7 @@ static int snd_pcm_oss_capture_ready(snd_pcm_substream_t *substream) ...@@ -2107,7 +2108,7 @@ static int snd_pcm_oss_capture_ready(snd_pcm_substream_t *substream)
if (atomic_read(&runtime->mmap_count)) if (atomic_read(&runtime->mmap_count))
return runtime->oss.prev_hw_ptr_interrupt != runtime->hw_ptr_interrupt; return runtime->oss.prev_hw_ptr_interrupt != runtime->hw_ptr_interrupt;
else else
return snd_pcm_capture_ready(substream); return snd_pcm_capture_avail(runtime) >= runtime->oss.period_frames;
} }
static unsigned int snd_pcm_oss_poll(struct file *file, poll_table * wait) static unsigned int snd_pcm_oss_poll(struct file *file, poll_table * wait)
......
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