Re: [pulseaudio-discuss] [PATCH] bluetooth: Fix rendering a2dp data

2010-12-13 Thread Luiz Augusto von Dentz
Hi,

On Sat, Dec 11, 2010 at 1:05 AM, Maarten Lankhorst
m.b.lankho...@gmail.com wrote:
 makes my android phone slightly happier
 ---
  src/modules/bluetooth/module-bluetooth-device.c |   11 ---
  1 files changed, 8 insertions(+), 3 deletions(-)

 diff --git a/src/modules/bluetooth/module-bluetooth-device.c 
 b/src/modules/bluetooth/module-bluetooth-device.c
 index 6d31c1e..8664001 100644
 --- a/src/modules/bluetooth/module-bluetooth-device.c
 +++ b/src/modules/bluetooth/module-bluetooth-device.c
 @@ -1387,7 +1387,7 @@ static int a2dp_process_push(struct userdata *u) {
     pa_assert(u-source);
     pa_assert(u-read_smoother);

 -    memchunk.memblock = pa_memblock_new(u-core-mempool, u-block_size);
 +    memchunk.memblock = pa_memblock_new(u-core-mempool, u-block_size * 2);
     memchunk.index = memchunk.length = 0;

Im not sure how this would help, we decode sbc frame by frame so
having twice as much memory doesn't really make any sense, there could
be that we should decode the entire buffer read, but that would take
much more memory. What could be the real problem is that the source is
changing the bitpool but that shouldn't be a problem since the
block_size is supposed to be calculated from maximum bitpool range so
the buffer will always be big enough.

     for (;;) {
 @@ -1442,7 +1442,8 @@ static int a2dp_process_push(struct userdata *u) {
         to_decode = l - sizeof(*header) - sizeof(*payload);

         d = pa_memblock_acquire(memchunk.memblock);
 -        to_write = memchunk.length = 
 pa_memblock_get_length(memchunk.memblock);
 +        to_write = pa_memblock_get_length(memchunk.memblock);
 +        memchunk.length = 0;

         while (PA_LIKELY(to_decode  0  to_write  0)) {
             size_t written;
 @@ -1464,7 +1465,7 @@ static int a2dp_process_push(struct userdata *u) {
  /*             pa_log_debug(SBC: frame_length: %lu; codesize: %lu, 
 (unsigned long) a2dp-frame_length, (unsigned long) a2dp-codesize); */

             pa_assert_fp((size_t) decoded = to_decode);
 -            pa_assert_fp((size_t) decoded == a2dp-frame_length);
 +            pa_assert_fp((size_t) decoded = a2dp-frame_length);

This is the real problem, either we do this if the bitpool is changing
or we have to call sbc_reinit in each frame.

             pa_assert_fp((size_t) written = to_write);
             pa_assert_fp((size_t) written == a2dp-codesize);
 @@ -1474,10 +1475,14 @@ static int a2dp_process_push(struct userdata *u) {

             d = (uint8_t*) d + written;
             to_write -= written;
 +            memchunk.length += written;

             frame_count++;
         }

 +        if (to_decode)
 +            pa_log_error(SBC: %lu bytes not decoded\n, to_decode);
 +
         pa_memblock_release(memchunk.memblock);

Actually I think we should be solving this in libsbc, both sbc_encode
and sbc_decode should be checking if the bitpool has changed and
reinit automatically, otherwise we gonna get performance penalty doing
sbc_reinit for every frame.


Regards,

-- 
Luiz Augusto von Dentz
Computer Engineer
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] Get the 'future' volume of a stream?

2010-12-13 Thread Gregory Petrosyan
Hi everybody,

I am the current maintainer of cmus console music player (and the
author of its PulseAudio output plugin).

Like every audio player, cmus displays the volume control widget.
Nothing unexpected here :-) But, in fact, this control serves dual
purposes: it displays the current playback volume *and* it is used to
indicate/configure the volume before the playback starts.

But the problem is, as it seems to me, that with PA I have no way to
display/configure the volume before the playback starts, if I want to
take advantage of module-stream-restore (pass NULL volume to the
pa_stream_connect_playback, which is strongly recommended). So, I
either store the volume myself and pass it to
pa_stream_connect_playback (which seems not to be the true way), or
I display no volume control at all before the playback starts, which
is kind of a nonsense.

Am I right on this or not, and what is the preferred way to control
the volume with PA?

                Gregory
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Get the 'future' volume of a stream?

2010-12-13 Thread Colin Guthrie
'Twas brillig, and Gregory Petrosyan at 13/12/10 19:14 did gyre and gimble:
 Thanks a lot for the answer; I'll try to look into the pavucontrol sources.
 
 Do I understand correctly that I need to guess the
 module-stream-restore.id before the stream exists?

You can technically set that property yourself when you open the stream
so you can be certain what it'll be. Either that or you can just use the
one that's automatically assigned when you test it and that will likely
be correct (even if you do hard-code it, I'd recommend just hard-coding
it to what it is so as to make for a smooth upgrade for people).

The only problem with this approach is that if the stream restore id is
deprecated in the future, it'll obviously stop working :s

If you keep a vague eye on this mailing, if it ever is deprecated it'll
be announced. and I'll try and maintain backwards compatibility if at
all possible anyway.

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


Re: [pulseaudio-discuss] How to close a session?

2010-12-13 Thread Haug Bürger

Colin Guthrie schrieb:

'Twas brillig, and Haug Bürger at 12/12/10 10:59 did gyre and gimble:
  

The leatest Ubuntu has a serious security bug caused by pulseaudio. If
you configure pammount to mount a crypted home directory it is not able
to unmount it because pulseaudio has files in use (.pulse/*). You can
not even kill the daemon because it is set to user session.

So, how can you stop the pulseaudio user session? In the hope that this
releases the files.

Is it really necessary for the deamon to lock the files that you can not
unmount or is this a bug?



It's quite deliberate. PA has a timeout that prevents it from closing
immediate. This means that if PA autospawns, it will stick around for a
little while in case it's needed again (while startup is fairly quick,
we do have to probe the hardware so it does take time). This is
primarily for console applications rather than X11 however, as under X11
a Session Manager module is loaded which keeps PA alive for the duration
of the X session.

You can make a change in daemon.conf to set exit-idle-time to 0. This
should allow PA to exit when the X11 session exits.
  

This doesn't work. Probably because you might have another user session
with X11 active. This means PA is not closed and gdm can not close the
session properly.

I don't care if PA still runs but why does it lock files in my home
directory?

It is not even possible as root to shut down a user session. Gdm can not
even kill the user session. This makes PA a pain in the a...

So, how can you stop the pulseaudio user session?



___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Resampling and format conversion question

2010-12-13 Thread Arun Raghavan
On Thu, 2010-12-09 at 16:02 -0600, abraham duenas wrote: 
 Hello,
 
 I have one question regarding resampler and working format. I have a
 card which has 48kHz working sampling frequency and s16le format. When
 I play any file at that frequency my understanding is that no
 resampling should take place. I can see on PA logs these:
 
 resampler.c: Forcing resampler 'copy', because of fixed, identical sample 
 rates.
 resampler.c: Using resampler 'copy'
 resampler.c: Using float32le as working format.
 sink-input.c: Created input 3 Playback Stream on input with sample
 spec s16le 2ch 48000Hz and channel map front-left,front-right
 
 In this 'copy' case what is the resampler.c: Using float32le as
 working format for? Is it changing my s16le to float32le?
 
 Any help would be really appreciated :)

A lot of cards do 44100 and 48000 Hz, and PulseAudio selects 44100 Hz by
default (configurable in /etc/pulse/daemon.conf). Are you sure this is
not the case for you?

Also, is your card set up for stereo output?

Cheers,
Arun 

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss