[pulseaudio-discuss] Why tsched disabled when I use module-alsa-sink with 'mmap=0 tsched=1' parameters?

Raymond Yau superquad.vortex2 at gmail.com
Fri Jan 2 22:55:00 PST 2015


>>>
>>> Dear developers,
>>>
>>>
>>> I have question something about selecting logic between timer-based
>>> and IRQ scheduling.
>>>
>>> When I tried to load 'module-alsa-sink' with 'mmap=0 tsched=1'
>>> parameters, tsched(timer-based scheduling) becomes disabled by below
>>> codes.
>>>
>>> It seems tsched is allowed only mmap supported ALSA devices. Why
>>> tsched disabled while use non-mmap driven ALSA?
>>
>>
>> Because rewinding is not available in non-mmap mode. That is, it's not
>> possible to rewrite previously written data in non-mmap mode. In
>> timer-based scheduling mode PulseAudio uses bigger buffer size, which
>> causes problems if rewinding isn't available.
>
>
> Sorry, rewinding is actually available in non-mmap mode. And, pulseaudio
can rewind even without tsched (i.e., tsched == 0 does not imply max_rewind
== 0). So the reasoning must be different. But I don't know the answer.

http://cgit.freedesktop.org/pulseaudio/pulseaudio/log/src/modules/alsa?qt=grep&q=tsched

set latency range only in tsched mode

don't enabled tsched on software ALSA devices

pa_bool_t pa_alsa_pcm_is_hw(snd_pcm_t *pcm) {
+    snd_pcm_info_t* info;
+    snd_pcm_info_alloca(&info);
+
+    pa_assert(pcm);
+
+    if (snd_pcm_info(pcm, info) < 0)
+        return FALSE;
+
+    return snd_pcm_info_get_card(info) >= 0;

This patch seem strange since only those io plugin (e.g. a52) fail the
test, most plugins pass the above test

alsa: don't make use of tsched related variables when tsched is disabled

+    if (u->use_tsched) {
+        *sleep_usec = pa_bytes_to_usec(left_to_play,
&u->sink->sample_spec);

-    if (*sleep_usec > process_usec)
-        *sleep_usec -= process_usec;
-    else
+        if (*sleep_usec > process_usec)
+            *sleep_usec -= process_usec;
+        else
+            *sleep_usec = 0;
+    } else

Does it mean it won't sleep for a period time but polling continuosly when
timer scheduling is disabled

It need sound card report accurate hwptr position when  hwbuf_unused can
set  to non zero values
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20150103/e5baf832/attachment.html>


More information about the pulseaudio-discuss mailing list