<p>74<br>
2014-11-16 下午8:31 於 "Peter Meerwald" <<a href="mailto:pmeerw@pmeerw.net">pmeerw@pmeerw.net</a>> 寫道:<br>
><br>
><br>
> > > as suggested by<br>
> > ><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84804">https://bugs.freedesktop.org/show_bug.cgi?id=84804</a><br>
> > ><br>
> > > Signed-off-by: Peter Meerwald <<a href="mailto:pmeerw@pmeerw.net">pmeerw@pmeerw.net</a>><br>
> > > ---<br>
> > >  src/modules/alsa/alsa-util.c | 15 +++++++++++++++<br>
> > >  1 file changed, 15 insertions(+)<br>
> > ><br>
> > > diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c<br>
> > > index 4131cff..e382d4f 100644<br>
> > > --- a/src/modules/alsa/alsa-util.c<br>
> > > +++ b/src/modules/alsa/alsa-util.c<br>
> > > @@ -183,6 +183,19 @@ static int set_buffer_size(snd_pcm_t *pcm_handle,<br>
> > snd_pcm_hw_params_t *hwparams,<br>
> > >      return 0;<br>
> > >  }<br>
> > ><br>
> > > +static void check_access(snd_pcm_t *pcm_handle, snd_pcm_hw_params_t<br>
> > *hwparams, bool use_mmap) {<br>
> > > +    if ((use_mmap && !snd_pcm_hw_params_test_access(pcm_handle,<br>
> > hwparams, SND_PCM_ACCESS_MMAP_INTERLEAVED)) ||<br>
> > > +        !snd_pcm_hw_params_test_access(pcm_handle, hwparams,<br>
> > SND_PCM_ACCESS_RW_INTERLEAVED))<br>
> > > +        pa_log_error("Weird, PCM claims to support interleaved access,<br>
> > but snd_pcm_hw_params_set_access() failed.");<br>
> ><br>
> > HW Params of device "hw:0,0":<br>
> > --------------------<br>
> > ACCESS:  MMAP_NONINTERLEAVED RW_NONINTERLEAVED<br>
> > FORMAT:  S32_LE<br>
> > SUBFORMAT:  STD<br>
> > SAMPLE_BITS: 32<br>
> > FRAME_BITS: [448 832]<br>
> > CHANNELS: [14 26]<br>
> > RATE: [32000 96000]<br>
> > PERIOD_TIME: (666 256000]<br>
> > PERIOD_SIZE: [64 8192]<br>
> > PERIOD_BYTES: [3584 851968]<br>
> > PERIODS: 2<br>
> > BUFFER_TIME: (1333 512000]<br>
> > BUFFER_SIZE: [128 16384]<br>
> > BUFFER_BYTES: [7168 1703936]<br>
> > TICK_TIME: ALL<br>
> ><br>
> > if use of test_access is to prevent set_access corrupt the configuration<br>
> > space of hw_param when access is not supported,<br>
><br>
> I am not sure if I understand your comment correctly<br>
><br>
> the idea of the patch is to improve the logging in case _INTERLEAVED is<br>
> not supported (but NONINTERLEAVED is)<br>
><br>
> I don't want to change the current behaviour in the normal case, hence<br>
> check_access() is called after trying to set the access method<br>
><br>
> what do you means with corruption of config space?<br>
><br>
If the application did not explicilty set_access</p>
<p>snd_pcm_hw_params()  choose the first supported access from the configuration space created by snd_pcm_hw_params_any() </p>
<p>this mean that if pulseaudio  use test_access to find the access is supported and set_access for those two non interleaved access types( i.e.  not set_access for any unsupported access type) the configuration space is left with mmap non interleaved, non interleaved or complex which are not supported by pulseaudio </p>
<p> snd_pcm_hw_params() will select first supported access from configuration space </p>
<p>mmap non interleaved for rme9652 </p>
<p>for example,</p>
<p>snd_output_stdio_attach(&log, stderr, 0);<br>
snd_pcm_hw_params_any(pars);<br>
snd_pcm_hw_params_dump(pars, log);<br>
snd_pcm_hw_params(pcm,pars);<br>
snd_pcm_dump(pcm, log)</p>
<p> the first supported access for snd-hda-intel which is mmap interleaved will be selected when the application did not explicitly set the access type<br>
</p>