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

Michael Rans mcarans at yahoo.co.uk
Mon Jul 12 14:24:24 PDT 2010


Cool - I'm glad you got rid of the a52 string check hack.

I didn't have the line pa_sink_set_max_rewind_within_thread(u->sink, 
u->hwbuf_size);
I guess the version of Pulseaudio source code in Lucid is much older than yours?

Anyway I did have the line with pa_sink_set_max_request_within_thread so I added 
your lines below and didn't get any compile errors, so the function exists in my 
version, just wasn't used.

It still all works for me.

Cheers,
Mike





________________________________
From: pl bossart <bossart.nospam at gmail.com>
To: General PulseAudio Discussion <pulseaudio-discuss at mail.0pointer.de>
Sent: Mon, 12 July, 2010 22:08:44
Subject: Re: [pulseaudio-discuss] {PATCH][RFC] AC3 passthrough support

> 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 --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20100712/15bffe06/attachment.htm>


More information about the pulseaudio-discuss mailing list