poljar | 16 May 22:39
Picon

[PATCH] pactl: Added unloading modules by name

pactl should allow unloading modules by name.
pactl and the native protocol were expanded to handle names while
unloading modules.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=48289
---
 src/map-file                    |    3 ++-
 src/pulse/introspect.c          |   46 +++++++++++++++++++++++++++++++++++++--
 src/pulse/introspect.h          |    8 +++++--
 src/pulsecore/protocol-native.c |   29 ++++++++++++++++++++----
 src/utils/pactl.c               |   13 ++++++++---
 5 files changed, 87 insertions(+), 12 deletions(-)

diff --git a/src/map-file b/src/map-file
index 69cf25b..82fdd06 100644
--- a/src/map-file
+++ b/src/map-file
@@ -113,7 +113,8 @@ pa_context_suspend_sink_by_index;
 pa_context_suspend_sink_by_name;
 pa_context_suspend_source_by_index;
 pa_context_suspend_source_by_name;
-pa_context_unload_module;
+pa_context_unload_module_by_index;
+pa_context_unload_module_by_name;
 pa_context_unref;
 pa_cvolume_avg;
 pa_cvolume_avg_mask;
diff --git a/src/pulse/introspect.c b/src/pulse/introspect.c
index 38a9d1c..332733b 100644
--- a/src/pulse/introspect.c
(Continue reading)

rong deng | 16 May 17:01
Picon

about log level configuration

Hi list,


I'm implementing 'category' feature in pulseaudio, the 'category' feature mimics the feature in gstreamer, i.e. we can use something like 'ENV_LOG_DEBUG=loopback:5 pulseaudio' to setup the level of module loopback to 5.

During my implementation, I found there's already an environment variable called 'ENV_LOG_LEVEL' used, then my question is how to setup the log level when both 'ENV_LOG_LEVEL' is set and 'ENV_LOG_DEBUG=*:4' is set? I'm afraid we can deprecate the usage of the original 'ENV_LOG_DEBUG' and advocate users to use the new one. How's the community's take on this one?

Any thoughts are welcome.

--deng
_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Frédéric Danis | 14 May 16:21
Picon

[PATCH] bluetooth: Fix crash on disconnection

When a Bluetooth headset is connected only to HFP profile (not connected
to A2DP) and host streams to it, a crash occurs if host disconnects.

When HFP disconnects, audio thread will fail on POLLHUP then generate
a message to set PA profile to Off before ending.
If this message is managed before PA unload bluetooth device module,
all works fine.
But, if this message is managed during module unload, this finish by
re-entrance in release code (stop_thread) and a crash.

This fix prevents to send the profile change when module is unloading.

Following are crash traces:

D: [pulseaudio] module-suspend-on-idle.c: Sink bluez_sink.10_04_14_D1_96_1C becomes busy.
D: [pulseaudio] bluetooth-util.c: dbus: interface=org.bluez.MediaTransport,
path=/org/bluez/7555/hci0/dev_10_04_14_D1_96_1C/fd20, member=PropertyChanged
D: [pulseaudio] module-console-kit.c: dbus: interface=org.bluez.MediaTransport,
path=/org/bluez/7555/hci0/dev_10_04_14_D1_96_1C/fd20, member=PropertyChanged
D: [pulseaudio] module-bluetooth-device.c: dbus: interface=org.bluez.MediaTransport,
path=/org/bluez/7555/hci0/dev_10_04_14_D1_96_1C/fd20, member=PropertyChanged
D: [pulseaudio] bluetooth-util.c: dbus: interface=org.bluez.MediaTransport,
path=/org/bluez/7555/hci0/dev_10_04_14_D1_96_1C/fd20, member=PropertyChanged
D: [pulseaudio] module-console-kit.c: dbus: interface=org.bluez.MediaTransport,
path=/org/bluez/7555/hci0/dev_10_04_14_D1_96_1C/fd20, member=PropertyChanged
D: [pulseaudio] module-bluetooth-device.c: dbus: interface=org.bluez.MediaTransport,
path=/org/bluez/7555/hci0/dev_10_04_14_D1_96_1C/fd20, member=PropertyChanged
I: [pulseaudio] module-suspend-on-idle.c: Source bluez_source.10_04_14_D1_96_1C idle for too long,
suspending ...
D: [pulseaudio] source.c: Suspend cause of source bluez_source.10_04_14_D1_96_1C is 0x0004, suspending
D: [pulseaudio] bluetooth-util.c: dbus: interface=org.bluez.Headset,
path=/org/bluez/7555/hci0/dev_10_04_14_D1_96_1C, member=PropertyChanged
D: [pulseaudio] bluetooth-util.c: dbus: property 'State' changed to value 'disconnected'
D: [pulseaudio] module-console-kit.c: dbus: interface=org.bluez.Headset,
path=/org/bluez/7555/hci0/dev_10_04_14_D1_96_1C, member=PropertyChanged
D: [pulseaudio] module-bluetooth-device.c: dbus: interface=org.bluez.Headset,
path=/org/bluez/7555/hci0/dev_10_04_14_D1_96_1C, member=PropertyChanged
D: [pulseaudio] bluetooth-util.c: dbus: interface=org.bluez.Headset,
path=/org/bluez/7555/hci0/dev_10_04_14_D1_96_1C, member=PropertyChanged
D: [pulseaudio] module-console-kit.c: dbus: interface=org.bluez.Headset,
path=/org/bluez/7555/hci0/dev_10_04_14_D1_96_1C, member=PropertyChanged
D: [pulseaudio] module-bluetooth-device.c: dbus: interface=org.bluez.Headset,
path=/org/bluez/7555/hci0/dev_10_04_14_D1_96_1C, member=PropertyChanged
D: [pulseaudio] bluetooth-util.c: dbus: interface=org.bluez.Audio,
path=/org/bluez/7555/hci0/dev_10_04_14_D1_96_1C, member=PropertyChanged
D: [pulseaudio] bluetooth-util.c: dbus: property 'State' changed to value 'disconnected'
D: [pulseaudio] module-bluetooth-discover.c: Unloading module for /org/bluez/7555/hci0/dev_10_04_14_D1_96_1C
D: [pulseaudio] module-console-kit.c: dbus: interface=org.bluez.Audio,
path=/org/bluez/7555/hci0/dev_10_04_14_D1_96_1C, member=PropertyChanged
D: [pulseaudio] module-bluetooth-device.c: dbus: interface=org.bluez.Audio,
path=/org/bluez/7555/hci0/dev_10_04_14_D1_96_1C, member=PropertyChanged
I: [pulseaudio] module.c: Unloading "module-bluetooth-device" (index: #19).
D: [pulseaudio] module-suspend-on-idle.c: Sink bluez_sink.10_04_14_D1_96_1C becomes idle, timeout
in 5 seconds.
I: [bluetooth] module-bluetooth-device.c: FD error: POLLHUP
D: [bluetooth] module-bluetooth-device.c: IO thread failed
D: [bluetooth] sink-input.c: Have to rewind 2130 bytes on render memblockq.
D: [bluetooth] sink-input.c: Have to rewind 11742 bytes on implementor.
D: [bluetooth] sink.c: Requesting rewind due to started move
D: [pulseaudio] module-suspend-on-idle.c: Sink bluez_sink.10_04_14_D1_96_1C becomes idle, timeout
in 5 seconds.
I: [pulseaudio] sink-input.c: Trying to change sample rate
I: [pulseaudio] alsa-sink.c: Updating rate for device front:0, new rate is 44100
I: [pulseaudio] sink.c: Changed sampling rate successfully
I: [pulseaudio] sink-input.c: Rate changed to 44100 Hz
I: [pulseaudio] protocol-native.c: Requested tlength=200,00 ms, minreq=10,00 ms
D: [pulseaudio] protocol-native.c: Adjust latency mode enabled, configuring sink latency to half of
overall latency.
D: [pulseaudio] protocol-native.c: Requested latency=90,00 ms, Received latency=90,00 ms
I: [pulseaudio] resampler.c: Forcing resampler 'copy', because of fixed, identical sample rates.
D: [pulseaudio] resampler.c: Channel matrix:
D: [pulseaudio] resampler.c:        I00
D: [pulseaudio] resampler.c:     +------
D: [pulseaudio] resampler.c: O00 | 1,000
D: [pulseaudio] resampler.c: O01 | 1,000
I: [pulseaudio] remap_sse.c: Using SSE mono to stereo remapping
I: [pulseaudio] resampler.c: Using resampler 'copy'
I: [pulseaudio] resampler.c: Using s16le as working format.
D: [pulseaudio] memblockq.c: memblockq requested: maxlength=33554432, tlength=0, base=4, prebuf=0,
minreq=1 maxrewind=0
D: [pulseaudio] memblockq.c: memblockq sanitized: maxlength=33554432, tlength=33554432, base=4,
prebuf=0, minreq=4 maxrewind=0
D: [pulseaudio] sink-input.c: Updated resampler for sink input 0
D: [alsa-sink] sink.c: Requesting rewind due to finished move
D: [alsa-sink] alsa-sink.c: Requested volume: 0:  27% 1:  27%
D: [alsa-sink] alsa-sink.c:            in dB: 0: -33,76 dB 1: -33,76 dB
D: [alsa-sink] alsa-sink.c: Got hardware volume: 0:  27% 1:  27%
D: [alsa-sink] alsa-sink.c:               in dB: 0: -33,75 dB 1: -33,75 dB
D: [alsa-sink] alsa-sink.c: Calculated software volume: 0: 100% 1: 100% (accurate-enough=yes)
D: [alsa-sink] alsa-sink.c:                      in dB: 0: -0,01 dB 1: -0,01 dB
D: [alsa-sink] sink.c: Volume not changing
D: [pulseaudio] sink-input.c: Successfully moved sink input 0 to alsa_output.pci-0000_00_1b.0.analog-stereo.
D: [pulseaudio] sink.c: Suspend cause of sink alsa_output.pci-0000_00_1b.0.analog-stereo is 0x0000, resuming
I: [alsa-sink] alsa-sink.c: Trying resume...
I: [alsa-sink] alsa-util.c: Trying to disable ALSA period wakeups, using timers only
D: [alsa-sink] alsa-util.c: Maximum hw buffer size is 371 ms
D: [alsa-sink] alsa-util.c: Set buffer size first (to 16384 samples), period size second (to 8192 samples).
I: [alsa-sink] alsa-util.c: ALSA period wakeups disabled
D: [alsa-sink] alsa-sink.c: Latency set to 90,00ms
D: [alsa-sink] alsa-sink.c: hwbuf_unused=49660
D: [alsa-sink] alsa-sink.c: setting avail_min=15503
I: [alsa-sink] alsa-sink.c: Time scheduling watermark is 20,00ms
I: [alsa-sink] alsa-sink.c: Resumed successfully...
I: [alsa-sink] alsa-sink.c: Starting playback.
D: [alsa-sink] alsa-sink.c: Cutting sleep time for the initial iterations by half.
D: [alsa-sink] alsa-sink.c: Cutting sleep time for the initial iterations by half.
D: [alsa-sink] alsa-sink.c: Cutting sleep time for the initial iterations by half.
D: [pulseaudio] module-suspend-on-idle.c: Sink alsa_output.pci-0000_00_1b.0.analog-stereo
becomes busy.
I: [pulseaudio] module-rescue-streams.c: Successfully moved sink input 0 "Rhythmbox" to alsa_output.pci-0000_00_1b.0.analog-stereo.
D: [pulseaudio] module-rescue-streams.c: No source outputs to move away.
D: [pulseaudio] core-subscribe.c: Dropped redundant event due to remove event.
D: [pulseaudio] module-rescue-streams.c: No source outputs to move away.
D: [bluetooth] module-bluetooth-device.c: IO thread shutting down
[Thread 0x7fffe4e9d700 (LWP 6943) exited]
I: [pulseaudio] sink.c: Freeing sink 1 "bluez_sink.10_04_14_D1_96_1C"
I: [pulseaudio] source.c: Freeing source 2 "bluez_sink.10_04_14_D1_96_1C.monitor"
I: [pulseaudio] source.c: Freeing source 3 "bluez_source.10_04_14_D1_96_1C"

Breakpoint 1, pa_thread_mq_done (q=0x728950) at pulsecore/thread-mq.c:98
98	    pa_assert(q);
(gdb) print *q
$1 = {mainloop = 0x640be8, inq = 0x712ba0, outq = 0x66d7a0, read_event = 0x6e27d0, write_event = 0x728e00}
(gdb) bt
#0  pa_thread_mq_done (q=0x728950) at pulsecore/thread-mq.c:98
#1  0x00007fffed93a3cc in stop_thread (u=0x7288f0) at modules/bluetooth/module-bluetooth-device.c:2560
#2  0x00007fffed93c65a in module_bluetooth_device_LTX_pa__done (m=0x727300) at modules/bluetooth/module-bluetooth-device.c:3098
#3  0x00007fffed6abb80 in pa_module_free (m=0x727300) at pulsecore/module.c:162
#4  0x00007fffed6abd66 in pa_module_unload (c=0x640d50, m=0x727300, force=true) at pulsecore/module.c:188
#5  0x00007fffed6abff1 in defer_cb (api=0x640be8, e=0x689b30, userdata=0x640d50) at pulsecore/module.c:228
#6  0x00007fffed1d7559 in dispatch_defer (m=0x640b90) at pulse/mainloop.c:702
#7  0x00007fffed1d8195 in pa_mainloop_dispatch (m=0x640b90) at pulse/mainloop.c:918
#8  0x00007fffed1d8361 in pa_mainloop_iterate (m=0x640b90, block=1, retval=0x7fffffffddb8) at pulse/mainloop.c:958
#9  0x00007fffed1d83bf in pa_mainloop_run (m=0x640b90, retval=0x7fffffffddb8) at pulse/mainloop.c:973
#10 0x0000000000422c5a in main (argc=4, argv=0x7fffffffdfe8) at daemon/main.c:1135
(gdb) c
Continuing.
D: [pulseaudio] module-bluetooth-device.c: Switch profile to off requested

Breakpoint 1, pa_thread_mq_done (q=0x728950) at pulsecore/thread-mq.c:98
98	    pa_assert(q);
(gdb) print *q
$2 = {mainloop = 0x640be8, inq = 0x712ba0, outq = 0x66d7a0, read_event = 0x6e27d0, write_event = 0x728e00}
(gdb) bt
#0  pa_thread_mq_done (q=0x728950) at pulsecore/thread-mq.c:98
#1  0x00007fffed93a3cc in stop_thread (u=0x7288f0) at modules/bluetooth/module-bluetooth-device.c:2560
#2  0x00007fffed93af09 in card_set_profile (c=0x70e7e0, new_profile=0x7141b0) at modules/bluetooth/module-bluetooth-device.c:2700
#3  0x00007fffed6a2a2b in pa_card_set_profile (c=0x70e7e0, name=0x7fffed93d8b1 "off", save=false)
at pulsecore/card.c:242
#4  0x00007fffed93471d in device_process_msg (obj=0x728240, code=0, data=0x7fffed93d8b1, offset=0,
chunk=0x0) at modules/bluetooth/module-bluetooth-device.c:1143
#5  0x00007fffed6923ce in pa_asyncmsgq_dispatch (object=0x728240, code=0,
userdata=0x7fffed93d8b1, offset=0, memchunk=0x7fffffffd990) at pulsecore/asyncmsgq.c:322
#6  0x00007fffed6924d4 in pa_asyncmsgq_flush (a=0x66d7a0, run=true) at pulsecore/asyncmsgq.c:347
#7  0x00007fffed6f9c15 in pa_thread_mq_done (q=0x728950) at pulsecore/thread-mq.c:107
#8  0x00007fffed93a3cc in stop_thread (u=0x7288f0) at modules/bluetooth/module-bluetooth-device.c:2560
#9  0x00007fffed93c65a in module_bluetooth_device_LTX_pa__done (m=0x727300) at modules/bluetooth/module-bluetooth-device.c:3098
#10 0x00007fffed6abb80 in pa_module_free (m=0x727300) at pulsecore/module.c:162
#11 0x00007fffed6abd66 in pa_module_unload (c=0x640d50, m=0x727300, force=true) at pulsecore/module.c:188
#12 0x00007fffed6abff1 in defer_cb (api=0x640be8, e=0x689b30, userdata=0x640d50) at pulsecore/module.c:228
#13 0x00007fffed1d7559 in dispatch_defer (m=0x640b90) at pulse/mainloop.c:702
#14 0x00007fffed1d8195 in pa_mainloop_dispatch (m=0x640b90) at pulse/mainloop.c:918
#15 0x00007fffed1d8361 in pa_mainloop_iterate (m=0x640b90, block=1, retval=0x7fffffffddb8) at pulse/mainloop.c:958
#16 0x00007fffed1d83bf in pa_mainloop_run (m=0x640b90, retval=0x7fffffffddb8) at pulse/mainloop.c:973
#17 0x0000000000422c5a in main (argc=4, argv=0x7fffffffdfe8) at daemon/main.c:1135
(gdb) c
Continuing.
D: [pulseaudio] module-bluetooth-device.c: Releasing transport /org/bluez/7555/hci0/dev_10_04_14_D1_96_1C/fd19
E: [pulseaudio] bluetooth-util.c: Failed to release transport
/org/bluez/7555/hci0/dev_10_04_14_D1_96_1C/fd19: Method "Release" with signature "s" on
interface "org.bluez.MediaTransport" doesn't exist
bt_audio_service_open: connect() failed: Connection refused (111)
W: [pulseaudio] module-bluetooth-device.c: Bluetooth audio service not available
I: [pulseaudio] card.c: Changed profile of card 1 "bluez_card.10_04_14_D1_96_1C" to off

Program received signal SIGSEGV, Segmentation fault.
0x00007fffed6f9c1c in pa_thread_mq_done (q=0x728950) at pulsecore/thread-mq.c:109
109	    q->mainloop->io_free(q->read_event);
(gdb) print *q
$3 = {mainloop = 0x0, inq = 0x0, outq = 0x0, read_event = 0x0, write_event = 0x0}
(gdb) bt
#0  0x00007fffed6f9c1c in pa_thread_mq_done (q=0x728950) at pulsecore/thread-mq.c:109
#1  0x00007fffed93a3cc in stop_thread (u=0x7288f0) at modules/bluetooth/module-bluetooth-device.c:2560
#2  0x00007fffed93c65a in module_bluetooth_device_LTX_pa__done (m=0x727300) at modules/bluetooth/module-bluetooth-device.c:3098
#3  0x00007fffed6abb80 in pa_module_free (m=0x727300) at pulsecore/module.c:162
#4  0x00007fffed6abd66 in pa_module_unload (c=0x640d50, m=0x727300, force=true) at pulsecore/module.c:188
#5  0x00007fffed6abff1 in defer_cb (api=0x640be8, e=0x689b30, userdata=0x640d50) at pulsecore/module.c:228
#6  0x00007fffed1d7559 in dispatch_defer (m=0x640b90) at pulse/mainloop.c:702
#7  0x00007fffed1d8195 in pa_mainloop_dispatch (m=0x640b90) at pulse/mainloop.c:918
#8  0x00007fffed1d8361 in pa_mainloop_iterate (m=0x640b90, block=1, retval=0x7fffffffddb8) at pulse/mainloop.c:958
#9  0x00007fffed1d83bf in pa_mainloop_run (m=0x640b90, retval=0x7fffffffddb8) at pulse/mainloop.c:973
#10 0x0000000000422c5a in main (argc=4, argv=0x7fffffffdfe8) at daemon/main.c:1135
(gdb)
---
 src/modules/bluetooth/module-bluetooth-device.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index b7945ed..97e5944 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -1750,7 +1750,8 @@ static void thread_func(void *userdata) {
 fail:
     /* If this was no regular exit from the loop we have to continue processing messages until we receive
PA_MESSAGE_SHUTDOWN */
     pa_log_debug("IO thread failed");
-    pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(u->msg),
BLUETOOTH_MESSAGE_SET_PROFILE, "off", 0, NULL, NULL);
+    if (!u->module->unload_requested)
+        pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(u->msg),
BLUETOOTH_MESSAGE_SET_PROFILE, "off", 0, NULL, NULL);
     pa_asyncmsgq_wait_for(u->thread_mq.inq, PA_MESSAGE_SHUTDOWN);

 finish:
--

-- 
1.7.9.5
Stanisław Pitucha | 12 May 23:37
Picon
Gravatar

Delays and strange transfer rate on network playback

Hi all,
I'm trying to setup my xubuntu machine to play through the speakers
connected to TonidoPlug via some no-brand usb sound card. This mostly
works, but I have some issues I'd like to correct if there's a way to
do that. Right now means:
- I can play music from banshee without any issues
- I can play sound from a movie from mplayer with slight buffering
issue which doesn't bother me much (video slows down, audio seems to
start after a moment, then video catches up and they continue in sync
- all happens within the first second or two of playback, then
everything's fine)

What I have problems with is sound from browser / flash playing an mp4
file. While it works, it's really jittery and actually the jitter
affects also the video playback. I'd blame flash normally, but if I
switch the output during playback from remote pulseaudio to the local
one, it starts working smoothly again. Also changing fragment settings
from 4 / 25 to:
default-fragments = 8
default-fragment-size-msec = 5
made the playback slightly closer to what it should be (it's
constantly slightly skipping tiny bits, instead of having longer
play/pause fragments that I can hear) - I guess the values are fine
since I'm doing that on the local network anyway.

First potential issue I've noticed is that the destination system
doesn't seem to support any high-precision timers:
"pulseaudio[1962]: alsa-util.c: Disabling timer-based scheduling
because high-resolution timers are not available from the kernel."
But since mplayer can manage without much issues, I'd expect the sound
from flash to be comparable.

Second strange thing I noticed was when I had a quick look at the
actual transfer on the network. Wireshark claims that I'm sending
about 250kBps+ while playing sound. For a two channel playback... This
doesn't seem right. Even with default sampling of 44kHz * 2ch * 2B ==
176kBps of raw data. Even with protocol overhead I wouldn't expect
this to go over 200kBps. Transfer seems to have an uneven pattern of
7+ packets of max MTU (1500), then about the same number of short
60-70 bytes ones. Without much knowledge of the protocol, I can't say
if that's correct, but it definitely doesn't look healthy... - just
thought it's worth mentioning in case it indicates some real issue.

Is there something specific I should check? Anything I could try that
may improve playback from flash? Thanks for any ideas.

Client side pulseaudio: 1.1-0ubuntu15
Server side pulseaudio: 0.9.21-3+squeeze1 (this one I can't easily
update unfortunately), playing into alsa via snd-usb-audio.
Using the module-native-protocol-tcp module + discovery via zeroconf.

I added also resample-method = trivial in case it could reduce the
processing time - I don't think it had any effect.

--

-- 
KTHXBYE,

Stanisław Pitucha
_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Favonia | 12 May 13:59
Picon
Gravatar

Clean-up callbacks for pa_operation's

Dear all,

Recently my friends and I are developing a high-level interface for
PulseAudio in Haskell. Our goal is to make it callback-free but still
asynchronous. However we encountered a design issue that makes the
wrapper quite clumsy. Fortunately we believe this can be solved with
some help from libpulse.

The issue is that we need to clean up some resources when an operation
fails or is canceled. Currently one can only attach a callback to an
operation that will be called when it successes; unfortunately we need
more than that. A particular use case is that when a connection is
interrupted we need to clean up all the resources corresponding to
pending operations. In order to do so, we need to keep essentially a
copy of context->operations within our wrapper. Things would have be
more elegant if we could set up callbacks for failure and/or cancellation
as well.

We understand that this would probably lead to an API change so we
might have to keep the current clumsy design. Nonetheless we hope
this can be taken into consideration at least for the next API revision.

Thanks,
Favonia

PS: Our code is at https://github.com/favonia/pulse but it's not
working yet, sorry.
cee1 | 12 May 09:16
Picon

Adjust volume may cause audio playback corruption

Hi all,

We're using PA on our product, and sometimes audio playback may
corrupt after adjusting volume.

We found a way to (relatively) easily reproduce the problem:
1. Play sample.mp3 through totem in repeat mode.
2. In gnome-volume-control, Hardware tap, repeat to shift between "Off
profile" and "Analog Stereo Duplex profile".

When the problem happens, the corruption continues until I:
* Do one more shift between "Off profile" and "Analog Stereo Duplex profile".
* Close totem (close all PA playback clients).
* Adjust volume.

When the problem happens, open another PA client doing audio playback,
is also corrupt.

Some additional information:
* Output of alsa-info.sh on our product:
http://dev.lemote.com/files/upload/software/PA-apc/alsa-info-lemote
* PA daemon log:
http://dev.lemote.com/files/upload/software/PA-apc/pulseaudio.log
* The corrupted sound:
http://dev.lemote.com/files/upload/software/PA-apc/corrupted_sound.ogg
* The sample mp3: http://dev.lemote.com/files/upload/software/PA-apc/sample.mp3

We've tried PA 1.0-0ubuntu3, 1.1-0ubuntu15 and 2.0, the problem continues.

The problem can also be reproduced on an AMD turion 64 x2 board with
ubuntu 10.10 and ubuntu 12.04:
* Output of alsa-info:
  ubuntu 10.10(32bit)
http://dev.lemote.com/files/upload/software/PA-apc/alsa-info-ubuntu-10.10
  ubuntu 12.04(32bit)
http://dev.lemote.com/files/upload/software/PA-apc/alsa-info-ubuntu-12.04

Note:
* The AMD turion 64 x2 board uses the same chipset as our product.
* gnome-volume-control is removed in ubuntu 12.04, thus we compiled
it: http://dev.lemote.com/files/upload/software/PA-apc/gnome-volume-control

Any idea?

--

-- 
Regards,

- cee1
Dave Horoschak | 12 May 01:21

Streaming between two WinXP machines

It looks like my PulseAudio installation is working despite the couple of errors I'm getting.  I couldn't find any specific information about streaming TCP between two Windows machines, so I pieced the following information together from some other FAQ's...

 

On the server machine (mic input) I have the following default.pa:

 

load-module module-native-protocol-tcp listen=0.0.0.0 auth-anonymous=1

load-module module-waveout

 

client.conf is blank.

 

On the client machine (audio out) I have the following default.pa:

 

load-module module-waveout

 

and client.conf:

 

default-server = X.X.X.X (the IP of the server machine)

 

I run pulseaudio on both (with no parameters) and they execute (with the errors mentioned above), but they don't seem connected.  Am I doing something wrong or do I need more configuration somewhere?

 

Thanks.

  - Dave 

_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Arun Raghavan | 11 May 17:09
Picon

[ANNOUNCE] PulseAudio 2.0

Hello,
Continuing the series of shockers, we've made another release! There's
nothing very surprising since 1.99.2 -- just a bunch of bug fixes and
documentation updates. Full release notes can be found at:

http://www.freedesktop.org/wiki/Software/PulseAudio/Notes/2.0

As usual, tarballs are at:

http://freedesktop.org/software/pulseaudio/releases/pulseaudio-2.0.tar.xz
MD5:  9bbde657c353fe675c3b693054175a8e
SHA1: a999d2cd8044651c8bd610079bb74eab808484bf

Packagers might want to note a few things. Firstly, the 1.99.2 tarballs
have been moved away since the soname bump and tag for those didn't
actually make it to master by accident. They're in a bad/ subdirectory
of the releases directory for historical purposes, though. The release
notes page lists new dependencies and other packaging notes.

Shortlog follows for those who don't want to go all the way to the
release notes. :)

Cheers and a good weekend of shiny audio bling to you all! :)
Arun

---- git shortlog ----

Alexander E. Patrakov (1):
      alsa: add DTS profile

Antti-Ville Jansson (1):
      stream: Fix upload samples' cleanup

Arun Raghavan (97):
      extended: Fix doxygen comment style typos
      sink,source: Avoid unnecessary call to pa_rtclock_now()
      alsa: Give compressed formats preference over PCM
      alsa: Better error handling in mixer rtpoll callback
      echo-cancel: Fail if loaded between a sink and its monitor
      alsa: Make mixer error handling more robust still
      echo-cancel: Add a standalone test program
      echo-cancel: Remove redundant variable
      echo-cancel: Don't crash if adjust_time = 0
      echo-cancel: Increase threshold for resyncing, make it configurable
      echo-cancel: Skip canceller when no source outputs are connected
      echo-cancel: Skip processing till there's enough data
      echo-cancel: Drop sink/source samples before processing begins
      namereg: Don't set default sink/source on get()
      echo-cancel: Close debug files on module unload
      echo-cancel: Don't process if sink is unconnected
      filter-apply: Move sink/source unlink callbacks before m-s-r
      build-sys: Drop libsamplerate from pulsecommon deps
      echo-cancel: Simplify checking if AEC is active
      macro: typedef pa_bool_t to bool instead of _Bool
      echo-cancel: Add the WebRTC echo canceller
      build-sys: Minor CXXFLAGS fix
      source: Bring rate update code in sync with sink code
      sink,source: Add the ability to disable alternat sample rate switching
      sink,source: Handle equal default and alternate sample rates
      alsa: Remove unused variable
      alsa: Probe sink/source sample rates
      sink,source: Account for corked streams in update_rate()
      native: Fix Solaris build
      solaris: Use real_volume for set/get volume
      gitignore: Update for recent additions
      doc: Correct intended roles property documentation
      core: Add a string list membership check function
      echo-cancel: Plug in WebRTC drift compensation
      echo-cancel: Adapt test code for drift compensation
      doc: Fix some old 0pointer.de references
      echo-cancel: Fix webrtc gain control initialisation
      cli: Add a dump-volumes command
      sink,source: Fix corked stream handling in update_rate()
      sink-input,source-output: Add an update_rate() function
      sink,source: Allow sample rate switching with corked streams
      sink,source: Update sample rate if possible on stream uncork
      echo-cancel: Add infrastructure for cancellers to do AGC
      echo-cancel: Hook up WebRTC analog gain control
      echo-cancel: Turn WebRTC analog gain control on by default
      echo-cancel: Make WebRTC the default canceller
      core: Make debugging a bit simpler
      tests: Add playback tests to check-daemon
      alsa: Minor debug code cleanup
      core: Look up /etc/machine-id if D-Bus machine-id is not found
      echo-cancel: Use speex by default if webrtc isn't available
      echo-cancel: Use more human-friendly descriptions
      filters: Fix the master source/sink when autoloaded
      filters: Allow a filter to have both sink and source
      proplist: Add internal API to get stream group
      filters: Handle echo-cancel streams better
      echo-cancel: Fix warning for undefined HAVE_WEBRTC
      build-sys: Fix building without NLS
      build-sys: Use absolute path for map-file while linking
      mime: Move assert to correct position
      iochannel: Handle missing un.h correctly
      utils: Fixes for building without NLS
      utils: Typo fixes in qpaeq
      resampler: Remove invalid channel asserts in peak and trivial
      resampler: Move some peak resampler asserts around
      protocol-native: Fix 'auth-group-enabled' modarg
      x11: Fix build without NLS support
      build-sys: Fix map-file check
      build-sys: Fix po/ build with --disable-nls
      build-sys: Make esound bits optional
      doc: Clarify pa_stream_get_latency() return value
      daemon: Fix *-idle-time arguments
      daemon: Drop --module-idle-time from docs
      orc: Trivial documentation typo fix
      orc: Another trivial documentation fix
      alsa-mixer: Turn off the IEC958 element for analog outputs
      stream: Clarify the sign of error return codes
      alsa-mixer: Fix mixer path for AC3 profiles
      format: Add "since 1.0" documentation tags where they were missing
      loopback: Trivial whitespace fix
      sink-input,source-output: Handle devices going away in unlink hooks
      pacmd: Fix compiler warning
      build: Fix out-of-tree build
      format: Export pa_format_info int and string property getters
      format: Don't assert on errors in getters
      format: Expose pa_format_info<->pa_sample_spec conversion functions
      format: Add more property getters
      format: Update map-file
      format: Trivial reorganisation
      format: Add API to query a property's type
      format: Allow format->sample spec conversion for compressed formats
      build-sys: Bump soname
      protocol-native: Reinstate assert that was incorrectly removed
      protocol-native: Remove redundant asserts
      stream: Fix sample spec initialisation for extended API
      bluetooth: Fix crash due to usage of pa_bool_t instead of dbus_bool_t
      build-sys: Bump soname

Colin Guthrie (20):
      libpulse: Always return a three part version number in API calls.
      build-sys: Provide a simple CMake Config setup (similar to pkgconfig)
      Update LICENSE.
      conf: Use .nofail when loading module-jackdbus-detect
      role-cork: Rename module-cork-music-on-phone to module-role-cork.
      role-cork: Make module-role-cork more generic.
      role-cork: Allow module-role-cork to act globally.
      pulsecore: Fix issue with circuilar definitions.
      x11: Drop unneeded 'struct' and use the typedef directly.
      device-port: Remove redundant include after the better circular dep fix.
      i18n: Fudge translations after previous commit to avoid mixing English/localized phrases.
      i18n: Do not translate strings that cannot have any sensible translations.
      i18n: Run make update-po
      cli: Ensure source output volumes are printed via cli interface (pacmd ls)
      bluetooth: Run update-sbc
      core-util: Attempt to make runtime paths smaller to avoid 108 char limit.
      Revert "resamplers: Optimize trivial resampler"
      man: Document the cli inteface a little.
      cli: Allow source-output volumes/mute to be set via CLI
      alsa: Add the DTS/DCA mapping to extra-hdmi.conf too.

Daniel Mack (2):
      osx: don't build the once-test binary on OS X
      osx: module_bonjour_publish needs to be linked against libprotocol-native.la

David Henningsson (46):
      module-jackdbus-detect: Avoid double-free of modargs
      source-output: Do not use unset channel map in pa_source_output_new
      Fix deferred volume not being applied if sink is closed
      Introduce "available" concept for ports, and communicate that to clients. Bump protocol version to 24.
      Turn device ports into reference counted objects
      Cards now has ports directly, and device port has list of profiles
      Notify port available status changes, and update protocol version
      cli: Show card ports and jack detection status
      alsa: Ignore the virtual "thinkpad-acpi" card
      alsa: add card ports and path probe cache
      Fixup a few things in the new path probing
      pactl: Show port availability
      device-port: Add a property list to ports.
      alsa-mixer: When selecting an input, turn off boosts of other inputs
      alsa-mixer: Refactor pa_alsa_profile_set_probe().
      alsa: Fix log message "synchronous volume" -> "deferred volume"
      alsa-mixer: Allow speaker port to control "Front Speaker"
      alsa: Improve "well known descriptions" for ports
      alsa-mixer: Make sure unsupported paths are removed after probing
      alsa-mixer: Take override-maps into account in subset elimination
      sample-util: Fix "Darth Vader" panning bug
      alsa-mixer: Don't use dangling pointers as port hashmap keys
      PROTOCOL: Fix documentation for version 22
      tunnel: fixup create_record_stream
      flist: Avoid the ABA problem
      alsa: Jack detection kcontrol implementation
      alsa: Add port information to HDMI profiles
      Add a new module switch-on-port-available that acts on port changes
      conf: Load switch-on-port-available module by default
      introspect: Expose port info per card to clients
      alsa-mixer: Make speaker get available=no when headphones are plugged in
      alsa-mixer: Don't remove paths if jacks state.(un)plugged differ
      daemon: Initialize dbus to use thread-safe mode by default
      protocol-native: Protect against clients trying to set a NULL port
      module-loopback: Never call adjust_rates after teardown
      module-switch-on-port-available: Do not switch profile if current port is available
      pactl: show availability information for "list cards"
      build-sys: padsp target should not be phony
      alsa-mixer: Show HDMI ports for older Nvidia cards
      alsa-mixer: Fix a small issue when detecting required-any
      Fix input device for M-audio fasttrack pro
      sink-input/source-output: Prevent filter sink/source cycles
      module-loopback: Reset process_msg callbacks in teardown
      alsa-sink/source: Really set volumes on port change
      alsa-sink/source: Make sure volumes are synchronised after fast user switching
      sink/source.h: Clarify set_port comment

Deng Zhenrong (1):
      fix compilation warning via PRI prefix

Dylan Reid (1):
      alsa: Set return code before printing it.

Frédéric Dalleau (9):
      bluetooth: Fix Media Endpoint for HandsfreeGateway
      bluetooth: Do not unload module-bluetooth-device on ERR or HUP
      bluetooth: Release MediaEnpoint if card profile is set to Off
      bluetooth: Set off profile on SCO disconnect
      bluetooth: Set hfgw profile when HandsfreeGateway is playing
      bluetooth: Use static string in DBUS signal handler description
      bluetooth: Remove match for org.bluez.MediaTransport.PropertyChanged
      loopback: Fix crash when moving sink-input fails
      loopback: Fix crash on error during init

Giorgos Boutsioukis (1):
      xen: Add Xen paravirtualized sink support.

Johan Hedberg (1):
      bluetooth: sbc: Reduce for-loop induced indentation in sbc_unpack_frame

Lars R. Damerow (3):
      alsa: support fixed latency range in alsa modules
      alsa: fixed latency range handling for udev-detect
      alsa: fixed_latency_range modarg for module-alsa-card

Lennart Poettering (1):
      systemd: complement module-console-kit with module-systemd-login

Luiz Augusto von Dentz (1):
      bluetooth: Fix calling many times Audio.GetProperties for the same device

Maarten Bosmans (32):
      Make pulse build with clang again
      doc: Add some more doxygen tags to existing comments
      Do something sensible when compiled without iconv support
      pacat: Fail early if the media name cannot be set
      tests: Fix calculation of memblock size in resampler-test
      qpaeq: Make it python3 and python2 compatible
      tests: refactor ipacl-test
      tests: Make sure tests assert on failures and return error status
      tests: More useful output of make check
      tests: Rename voltest to volume-test
      tests: Revisit which tests to run with make check
      tests: Add a target for running manual tests
      rtpoll: Update comment
      build-sys: Remove time-smoother and shm from libpulsecore
      Remove vector.h and vector-test
      Squash unused variable compiler warning
      oss: Use log2 function from core-util instead of own implementation
      Update LICENSE
      pulsecore: Hardcode FRAME_SIZE_MAX_ALLOW
      resamplers: Use fastpath assert in trivial resampler
      build-sys: Disable fastpath asserts by default
      resamplers: Use better variable name in trivial resampler
      resamplers: Optimize trivial resampler
      Use simple free function in pa_dynarray_free
      Use simple free function in pa_queue_free
      win32: Avoid some compiler warnings when cross-compiling for mingw32
      shm: Use a goto rather than early return for consistency.
      resamplers: Rework the peaks resampler
      resamplers: Improve performance of peaks resampler
      tests: Don't link tests that only use public api to libpulsecommon
      resampler: Some minor tweaks
      Remove pa_prioq priority queue implementation

Maarten Lankhorst (3):
      loopback: Fix crashes
      pulse: Fix old bug in stream_free
      module-jack-sink/source: Set fixed latency correctly on creation

Marc-André Lureau (1):
      stream-restore: Support a simple fallback volume table

Marcel Holtmann (1):
      bluetooth: audio: Update license for shared header files

Michael Biebl (2):
      build: Move libpulsecommon into $pkglib
      padsp: Move the padsp helper lib into a private library

Mikel Astiz (1):
      bluetooth: Fix property reply handling for hfgw

Niels Ole Salscheider (1):
      Add module-virtual-surround-sink.

Paul Menzel (3):
      svolume_{mmx, sse}, sconv_sse: Fix compilation errors with X32 toolchain
      doc: Add entry for correct spelling
      Correct spelling of PulseAudio

Peter Meerwald (45):
      echo-cancel: Fix memory leak in test program
      pstream: Fix spelling of 'receive'.
      stream: Fix comments
      def: Document that pa_buffer_attr.maxlength is in bytes.
      format: Fix unknown doxygen command \second
      format: Add periods to fix brief documentation for pa_format_info_is_pcm()
      format: Add description for format.h
      introspect: Fix unresolved doxygen link pa_port_available_t
      proplist: Add doxygen file description for proplist.h
      proplist: Fix typos in doxygen documentation
      utf8: Fix doxygen file description for utf8.h
      proplist: Consistently use parameter name p for a pa_proplist* in prototype
      error: Fix spelling of 'initialization' in errortab for PA_ERR_MODINITFAILED
      stream: Fix 'e g' as 'e.g.\ '
      simple: Fix typos in simple.h doxygen documentation
      mainloop: Fix typos and rewording of thread-mainloop.h doxygen documentation
      stream: Fix typos and formatting in stream.h doxygen documentation
      build-sys: Make speex library optional
      echo-cance: Make Adrian canceller optional
      echo-cancel: Set file mode to binary in test code
      echo-cancel: Begin log message with uppercase letter
      echo-cancel: Better handling of error conditions in test
      tests: Fix resampler-test compilation without NLS support
      core: fix potential memory leak
      core: sample_spec.rate is in Hz, not kHz; change logging output
      core: fix typo in logging
      core: comment typo
      alsa: Mention correct ALSA function in debug log
      core: Fix return of pa_cpu_init_arm()
      core: Fix log message about ARM feature detection
      sconv: Fix generation of floats in SSE test code
      pulse: Turn the anonymous error code enum into pa_error_code_t.
      pulse: Document general error handling.
      manpage: document --log-target=file:PATH
      manpage: document --log-meta, --log-time, log-backtrace
      fix the ever-popular 'the the' typo
      alsa: fix comment
      core: whitespace typo
      core: svolume tests should generate realistic random volume data
      dbus: Fix dbus argument type in iface-stream.c handle_move().
      build: Fix spelling in src/Makefile.am.
      echo-cancel: Upper/lowercase in comment.
      core: Fix comments.
      pulse: Clarify proplist doxygen documentation.
      pulse: Fix warning in introspect.h; minor rewording and punctuation.

Pierre-Louis Bossart (5):
      alsa: reset watermark to initial values on resume
      core: infrastructure for alternate sampling rate
      sink,source: support for rate update
      alsa: support for alternate sampling rate
      alsa: fix list of sampling rates

Pino Toscano (6):
      pipe: use pa_pipe_buf instead of the macro PIPE_BUF
      rtp: use the right type when checking cmsg_type
      module-rtp-recv: fail when SO_TIMESTAMP is not defined
      mutex: handle gracefully if a PTHREAD_PRIO_INHERIT protocol cannot be set
      pacmd: dynamically allocate ibuf and obuf
      libpulse: Cope with systems not implementing SA_NOCLDWAIT

Piotr Drąg (1):
      i18n: Update Polish translation

Siarhei Siamashka (1):
      bluetooth: sbc: overflow bugfix and audio decoding quality improvement

Sjoerd Simons (2):
      build: Force order of library installation
      .gitignore: Add padsp to gitignore

Sudarshan Bisht (1):
      null-sink: Set latency range at the time of initialization of module.

Tanu Kaskinen (43):
      sink: Move updating the requested latency after the rewind request when finishing a stream move.
      sink: Add some comments about the rewind handling during stream moves.
      memblockq: Improve debuggability by storing a name and a sample spec.
      doc: Add an example stream-restore fallback table file.
      daemon: Don't treat it as a fatal error if we can't connect to the session bus
      alsa: New modarg "paths_dir" for module-alsa-card
      alsa: Handle the "profile" modarg in module-alsa-card
      sink, source: Join two ifs with the same condition.
      device-port: Fix the circular dependency problem more cleanly.
      alsa-mixer: Remove unused pa_alsa_path_set_probe() declaration.
      dbus: New helper function: pa_dbus_get_error_message().
      bluetooth: When receiving D-Bus errors, print also the error message.
      dbus: Give NULL as the error parameter to dbus_bus_remove_match().
      bluetooth: Remove the right match in the proximity module.
      bluetooth: Change function name add_matches to update_matches.
      stream-restore: Clean up the database at startup.
      stream-restore: Don't verify entry validity needlessly.
      virtual-sink: Remove irrelevant comment.
      man: Document the local-server-type daemon.conf option.
      dbus: Use correct free function.
      flist: Make name non-const to avoid casting with pa_xfree().
      proplist: Constify the pa_proplist_copy and _update input pointers.
      proplist: Match pa_proplist_copy argument name between header and implementation.
      build-sys: Remove the public API stuff from libpulsecommon.
      i18n: Fix POTFILES.
      Revert "build-sys: Remove the public API stuff from libpulsecommon."
      bluetooth: Remove unused variable.
      dbus: Check method call signatures.
      dbus: Fix device latency querying.
      padsp: Fix a double-free bug.
      sample-util: Remove redundant check from pa_volume_memchunk.
      device-manager: Fix a memory leak.
      alsa: Fix SND_MIXER_SCHN_LAST related stuff.
      dbus: Add an assertion to get rid of a warning from Coverity.
      device-manager: Add an assertion to get rid of a warning from Coverity.
      dbus: Add assertions to get rid of warnings from Coverity.
      echo-cancel: Drop the correct amount of samples when skipping.
      echo-cancel: Fix memblockq length check.
      echo-cancel: Clarify function call contexts.
      resampler: Use pa_xnew0() to avoid manual zeroing.
      resampler: Use more descriptive buffer names.
      resampler: Add support for resamplers that consume less data than asked.
      alsa: Add support for sound cards with 4-channel input.

Yuri Chornoivan (1):
      Update Ukrainian translation.

poljar (1):
      pacmd: Added --help and --version options.

_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Wang Xingchao | 11 May 08:43
Picon
Favicon

[PATCH] pacat: paplay stream format extention

paplay with "--passthrough" only indicate the stream with PASSTHROUGH flag,
but there's no exact format infomation. the patch makes stream easy to notify
pacore its type in passthrough mode.

Signed-off-by: Wang Xingchao <xingchao.wang <at> intel.com>
---
 src/map-file       |    2 ++
 src/pulse/stream.c |    2 +-
 src/pulse/stream.h |    9 +++++++++
 src/utils/pacat.c  |   35 ++++++++++++++++++++++++++++++-----
 4 files changed, 42 insertions(+), 6 deletions(-)

diff --git a/src/map-file b/src/map-file
index 69cf25b..867a8c5 100644
--- a/src/map-file
+++ b/src/map-file
@@ -295,6 +295,8 @@ pa_stream_is_suspended;
 pa_stream_new;
 pa_stream_new_extended;
 pa_stream_new_with_proplist;
+pa_stream_new_with_proplist_internal;
+pa_encoding_from_string;
 pa_stream_peek;
 pa_stream_prebuf;
 pa_stream_proplist_remove;
diff --git a/src/pulse/stream.c b/src/pulse/stream.c
index 39338c1..77e5ec4 100644
--- a/src/pulse/stream.c
+++ b/src/pulse/stream.c
@@ -80,7 +80,7 @@ static void reset_callbacks(pa_stream *s) {
     s->buffer_attr_userdata = NULL;
 }

-static pa_stream *pa_stream_new_with_proplist_internal(
+pa_stream *pa_stream_new_with_proplist_internal(
         pa_context *c,
         const char *name,
         const pa_sample_spec *ss,
diff --git a/src/pulse/stream.h b/src/pulse/stream.h
index b4464fa..ba7b1ff 100644
--- a/src/pulse/stream.h
+++ b/src/pulse/stream.h
@@ -357,6 +357,15 @@ pa_stream* pa_stream_new_with_proplist(
         const pa_channel_map *map         /**≤ The desired channel map, or NULL for default */,
         pa_proplist *p                    /**≤ The initial property list */);

+pa_stream *pa_stream_new_with_proplist_internal(
+        pa_context *c,
+        const char *name,
+        const pa_sample_spec *ss,
+        const pa_channel_map *map,
+        pa_format_info * const *formats,
+        unsigned int n_formats,
+        pa_proplist *p);
+
 /** Create a new, unconnected stream with the specified name, the set of formats
  * this client can provide, and an initial list of properties. While
  * connecting, the server will select the most appropriate format which the
diff --git a/src/utils/pacat.c b/src/utils/pacat.c
index ec360f7..bd984af 100644
--- a/src/utils/pacat.c
+++ b/src/utils/pacat.c
@@ -39,6 +39,8 @@

 #include <pulse/pulseaudio.h>
 #include <pulse/rtclock.h>
+#include <pulse/format.h>
+#include <pulse/stream.h>

 #include <pulsecore/core-util.h>
 #include <pulsecore/i18n.h>
@@ -76,6 +78,8 @@ static pa_sample_spec sample_spec = {
     .channels = 2
 };
 static pa_bool_t sample_spec_set = FALSE;
+static pa_bool_t passthrough_set = FALSE;
+static pa_encoding_t passthrough_format;

 static pa_channel_map channel_map;
 static pa_bool_t channel_map_set = FALSE;
@@ -443,17 +447,30 @@ static void context_state_callback(pa_context *c, void *userdata) {

         case PA_CONTEXT_READY: {
             pa_buffer_attr buffer_attr;
+            pa_format_info *formats[1];

-            pa_assert(c);
+	    if (passthrough_set == TRUE) {
+                formats[0] = pa_format_info_new();
+                formats[0]->encoding = passthrough_format;
+	    }
+
+	    pa_assert(c);
             pa_assert(!stream);

             if (verbose)
                 pa_log(_("Connection established.%s"), CLEAR_LINE);

-            if (!(stream = pa_stream_new_with_proplist(c, NULL, &sample_spec, &channel_map, proplist))) {
+	    if (passthrough_set == TRUE) {
+		    if (!(stream = pa_stream_new_with_proplist_internal(c, NULL, NULL, NULL, formats, 1, proplist))) {
+	                pa_log(_("pa_stream_new_new_with_proplist_internal() failed: %s"), pa_strerror(pa_context_errno(c)));
+		        goto fail;
+		    }
+	    }else {
+		    if (!(stream = pa_stream_new_with_proplist(c, NULL, &sample_spec, &channel_map, proplist))) {
                 pa_log(_("pa_stream_new() failed: %s"), pa_strerror(pa_context_errno(c)));
                 goto fail;
-            }
+		    }
+	    }

             pa_stream_set_state_callback(stream, stream_state_callback, NULL);
             pa_stream_set_write_callback(stream, stream_write_callback, NULL);
@@ -682,7 +699,7 @@ static void help(const char *argv0) {
              "      --process-time-msec=MSEC          Request the specified process time per request in msec.\n"
              "      --property=PROPERTY=VALUE         Set the specified property to the specified value.\n"
              "      --raw                             Record/play raw PCM data.\n"
-             "      --passthrough                     passthrough data \n"
+             "      --passthrough[=DATAFORMAT]        passthrough data \n"
              "      --file-format[=FFORMAT]           Record/play formatted PCM data.\n"
              "      --list-file-formats               List available file formats.\n")
            , argv0);
@@ -743,7 +760,7 @@ int main(int argc, char *argv[]) {
         {"process-time", 1, NULL, ARG_PROCESS_TIME},
         {"property",     1, NULL, ARG_PROPERTY},
         {"raw",          0, NULL, ARG_RAW},
-        {"passthrough",  0, NULL, ARG_PASSTHROUGH},
+        {"passthrough",  1, NULL, ARG_PASSTHROUGH},
         {"file-format",  2, NULL, ARG_FILE_FORMAT},
         {"list-file-formats", 0, NULL, ARG_LIST_FILE_FORMATS},
         {"latency-msec", 1, NULL, ARG_LATENCY_MSEC},
@@ -944,6 +961,14 @@ int main(int argc, char *argv[]) {

             case ARG_PASSTHROUGH:
                 flags |= PA_STREAM_PASSTHROUGH;
+		if (optarg) {
+	            if ((passthrough_format =
+				pa_encoding_from_string(pa_strip(optarg))) <0) {
+                        pa_log(_("Unknown passthrough format %s."), optarg);
+			goto quit;
+		    }
+		    passthrough_set = TRUE;
+		}
                 break;

             case ARG_FILE_FORMAT:
--

-- 
1.7.9.5
Tanu Kaskinen | 10 May 08:19
Picon
Picon
Favicon
Gravatar

[PATCH v3 0/3] Libsamplerate resampler crash fix

Here's a fix for https://bugs.freedesktop.org/show_bug.cgi?id=47156

Changes in v3:
 - More readable calculations, as suggested by David. Also
   fixed a couple of bugs in those calculations.
 - Rework the leftover storing, as suggested by Wang
   Xingchao: instead of using a dedicated buffer for it,
   store the leftover data in the beginning of remap_buf.
   This can avoid some memory copying.
 - Use a generic save_leftover() function instead of doing
   the leftover copying in the resampler implementor code.
 - Use the leftover logic also with the speex and ffmpeg
   resamplers.

Changes in v2:
 - Fixed bugs.
 - Better testing: I forced the resampler to always leave
   the last frame unprocessed. That uncovered one bug, but
   now the playback is smooth.
 - Sensible buffer names.

Tanu Kaskinen (3):
  resampler: Use pa_xnew0() to avoid manual zeroing.
  resampler: Use more descriptive buffer names.
  resampler: Add support for resamplers that consume less data than
    asked.

 src/pulsecore/resampler.c |  357 ++++++++++++++++++++++++++++-----------------
 1 file changed, 222 insertions(+), 135 deletions(-)

--

-- 
1.7.10
Arun Raghavan | 9 May 17:13
Picon

[PATCH] sink-input: Relax initial volume setting restrictions

[I don't expect major objections to this, but since we're in the midst of a
freeze, playing it safe]

The extended stream creation API introduced subtle breakage at the time
of sink input creation. The sample spec (and thus channel count) is no
longer guaranteed to be available during the PA_SINK_INPUT_NEW hook
(since multiple formats may be specified and a single format might only
be fixed after all hooks are called).

To deal with this, instead of asserting on mismatched channel maps in
whatever volume is set by a hook, we remap the set volume to the desired
number of channels.
---
 src/modules/module-stream-restore.c |    7 +------
 src/pulsecore/sink-input.c          |    9 +++++++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c
index 23889ca..630c78f 100644
--- a/src/modules/module-stream-restore.c
+++ b/src/modules/module-stream-restore.c
@@ -1473,13 +1473,8 @@ static pa_hook_result_t sink_input_fixate_hook_callback(pa_core *c, pa_sink_inpu
             else if (new_data->volume_is_set)
                 pa_log_debug("Not restoring volume for sink input %s, because already set.", name);
             else {
-                pa_cvolume v;
-
                 pa_log_info("Restoring volume for sink input %s.", name);
-
-                v = e->volume;
-                pa_cvolume_remap(&v, &e->channel_map, &new_data->channel_map);
-                pa_sink_input_new_data_set_volume(new_data, &v);
+                pa_sink_input_new_data_set_volume(new_data, &e->volume);

                 new_data->volume_is_absolute = FALSE;
                 new_data->save_volume = TRUE;
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index f6f7324..909f3dc 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -331,10 +331,15 @@ int pa_sink_input_new(
         pa_cvolume_reset(&data->volume, data->sample_spec.channels);
         data->volume_is_absolute = FALSE;
         data->save_volume = FALSE;
+    } else {
+        if (!pa_cvolume_compatible(&data->volume, &data->sample_spec)) {
+            /* Remap volume if channel maps don't match */
+            pa_channel_map from;
+            pa_channel_map_init_auto(&from, data->volume.channels, PA_CHANNEL_MAP_DEFAULT);
+            pa_cvolume_remap(&data->volume, &from, &new_data->channel_map);
+        }
     }

-    pa_return_val_if_fail(pa_cvolume_compatible(&data->volume, &data->sample_spec), -PA_ERR_INVALID);
-
     if (!data->volume_factor_is_set)
         pa_cvolume_reset(&data->volume_factor, data->sample_spec.channels);

--

-- 
1.7.8.6

Gmane