[pulseaudio-discuss] {PATCH][RFC] AC3 passthrough support

pl bossart bossart.nospam at gmail.com
Mon Jul 12 14:08:44 PDT 2010


> 2. Replace: pa_sink_set_max_rewind(u->sink, u->hwbuf_size);      with:
>     if(strcmp(u->device_name, "a52") == 0) {
>         pa_sink_set_max_rewind(u->sink, 0);
>     } else {
>         pa_sink_set_max_rewind(u->sink, u->hwbuf_size);
>     }


NAK. This does not work for me. You need to rewind also in the thread context:

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 2995c3c..4059a9b 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -953,7 +953,12 @@ static int update_sw_params(struct userdata *u) {
     }

     pa_sink_set_max_request_within_thread(u->sink, u->hwbuf_size -
u->hwbuf_unused);
-    pa_sink_set_max_rewind_within_thread(u->sink, u->hwbuf_size);
+     if (pa_alsa_pcm_is_hw(u->pcm_handle))
+         pa_sink_set_max_rewind_within_thread(u->sink, u->hwbuf_size);
+    else {
+        pa_log("Disabling rewind_within_thread for device %s", u->device_name);
+        pa_sink_set_max_rewind_within_thread(u->sink, 0);
+    }

     return 0;
 }
@@ -1906,7 +1911,12 @@ pa_sink *pa_alsa_sink_new(pa_module *m,
pa_modargs *ma, const char*driver, pa_ca
                 (double) pa_bytes_to_usec(u->hwbuf_size, &ss) /
PA_USEC_PER_MSEC);

     pa_sink_set_max_request(u->sink, u->hwbuf_size);
-    pa_sink_set_max_rewind(u->sink, u->hwbuf_size);
+    if (pa_alsa_pcm_is_hw(u->pcm_handle))
+        pa_sink_set_max_rewind(u->sink, u->hwbuf_size);
+    else {
+        pa_log("Disabling rewind for device %s", u->device_name);
+        pa_sink_set_max_rewind(u->sink, 0);
+    }

     if (u->use_tsched) {
         u->tsched_watermark =
pa_usec_to_bytes_round_up(pa_bytes_to_usec_round_up(tsched_watermark,
&requested_ss), &u->sink->sample_spec);

pa_pcm_is_hw detects a52 but allows rewind for iec958. Looks like a
better fix than a hard-coded string compare.
Even with this fix, the sink doesn't seem to do anything:

D: alsa-sink.c: Requested to rewind 0 bytes.
D: alsa-sink.c: Mhmm, actually there is nothing to rewind.
D: protocol-native.c: Requesting rewind due to rewrite.
D: sink-input.c: Requesting rewind due to corking
D: alsa-sink.c: Requested to rewind 0 bytes.
D: alsa-sink.c: Mhmm, actually there is nothing to rewind.
D: module-suspend-on-idle.c: Sink
alsa_output.pci-0000_00_1b.0.iec958-ac3-surround-51 becomes idle,
timeout in 5 seconds.
D: alsa-sink.c: Requested to rewind 0 bytes.
D: module-suspend-on-idle.c: Sink
alsa_output.pci-0000_00_1b.0.iec958-ac3-surround-51 becomes idle,
timeout in 5 seconds.
D: alsa-sink.c: Mhmm, actually there is nothing to rewind.
D: protocol-dbus.c: Interface org.PulseAudio.Core1.Stream removed from
object /org/pulseaudio/core1/playback_stream0
I: sink-input.c: Freeing input 0 "Playback Stream"
I: client.c: Freed 5 "gst-launch-0.10"
I: protocol-native.c: Connection died.

You'll find my diffs against git master below:
- Pierre
-------------- next part --------------
A non-text attachment was scrubbed...
Name: masterdiff.patch
Type: application/octet-stream
Size: 1397 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20100712/799bce1c/attachment.obj>


More information about the pulseaudio-discuss mailing list