[pulseaudio-discuss] [PATCH] bluetooth: drop data every 500ms on oor condition
From: Marc-André Lureau marc-andre.lur...@nokia.com --- src/modules/bluetooth/module-bluetooth-device.c | 25 -- 1 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index e4a2cef..bd1511b 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -1671,17 +1671,20 @@ static void thread_func(void *userdata) { writable = FALSE; } -if ((!u-source || !PA_SOURCE_IS_LINKED(u-source-thread_info.state)) do_write = 0 writable) { -pa_usec_t time_passed, next_write_at, sleep_for; - -/* Hmm, there is no input stream we could synchronize - * to. So let's estimate when we need to wake up the latest */ - -time_passed = pa_rtclock_now() - u-started_at; -next_write_at = pa_bytes_to_usec(u-write_index, u-sample_spec); -sleep_for = time_passed next_write_at ? next_write_at - time_passed : 0; - -/* pa_log(Sleeping for %lu; time passed %lu, next write at %lu, (unsigned long) sleep_for, (unsigned long) time_passed, (unsigned long)next_write_at); */ +if ((!u-source || !PA_SOURCE_IS_LINKED(u-source-thread_info.state)) do_write = 0) { +pa_usec_t sleep_for; +pa_usec_t time_passed, next_write_at; + +if (writable) { +/* Hmm, there is no input stream we could synchronize + * to. So let's estimate when we need to wake up the latest */ +time_passed = pa_rtclock_now() - u-started_at; +next_write_at = pa_bytes_to_usec(u-write_index, u-sample_spec); +sleep_for = time_passed next_write_at ? next_write_at - time_passed : 0; +/* pa_log(Sleeping for %lu; time passed %lu, next write at %lu, (unsigned long) sleep_for, (unsigned long) time_passed, (unsigned long)next_write_at); */ +} else +/* drop stream every 500 ms */ +sleep_for = PA_USEC_PER_MSEC * 500; pa_rtpoll_set_timer_relative(u-rtpoll, sleep_for); disable_timer = FALSE; -- 1.7.4.2 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH] alsa: Fix log output to inform about positive base volumes correctly.
This fix was done for _set_port_cb() already, but the first fix didn't fix setup_mixer(). Now that's done too. --- src/modules/alsa/alsa-sink.c |5 + src/modules/alsa/alsa-source.c |5 + 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index 9ed4d4d..ccbc062 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -1724,10 +1724,7 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB, pa_bool_t sync_v u-sink-base_volume = pa_sw_volume_from_dB(-u-mixer_path-max_dB); u-sink-n_volume_steps = PA_VOLUME_NORM+1; -if (u-mixer_path-max_dB 0.0) -pa_log_info(Fixing base volume to %0.2f dB, pa_sw_volume_to_dB(u-sink-base_volume)); -else -pa_log_info(No particular base volume set, fixing to 0 dB); +pa_log_info(Fixing base volume to %0.2f dB, pa_sw_volume_to_dB(u-sink-base_volume)); } else { pa_log_info(Hardware volume ranges from %li to %li., u-mixer_path-min_volume, u-mixer_path-max_volume); diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c index 6d18e60..3355fbd 100644 --- a/src/modules/alsa/alsa-source.c +++ b/src/modules/alsa/alsa-source.c @@ -1465,10 +1465,7 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) { u-source-base_volume = pa_sw_volume_from_dB(-u-mixer_path-max_dB); u-source-n_volume_steps = PA_VOLUME_NORM+1; -if (u-mixer_path-max_dB 0.0) -pa_log_info(Fixing base volume to %0.2f dB, pa_sw_volume_to_dB(u-source-base_volume)); -else -pa_log_info(No particular base volume set, fixing to 0 dB); +pa_log_info(Fixing base volume to %0.2f dB, pa_sw_volume_to_dB(u-source-base_volume)); } else { pa_log_info(Hardware volume ranges from %li to %li., u-mixer_path-min_volume, u-mixer_path-max_volume); -- 1.7.4.2 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH] bluetooth: drop data every 500ms on oor condition
'Twas brillig, and Tanu Kaskinen at 04/04/11 12:33 did gyre and gimble: From: Marc-André Lureau marc-andre.lur...@nokia.com Seems sensible. In my tree now. Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH] bluetooth-device: fix rounding errors caused by few bt volume steps
When volume changes in bluetooth device PulseAudio volume is rounded one too low, so if bluetooth headset changes volume and that volume is immediately set again for bluetooth device, bluetooth step drifts lower all the time. Volume is incremented by one in the conversion so that we get right bluetooth step when re-applying volume. Signed-off-by: Juho Hämäläinen ext-juho.hamalai...@nokia.com --- src/modules/bluetooth/module-bluetooth-device.c | 48 +- 1 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index e4a2cef..46826eb 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -1725,6 +1725,8 @@ finish: pa_log_debug(IO thread shutting down); } +#define HSP_MAX_GAIN (15) + /* Run from main thread */ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *userdata) { DBusError err; @@ -1750,20 +1752,30 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us dbus_uint16_t gain; pa_cvolume v; -if (!dbus_message_get_args(m, err, DBUS_TYPE_UINT16, gain, DBUS_TYPE_INVALID) || gain 15) { +if (!dbus_message_get_args(m, err, DBUS_TYPE_UINT16, gain, DBUS_TYPE_INVALID) || gain HSP_MAX_GAIN) { pa_log(Failed to parse org.bluez.Headset.{Speaker|Microphone}GainChanged: %s, err.message); goto fail; } if (u-profile == PROFILE_HSP) { if (u-sink dbus_message_is_signal(m, org.bluez.Headset, SpeakerGainChanged)) { +pa_volume_t volume = (pa_volume_t) (gain * PA_VOLUME_NORM / HSP_MAX_GAIN); + +/* increment volume by one to correct rounding errors */ +if (volume PA_VOLUME_NORM) +volume ++; -pa_cvolume_set(v, u-sample_spec.channels, (pa_volume_t) (gain * PA_VOLUME_NORM / 15)); +pa_cvolume_set(v, u-sample_spec.channels, volume); pa_sink_volume_changed(u-sink, v); } else if (u-source dbus_message_is_signal(m, org.bluez.Headset, MicrophoneGainChanged)) { +pa_volume_t volume = (pa_volume_t) (gain * PA_VOLUME_NORM / HSP_MAX_GAIN); -pa_cvolume_set(v, u-sample_spec.channels, (pa_volume_t) (gain * PA_VOLUME_NORM / 15)); +/* increment volume by one to correct rounding errors */ +if (volume PA_VOLUME_NORM) +volume ++; + +pa_cvolume_set(v, u-sample_spec.channels, volume); pa_source_volume_changed(u-source, v); } } @@ -1801,6 +1813,7 @@ fail: static void sink_set_volume_cb(pa_sink *s) { DBusMessage *m; dbus_uint16_t gain; +pa_volume_t volume; struct userdata *u; char *k; @@ -1815,12 +1828,18 @@ static void sink_set_volume_cb(pa_sink *s) { pa_assert(u-sink == s); pa_assert(u-profile == PROFILE_HSP); -gain = (pa_cvolume_max(s-real_volume) * 15) / PA_VOLUME_NORM; +gain = (pa_cvolume_max(s-real_volume) * HSP_MAX_GAIN) / PA_VOLUME_NORM; + +if (gain HSP_MAX_GAIN) +gain = HSP_MAX_GAIN; -if (gain 15) -gain = 15; +volume = (pa_volume_t) (gain * PA_VOLUME_NORM / HSP_MAX_GAIN); -pa_cvolume_set(s-real_volume, u-sample_spec.channels, (pa_volume_t) (gain * PA_VOLUME_NORM / 15)); +/* increment volume by one to correct rounding errors */ +if (volume PA_VOLUME_NORM) +volume ++; + +pa_cvolume_set(s-real_volume, u-sample_spec.channels, volume); pa_assert_se(m = dbus_message_new_method_call(org.bluez, u-path, org.bluez.Headset, SetSpeakerGain)); pa_assert_se(dbus_message_append_args(m, DBUS_TYPE_UINT16, gain, DBUS_TYPE_INVALID)); @@ -1832,6 +1851,7 @@ static void sink_set_volume_cb(pa_sink *s) { static void source_set_volume_cb(pa_source *s) { DBusMessage *m; dbus_uint16_t gain; +pa_volume_t volume; struct userdata *u; char *k; @@ -1846,12 +1866,18 @@ static void source_set_volume_cb(pa_source *s) { pa_assert(u-source == s); pa_assert(u-profile == PROFILE_HSP); -gain = (pa_cvolume_max(s-volume) * 15) / PA_VOLUME_NORM; +gain = (pa_cvolume_max(s-volume) * HSP_MAX_GAIN) / PA_VOLUME_NORM; + +if (gain HSP_MAX_GAIN) +gain = HSP_MAX_GAIN; + +volume = (pa_volume_t) (gain * PA_VOLUME_NORM / HSP_MAX_GAIN); -if (gain 15) -gain = 15; +/* increment volume by one to correct rounding errors */ +if (volume PA_VOLUME_NORM) +volume ++; -pa_cvolume_set(s-volume, u-sample_spec.channels, (pa_volume_t) (gain * PA_VOLUME_NORM / 15)); +pa_cvolume_set(s-volume, u-sample_spec.channels, volume); pa_assert_se(m = dbus_message_new_method_call(org.bluez, u-path, org.bluez.Headset, SetMicrophoneGain));
Re: [pulseaudio-discuss] [PATCH] alsa: Fix log output to inform about positive base volumes correctly.
'Twas brillig, and Tanu Kaskinen at 04/04/11 12:51 did gyre and gimble: This fix was done for _set_port_cb() already, but the first fix didn't fix setup_mixer(). Now that's done too. Thanks. Merged. Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] Serversound 2 ThinClient
Hallo liebe Listenleser, ich habe eine SLES11-Kvm-Maschine mit openSuse11.2/3/4 Gastsystemen. Das einloggen erfolgt über ThinClients an den jeweiligen Gastsystemen (alle mit LTSP4.2). Die (very)ThinClients haben 64MB Ram. Der SLES11-Kvm-Server hat keine eigene Soundkarte. Wie kann ich dennoch den Sound zu den Clients bringen? Vorab vielen Dank bad-ger-man ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Serversound 2 ThinClient
Please note this is a English-speaking mailing list. Below is my answer in English, hopefully you will be able to understand it. 2011/4/4 badgerman bad-ger-...@web.de: Hallo liebe Listenleser, ich habe eine SLES11-Kvm-Maschine mit openSuse11.2/3/4 Gastsystemen. Das einloggen erfolgt über ThinClients an den jeweiligen Gastsystemen (alle mit LTSP4.2). Die (very)ThinClients haben 64MB Ram. Der SLES11-Kvm-Server hat keine eigene Soundkarte. Wie kann ich dennoch den Sound zu den Clients bringen? Assuming the thin-clients have pulseaudio running and module-protocol-native-tcp enabled with approprate permessions set, the forwarding of audio back to the client is done automatically when logging in on the server with X-forwarding enabled. Alternatively, you can start applications on the server with the PULSE_SERVER=client-name environment variable set. Vorab vielen Dank bad-ger-man Maarten ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] how to read exactly 320 samples
On Mon, 2011-04-04 at 00:27 -0700, sohail abbasi wrote: Hi , everyone I am new to audio programing(as well pulseaudio). I have to add pulseaudio support in an application already working with ALSA and OSS. the designe of my application is such that I have to read 320 samples in read function each time. stream attributes are 16bit , 16khz , and 2 channels. So I need to read 1280 bytes in pa_stream_peek. But I am unable to read 320 samples each time. some time more , some time less ,and some time 0. How can I set buffer attributes to force pa_stream_read to read 320 samples each time. Hmm... The documentation for the fragsize field of pa_buffer_attr seems to imply that the fragment size is always a constant, which according to your experience is not true. That's the only parameter for controlling the fragment sizes when recording, so there's probably no way you can make Pulseaudio give you constant size fragments. You probably can and have to do some buffering in the pulseaudio support component for the application you're working on. So when you get a fragment from pulseaudio, you copy the data to an internal buffer and give data to the application only if there's at least 1280 bytes available, and of course exactly 1280 bytes at a time - any leftovers will be saved until the next fragment arrives. -- Tanu ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [RFC] Pulseaudio jack sense
Hi Pierre, On Mon, Apr 4, 2011 at 1:05 PM, pl bossart bossart.nos...@gmail.com wrote: Margarita: I wasn't really able to try out your patches and figure out what they entail since your version of pulseaudio is _very_ old. I tried to merge them one by one, you'll find the result attached. I compiles with git master and if UCM is disabled in module-alsa-card things seem to work fine, so no side effects. Can you let me know if I missed something, and better yet, can you move to something more recent? Yes, it was an old branch but I have moved the code to master branch. I'm just finishing to work on some comments that I got so I'll post the latest code tomorrow. Regards, Margarita Thanks, -Pierre ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss