Commit graph

1038 commits

Author SHA1 Message Date
Lennart Poettering
f204c0fe43 mark null sink as support dynamic latency 2009-04-07 00:48:09 +02:00
Lennart Poettering
298bd0b0c6 adjust max_rewind/max_request whenever the latency changes 2009-04-07 00:47:55 +02:00
Lennart Poettering
e976034063 send the source latency based on the MTU size 2009-04-07 00:47:13 +02:00
Lennart Poettering
886ddc33d8 make sure we don't apply sampling rate fixes that bring the sampling freq > PA_RATE_MAX
Fixes #525
2009-04-06 23:02:50 +02:00
Lennart Poettering
daa945aa32 don't fail device reservation if the D-Bus connection is dead 2009-04-06 04:21:26 +02:00
Lennart Poettering
6ba3333030 Merge branch 'master' of ssh://rootserver/home/lennart/git/public/pulseaudio 2009-04-05 03:05:51 +02:00
Lennart Poettering
d035f4a3f3 Modify smoothing code to make cubic interpolation optional and allow 'quick fixups' on resuming
The primary reason for this change is to allow time graphs that do not
go through the origin and hence smoothing starting from the origin is
not desired. This change will allow passing time data into the smoother
while paused and then abruptly use that data without smoothing using the
'quick fixup' flag when resuming.

Primary use case is allowing recording time graphs where the data
recorded originates from a time before the stream was created. The
resulting graft will be shifted and should not be smoothened to go
through the origin.
2009-04-05 02:26:02 +02:00
Lennart Poettering
ca39fa2c6f initialize sound cards only after the 'control' object appeared 2009-04-04 04:13:58 +02:00
Lennart Poettering
77a1e3876b refuse to initialize on modem devices 2009-04-04 04:12:42 +02:00
Maarten Bosmans
8bcb9c6910 various spelling fixes 2009-04-04 02:27:13 +02:00
Lennart Poettering
6152c52420 Merge branch 'master' of ssh://rootserver/home/lennart/git/public/pulseaudio 2009-04-03 17:50:37 +02:00
Lennart Poettering
143e1ba739 downgrade a few messages 2009-04-03 17:49:05 +02:00
Lennart Poettering
373b5efe51 properly account for seeks in the requested_bytes counter 2009-04-01 23:05:09 +02:00
Lennart Poettering
380e97a596 use machine id instead of hostname to identify local connections 2009-04-01 21:15:52 +02:00
Lennart Poettering
4e8ceae064 fix buffer defaults 2009-03-31 22:16:53 +02:00
Lennart Poettering
917e8cd0f6 handle buffer_attr changed messages properly 2009-03-31 21:35:34 +02:00
Finn Thain
5e11972076 revive solaris module
On Wed, 4 Mar 2009, Lennart Poettering wrote:

[snip]
> > This patch disables link map/library versioning unless ld is GNU ld.
> > Another approach for solaris would be to use that linker's -M option,
> > but I couldn't make that work (due to undefined mainloop, browse and
> > simple symbols when linking pacat. I can post the errors if anyone is
> > intested.)
>
> The linking in PA is a bit weird since we have a cyclic dependency
> between libpulse and libpulsecommon which however is not explicit.

Could that affect the pacat link somehow?

What are the implications for client apps that link with the non-versioned
libraries I've been building on solaris?

[snip]
> >  struct userdata {
> >      pa_core *core;
> > @@ -87,15 +92,24 @@ struct userdata {
> >
> >      pa_memchunk memchunk;
> >
> > -    unsigned int page_size;
> > -
> >      uint32_t frame_size;
> > -    uint32_t buffer_size;
> > -    unsigned int written_bytes, read_bytes;
> > +    int32_t buffer_size;
> > +    volatile uint64_t written_bytes, read_bytes;
> > +    pa_mutex *written_bytes_lock;
>
> Hmm, we generally try do do things without locking in PA. This smells as
> if it was solvable using atomic ints as well.
>
> Actually, looking at this again I get the impression these mutex are
> completely unnecessary here. All functions that lock these mutexes are
> called from the IO thread so no locking should be nessary.
>
> Please don't use volatile here. I am pretty sure it is a misuse. Also
> see http://kernel.org/doc/Documentation/volatile-considered-harmful.txt
> which applies here too I think.

OK, I've removed the locks. For some reason I thought that the get_latency
function was called from two different threads.

> > +static void sink_set_volume(pa_sink *s) {
> > +    struct userdata *u;
> > +    audio_info_t info;
> > +
> > +    pa_assert_se(u = s->userdata);
> > +
> > +    if (u->fd >= 0) {
> > +        AUDIO_INITINFO(&info);
> > +
> > +        info.play.gain = pa_cvolume_avg(&s->virtual_volume) * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
> > +        assert(info.play.gain <= AUDIO_MAX_GAIN);
>
> I'd prefer if you'd use pa_cvolume_max here instead of pa_cvolume_avg()
> because this makes the volume independant of the balance.
>
> > -    info.play.error = 0;
> > +        info.play.gain = pa_cvolume_avg(&s->virtual_volume) * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
> > +        assert(info.play.gain <= AUDIO_MAX_GAIN);
>
> Same here. (i.e. for the source)

Done and done.

> > +            if (u->sink->thread_info.rewind_requested)
> > +                pa_sink_process_rewind(u->sink, 0);
>
> This is correct.
>
> >
> >              err = ioctl(u->fd, AUDIO_GETINFO, &info);
> >              pa_assert(err >= 0);
>
> Hmm, if at all this should be pa_assert_se(), not pa_assert() (so that
> it is not defined away by -DNDEBUG). However I'd prefer if the error
> would be could correctly. (I see that this code is not yours, but
> still...)

Done.

> > +                        case EINTR:
> > +                            break;
>
> I think you should simply try again in this case...

Done.

> > +                        case EAGAIN:
> > +                            u->buffer_size = u->buffer_size * 18 / 25;
> > +                            u->buffer_size -= u->buffer_size % u->frame_size;
> > +                            u->buffer_size = PA_MAX(u->buffer_size, (int32_t)MIN_BUFFER_SIZE);
> > +                            pa_sink_set_max_request(u->sink, u->buffer_size);
> > +                            pa_log("EAGAIN. Buffer size is now %u bytes (%llu buffered)", u->buffer_size, buffered_bytes);
> > +                            break;
>
> Hmm, care to explain this?

EAGAIN happens when the user requests a buffer size that is too large for
the STREAMS layer to accept. We end up looping with EAGAIN every time we
try to write out the rest of the buffer, which burns enough CPU time to
trip the CPU limit.

So, I reduce the buffer size with each EAGAIN. This gets us reasonably
close to the largest usable buffer size. (Perhaps there's a better way to
determine what that limit is, but I don't know how.)

> > +
> > +            pa_rtpoll_set_timer_absolute(u->rtpoll, xtime0 + pa_bytes_to_usec(buffered_bytes / 2, &u->sink->sample_spec));
> > +        } else {
> > +            pa_rtpoll_set_timer_disabled(u->rtpoll);
> >          }
>
> Hmm, you schedule audio via timers? Is that a good idea?

Perhaps not. I won't know until I test on more hardware.

But, given that we have rt priority and high resolution timers on solaris,
I think it is OK in theory...

The reason I used a timer was to minimise CPU usage and avoid the CPU
limit. Recall that getting woken up by poll is not an option for playback
unfortunately. We can arrange for a signal when the FD becomes writable,
but that throws out the whole buffer size concept, which acts to reduce
latency.

> That really only makes sense if you have to deal with large buffers and
> support rewinding.

I've implemented rewind support, but I'm still not sure that I have
understood the concept; I take it that we "rewind" (from the point-of-view
of the renderer, not the sink) so that some rendered but as yet unplayed
portion of the memblock/buffers can then be rendered again?

> Please keep in mind that the system clock and the sound card clock
> deviate. If you use the system timers to do PCM scheduling ou might need
> a pa_smoother object that is able to estimate the deviation for you.

Actually, in an earlier version I did use a smoother (after reading about
that in the wiki). But because of the non-monotonic sample counter (bug?)
I decided that it probably wasn't worth the added complexity so I removed
it. I'll put the smoother back if I can figure out the problem with the
sample counter.

>
> > +    u->frame_size = pa_frame_size(&ss);
> >
> > -    if ((fd = open(p = pa_modargs_get_value(ma, "device", DEFAULT_DEVICE), mode | O_NONBLOCK)) < 0)
> > +    u->buffer_size = 16384;
>
> It would appear more appropriate to me if the buffer size is adjusted by
> the sample spec used.

Done.

> One last thing: it would probably be a good idea to allocate a pa_card
> object and attach the sink and the source to it.

It is possible to open /dev/audio twice by loading the solaris module
twice -- once for the sink (passing record=0) and once for source (passing
playback=0), thus giving seperate threads/LWPs for source and sink. It
might be misleading to allocate two cards in that situation?

> Right now pa_cards are mostly useful for switching profiles but even if
> you do not allow switching profiles on-the-fly it is of some value to
> find out via the cards object which source belongs to which sink.
>
> Otherwise I am happy!
>
> Thanks for your patch! I'd be thankful if you could fix the issues
> pointed out and prepare another patch on top of current git!

No problem. Patch follows. It also includes a portability fix for
pa_realpath and a fix for a bug in the pa_signal_new() error path that
causes signal data be freed if you attempt to register the same signal
twice.

> I hope I answered all your questions,

Your answers were very helpful, thanks.

Finn

>
> Lennart
>
>
2009-03-31 01:23:36 +02:00
Kyle Cronan
92ae5f1a74 Specifying ALSA mixer control
On Fri, Mar 27, 2009 at 7:21 AM, Lennart Poettering <lennart@poettering.net> wrote:

>> I tried installing the latest git sources on my Ubuntu Jaunty box but
>> it just broke sound in all my applications.  For my own purposes, I'm
>> going to need to start with the Ubuntu-patched 0.9.14.  However, if
>> you are willing to accept this patch I will forward port it so that it
>> applies to the latest sources.  It's a completely harmless change, so
>> why not apply it?
>
> Yes, I am happy to apply it. Could you please update it for current git?
>

Great.  An updated patch is attached.  For symmetry, I added this
option to the alsa source module as well.

The Ubuntu folks have customized pulse so much that it is difficult
for me to get this version working on my system.  For this patch I
have only made sure that it compiles.  But it does pretty much the
same thing as the one for 0.9.14, which is working great for me.

Thanks,
Kyle
2009-03-31 00:56:41 +02:00
Lennart Poettering
cab1e54392 explain ff7033c11d 2009-03-31 00:26:12 +02:00
Lennart Poettering
ff7033c11d Revert "make sure we always read in all properties"
This reverts commit 1c8f968282.

Turns out doing this is racy. The appropriate fix seems to be
38825d7912
2009-03-31 00:22:17 +02:00
Lennart Poettering
857a1f4909 fix compiler warning 2009-03-30 20:57:23 +02:00
Lennart Poettering
90fbc036f4 make sure we never access an invalid pa_bluetooth_device object 2009-03-30 20:57:12 +02:00
Lennart Poettering
1c8f968282 make sure we always read in all properties 2009-03-30 20:56:03 +02:00
Lennart Poettering
66b80e9ecd get rid of old 'Connected' property parsing and make sure we don't execute two case branches 2009-03-30 20:55:50 +02:00
Lennart Poettering
91355a1ce5 introduce typedef for pa_bt_audio_state and use it everywhere 2009-03-30 20:55:10 +02:00
Lennart Poettering
1390564227 Merge commit 'elmarco/bluetooth-fixes' 2009-03-30 20:34:49 +02:00
Lennart Poettering
d33be12fde Merge commit 'elmarco/dbus' 2009-03-30 20:26:27 +02:00
Marc-André Lureau
eb93e2537a dbus: split dbus-util into dbus-shared
modules: fix dbus-util include
pulse: get dbus at context connection
2009-03-30 20:56:55 +03:00
Lennart Poettering
1743322d3e Merge commit 'coling/master' 2009-03-30 19:15:39 +02:00
Lennart Poettering
aa6803653e rework tunneling code 2009-03-30 19:13:07 +02:00
Lennart Poettering
e3f15104cf don't enabled tsched on software ALSA devices 2009-03-30 18:00:23 +02:00
Marc-André Lureau
87fcb3d592 bluetooth: use new audio State properties 2009-03-27 22:59:57 +02:00
Marc-André Lureau
38825d7912 bluetooth: GetProperties after profile UUID show up 2009-03-27 22:59:56 +02:00
Marc-André Lureau
20bd1c686c bluetooth: remove racy GetProperties to check profile 2009-03-27 22:59:56 +02:00
Marc-André Lureau
9e8c2d393a bluetooth: don't access outside array range 2009-03-27 22:59:53 +02:00
Marc-André Lureau
61cd6d4c19 bluetooth: fail when switching on non-connected profile 2009-03-27 20:43:42 +02:00
Marc-André Lureau
62a4e36f5d bluetooth: connected can be -1, check > 0 2009-03-27 20:43:42 +02:00
Luiz Augusto von Dentz
13f1c4413b Do not reconfigure capabilities. 2009-03-26 15:40:04 -03:00
Luiz Augusto von Dentz
168c741b64 Query and make use of the current configuration. 2009-03-26 15:40:04 -03:00
Luiz Augusto von Dentz
071b3e7fc5 Update ipc to match new message headers introduced on BlueZ 4.34. 2009-03-26 15:40:04 -03:00
Luiz Augusto von Dentz
b03c545850 Fix misuse of 'frame.joint' when estimating the frame length.
'frame.joint' is not the flag for joint stereo mode, it is a set of bits which
show for which subbands channels joining was actually used.
2009-03-26 15:40:03 -03:00
Luiz Augusto von Dentz
f80a1f6d31 Maintain the original code style for sbc. 2009-03-26 15:40:03 -03:00
Colin Guthrie
205cbe8afc raop: Add call to pa_sink_set_max_request()
This is just a copy from the ESD version which is a little crude, but will do for now.
2009-03-25 23:05:41 +00:00
Lennart Poettering
cbbd98635a make sure the discovery module is only loaded once 2009-03-25 23:49:09 +01:00
Lennart Poettering
4edb109239 use u->use_tsched everywhere 2009-03-25 16:17:45 +01:00
Lennart Poettering
119698ae91 beef up esd sink properties a bit 2009-03-25 01:18:29 +01:00
Lennart Poettering
fdbe0543be initialize max_request to SO_SNDBUF 2009-03-25 01:17:56 +01:00
Lennart Poettering
98a5f4a991 don't fiddle with latency range in sources with static latency 2009-03-25 00:45:13 +01:00
Lennart Poettering
d0bd3d9592 initialize max_request 2009-03-25 00:44:36 +01:00
Lennart Poettering
bcfe51ffd5 again, don't fiddle with latency range in sinks with static latency 2009-03-25 00:44:21 +01:00