[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, stable-queue, updated. v0.9.21-32-g84782f2
Lennart Poettering
gitmailer-noreply at 0pointer.de
Sun Jan 17 16:35:55 PST 2010
This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.
The stable-queue branch has been updated
from fa64230107bd348ceda271dc9db74765c694d311 (commit)
- Log -----------------------------------------------------------------
84782f2 native: rework handling of seeks that depend on variables the client does not know anything about
52c66b4 libpulse: Store pa_stream pointers to hashmaps instead of dynarrays.
fd5c802 Fix the following warnings (which now cause buildd failures in Ubuntu 10.04):
09c416e More src/pulsecore/cpu-arm.c FTBFS fixes
8c7148a udev: Use SOUND_CLASS instead of SOUND_FORM_FACTOR when checking for modem
a2418ef threaded-mainloop: Properly initialise m->n_waiting_for_accept to prevent deadlock
66e1a2d alsa: add profile set for M-Audio FastTrack Pro USB
86144ee client: include dolby channel names in comments
-----------------------------------------------------------------------
Summary of changes:
.../alsa/mixer/profile-sets/90-pulseaudio.rules | 1 +
...nts-audio4dj.conf => maudio-fasttrack-pro.conf} | 52 +++++++++-----------
src/modules/module-combine.c | 4 +-
src/modules/module-loopback.c | 4 +-
src/modules/module-udev-detect.c | 2 +-
src/pulse/channelmap.h | 20 ++++----
src/pulse/context.c | 12 ++--
src/pulse/internal.h | 3 +-
src/pulse/stream.c | 25 ++++++----
src/pulse/thread-mainloop.c | 1 +
src/pulsecore/cpu-arm.c | 6 ++-
src/pulsecore/memblockq.c | 6 ++-
src/pulsecore/memblockq.h | 2 +-
src/pulsecore/protocol-native.c | 6 ++-
src/pulsecore/sink-input.c | 2 +-
15 files changed, 77 insertions(+), 69 deletions(-)
copy src/modules/alsa/mixer/profile-sets/{native-instruments-audio4dj.conf => maudio-fasttrack-pro.conf} (64%)
-----------------------------------------------------------------------
commit 86144ee6cb6af54903a8d3d8395751ae26a4d134
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Jan 14 21:32:26 2010 +0100
client: include dolby channel names in comments
diff --git a/src/pulse/channelmap.h b/src/pulse/channelmap.h
index 469effc..d1d5c8b 100644
--- a/src/pulse/channelmap.h
+++ b/src/pulse/channelmap.h
@@ -74,9 +74,9 @@ typedef enum pa_channel_position {
PA_CHANNEL_POSITION_INVALID = -1,
PA_CHANNEL_POSITION_MONO = 0,
- PA_CHANNEL_POSITION_FRONT_LEFT, /* Apple calls this 'Left' */
- PA_CHANNEL_POSITION_FRONT_RIGHT, /* Apple calls this 'Right' */
- PA_CHANNEL_POSITION_FRONT_CENTER, /* Apple calls this 'Center' */
+ PA_CHANNEL_POSITION_FRONT_LEFT, /* Apple, Dolby call this 'Left' */
+ PA_CHANNEL_POSITION_FRONT_RIGHT, /* Apple, Dolby call this 'Right' */
+ PA_CHANNEL_POSITION_FRONT_CENTER, /* Apple, Dolby call this 'Center' */
/** \cond fulldocs */
PA_CHANNEL_POSITION_LEFT = PA_CHANNEL_POSITION_FRONT_LEFT,
@@ -84,20 +84,20 @@ typedef enum pa_channel_position {
PA_CHANNEL_POSITION_CENTER = PA_CHANNEL_POSITION_FRONT_CENTER,
/** \endcond */
- PA_CHANNEL_POSITION_REAR_CENTER, /* Microsoft calls this 'Back Center', Apple calls this 'Center Surround' */
- PA_CHANNEL_POSITION_REAR_LEFT, /* Microsoft calls this 'Back Left', Apple calls this 'Left Surround' */
- PA_CHANNEL_POSITION_REAR_RIGHT, /* Microsoft calls this 'Back Right', Apple calls this 'Right Surround' */
+ PA_CHANNEL_POSITION_REAR_CENTER, /* Microsoft calls this 'Back Center', Apple calls this 'Center Surround', Dolby calls this 'Surround Rear Center' */
+ PA_CHANNEL_POSITION_REAR_LEFT, /* Microsoft calls this 'Back Left', Apple calls this 'Left Surround' (!), Dolby calls this 'Surround Rear Left' */
+ PA_CHANNEL_POSITION_REAR_RIGHT, /* Microsoft calls this 'Back Right', Apple calls this 'Right Surround' (!), Dolby calls this 'Surround Rear Right' */
PA_CHANNEL_POSITION_LFE, /* Microsoft calls this 'Low Frequency', Apple calls this 'LFEScreen' */
/** \cond fulldocs */
PA_CHANNEL_POSITION_SUBWOOFER = PA_CHANNEL_POSITION_LFE,
/** \endcond */
- PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER, /* Apple calls this 'Left Center' */
- PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER, /* Apple calls this 'Right Center */
+ PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER, /* Apple, Dolby call this 'Left Center' */
+ PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER, /* Apple, Dolby call this 'Right Center */
- PA_CHANNEL_POSITION_SIDE_LEFT, /* Apple calls this 'Left Surround Direct' */
- PA_CHANNEL_POSITION_SIDE_RIGHT, /* Apple calls this 'Right Surround Direct' */
+ PA_CHANNEL_POSITION_SIDE_LEFT, /* Apple calls this 'Left Surround Direct', Dolby calls this 'Surround Left' (!) */
+ PA_CHANNEL_POSITION_SIDE_RIGHT, /* Apple calls this 'Right Surround Direct', Dolby calls this 'Surround Right' (!) */
PA_CHANNEL_POSITION_AUX0,
PA_CHANNEL_POSITION_AUX1,
commit 66e1a2d05139d7968d41d9f1a88c22093cdd04d5
Author: David KÃ¥gedal <davidk at lysator.liu.se>
Date: Tue Jan 5 20:14:11 2010 +0100
alsa: add profile set for M-Audio FastTrack Pro USB
diff --git a/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules b/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules
index ea1a2fe..b8e88d0 100644
--- a/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules
+++ b/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules
@@ -22,5 +22,6 @@ KERNEL!="card*", GOTO="pulseaudio_end"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="17cc", ATTRS{idProduct}=="1978", ENV{PULSE_PROFILE_SET}="native-instruments-audio8dj.conf"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="17cc", ATTRS{idProduct}=="0839", ENV{PULSE_PROFILE_SET}="native-instruments-audio4dj.conf"
+SUBSYSTEMS=="usb", ATTRS{idVendor}=="0763", ATTRS{idProduct}=="2012", ENV{PULSE_PROFILE_SET}="maudio-fasttrack-pro.conf"
LABEL="pulseaudio_end"
diff --git a/src/modules/alsa/mixer/profile-sets/maudio-fasttrack-pro.conf b/src/modules/alsa/mixer/profile-sets/maudio-fasttrack-pro.conf
new file mode 100644
index 0000000..75f5112
--- /dev/null
+++ b/src/modules/alsa/mixer/profile-sets/maudio-fasttrack-pro.conf
@@ -0,0 +1,85 @@
+# This file is part of PulseAudio.
+#
+# PulseAudio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+#
+# PulseAudio is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with PulseAudio; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+
+; M-Audio FastTrack Pro
+;
+; This card has one duplex stereo channel called A and an additional
+; stereo output channel called B.
+;
+; We knowingly only define a subset of the theoretically possible
+; mapping combinations as profiles here.
+;
+; See default.conf for an explanation on the directives used here.
+
+[General]
+auto-profiles = no
+
+[Mapping analog-stereo-a-output]
+description = Analog Stereo Channel A
+device-strings = hw:%f,0,0
+channel-map = left,right
+direction = output
+
+[Mapping analog-stereo-a-input]
+description = Analog Stereo Channel A
+device-strings = hw:%f,0,0
+channel-map = left,right
+direction = input
+
+[Mapping analog-stereo-b-output]
+description = Analog Stereo Channel B
+device-strings = hw:%f,1,0
+channel-map = left,right
+direction = output
+
+[Profile output:analog-stereo-all+input:analog-stereo-all]
+description = Analog Stereo Duplex Channel A, Analog Stereo output Channel B
+output-mappings = analog-stereo-a-output analog-stereo-b-output
+input-mappings = analog-stereo-a-input
+priority = 100
+skip-probe = yes
+
+[Profile output:analog-stereo-a-output+input:analog-stereo-a-input]
+description = Analog Stereo Duplex Channel A
+output-mappings = analog-stereo-a-output
+input-mappings = analog-stereo-a-input
+priority = 40
+skip-probe = yes
+
+[Profile output:analog-stereo-b+input:analog-stereo-b]
+description = Analog Stereo Output Channel B
+output-mappings = analog-stereo-b-output
+input-mappings =
+priority = 50
+skip-probe = yes
+
+[Profile output:analog-stereo-a]
+description = Analog Stereo Output Channel A
+output-mappings = analog-stereo-a-output
+priority = 5
+skip-probe = yes
+
+[Profile output:analog-stereo-b]
+description = Analog Stereo Output Channel B
+output-mappings = analog-stereo-b-output
+priority = 6
+skip-probe = yes
+
+[Profile input:analog-stereo-a]
+description = Analog Stereo Input Channel A
+input-mappings = analog-stereo-a-input
+priority = 2
+skip-probe = yes
commit a2418effe7c4bc54390939ccd07dd6227e6cdfa5
Author: Daniel T Chen <crimsun at ubuntu.com>
Date: Mon Jan 4 21:44:37 2010 -0500
threaded-mainloop: Properly initialise m->n_waiting_for_accept to prevent deadlock
Compiler optimisations have been seen to initialise
m->n_waiting_for_accept to a positive non-zero value, so the while() in
pa_threaded_mainloop_signal() never proceeds. Fix this by properly
initializing m->n_waiting_for_accept in pa_threaded_mainloop_new().
Patch from Iain BucÅaw.
https://bugs.launchpad.net/bugs/502992
diff --git a/src/pulse/thread-mainloop.c b/src/pulse/thread-mainloop.c
index 14ed926..1693404 100644
--- a/src/pulse/thread-mainloop.c
+++ b/src/pulse/thread-mainloop.c
@@ -116,6 +116,7 @@ pa_threaded_mainloop *pa_threaded_mainloop_new(void) {
pa_mainloop_set_poll_func(m->real_mainloop, poll_func, m->mutex);
m->n_waiting = 0;
+ m->n_waiting_for_accept = 0;
return m;
}
commit 8c7148a4eaecd687a004b0611748452fd4b41e92
Author: Daniel T Chen <crimsun at ubuntu.com>
Date: Mon Jan 4 21:53:36 2010 -0500
udev: Use SOUND_CLASS instead of SOUND_FORM_FACTOR when checking for modem
The fact whether an ALSA card is a modem is stored in the SOUND_CLASS,
not the SOUND_FORM_FACTOR property. So read it from there.
Patch from Whoopie.
diff --git a/src/modules/module-udev-detect.c b/src/modules/module-udev-detect.c
index b8568b2..3cf3e58 100644
--- a/src/modules/module-udev-detect.c
+++ b/src/modules/module-udev-detect.c
@@ -426,7 +426,7 @@ static void process_device(struct userdata *u, struct udev_device *dev) {
return;
}
- if ((ff = udev_device_get_property_value(dev, "SOUND_FORM_FACTOR")) &&
+ if ((ff = udev_device_get_property_value(dev, "SOUND_CLASS")) &&
pa_streq(ff, "modem")) {
pa_log_debug("Ignoring %s, because it is a modem.", udev_device_get_devpath(dev));
return;
commit 09c416e11fe4f53c468f68ad0a67f4696241050a
Author: Daniel T Chen <crimsun at ubuntu.com>
Date: Wed Dec 16 23:55:05 2009 -0500
More src/pulsecore/cpu-arm.c FTBFS fixes
Fix missing argument to pa_read(), and be consistent with declaration of
state variable in pa_cpu_init_arm().
Signed-off-by: Daniel T Chen <crimsun at ubuntu.com>
diff --git a/src/pulsecore/cpu-arm.c b/src/pulsecore/cpu-arm.c
index 453b784..61299cc 100644
--- a/src/pulsecore/cpu-arm.c
+++ b/src/pulsecore/cpu-arm.c
@@ -67,7 +67,7 @@ static char *get_cpuinfo(void) {
return NULL;
}
- if ((n = pa_read(fd, cpuinfo, MAX_BUFFER-1)) < 0) {
+ if ((n = pa_read(fd, cpuinfo, MAX_BUFFER-1, NULL)) < 0) {
pa_xfree(cpuinfo);
pa_close(fd);
return NULL;
@@ -105,7 +105,8 @@ void pa_cpu_init_arm (void) {
}
/* get the CPU features */
if ((line = get_cpuinfo_line (cpuinfo, "Features"))) {
- char *state = NULL, *current;
+ const char *state = NULL;
+ char *current;
while ((current = pa_split_spaces (line, &state))) {
if (!strcmp (current, "vfp"))
commit fd5c802ecb5ae5ed9b294422410761126a37d1b3
Author: Daniel T Chen <crimsun at ubuntu.com>
Date: Wed Dec 16 22:53:18 2009 -0500
Fix the following warnings (which now cause buildd failures in Ubuntu 10.04):
pulsecore/cpu-arm.c: In function 'get_cpuinfo':
pulsecore/cpu-arm.c:70: warning: implicit declaration of function 'pa_read' [-Wimplicit-function-declaration]
pulsecore/cpu-arm.c:72: warning: implicit declaration of function 'pa_close' [-Wimplicit-function-declaration]
pulsecore/cpu-arm.c: In function 'pa_cpu_init_arm':
pulsecore/cpu-arm.c:110: warning: implicit declaration of function 'pa_split_spaces' [-Wimplicit-function-declaration]
pulsecore/cpu-arm.c:110: warning: assignment makes pointer from integer without a cast
Function `pa_split_spaces' implicitly converted to pointer at pulsecore/cpu-arm.c:110
Signed-off-by: Daniel T Chen <crimsun at ubuntu.com>
diff --git a/src/pulsecore/cpu-arm.c b/src/pulsecore/cpu-arm.c
index 61299cc..56d0bbc 100644
--- a/src/pulsecore/cpu-arm.c
+++ b/src/pulsecore/cpu-arm.c
@@ -30,6 +30,7 @@
#include <fcntl.h>
#include <pulse/xmalloc.h>
+#include <pulsecore/core-util.h>
#include <pulsecore/log.h>
#include "cpu-arm.h"
commit 52c66b47664d47154b2c8368e32beef27d4b2d03
Author: Tanu Kaskinen <ext-tanu.kaskinen at nokia.com>
Date: Thu Dec 3 13:22:05 2009 +0200
libpulse: Store pa_stream pointers to hashmaps instead of dynarrays.
Since the stream identifiers (channels) are monotonically growing integer, it
isn't a good idea to use them as index to a dynamic array, because the array
will grow all the time. This is not a problem with client connections that
don't create many streams, but, for example, long-running clients that use
libcanberra for playing event sounds, this means that the client connection
effectively leaks memory.
diff --git a/src/pulse/context.c b/src/pulse/context.c
index c83230d..91f4817 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -63,7 +63,7 @@
#include <pulsecore/native-common.h>
#include <pulsecore/pdispatch.h>
#include <pulsecore/pstream.h>
-#include <pulsecore/dynarray.h>
+#include <pulsecore/hashmap.h>
#include <pulsecore/socket-client.h>
#include <pulsecore/pstream-util.h>
#include <pulsecore/core-rtclock.h>
@@ -157,8 +157,8 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char *
c->system_bus = c->session_bus = NULL;
#endif
c->mainloop = mainloop;
- c->playback_streams = pa_dynarray_new();
- c->record_streams = pa_dynarray_new();
+ c->playback_streams = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
+ c->record_streams = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
c->client_index = PA_INVALID_INDEX;
c->use_rtclock = pa_mainloop_is_our_api(mainloop);
@@ -252,9 +252,9 @@ static void context_free(pa_context *c) {
#endif
if (c->record_streams)
- pa_dynarray_free(c->record_streams, NULL, NULL);
+ pa_hashmap_free(c->record_streams, NULL, NULL);
if (c->playback_streams)
- pa_dynarray_free(c->playback_streams, NULL, NULL);
+ pa_hashmap_free(c->playback_streams, NULL, NULL);
if (c->mempool)
pa_mempool_free(c->mempool);
@@ -361,7 +361,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
pa_context_ref(c);
- if ((s = pa_dynarray_get(c->record_streams, channel))) {
+ if ((s = pa_hashmap_get(c->record_streams, PA_UINT32_TO_PTR(channel)))) {
if (chunk->memblock) {
pa_memblockq_seek(s->record_memblockq, offset, seek, TRUE);
diff --git a/src/pulse/internal.h b/src/pulse/internal.h
index c3ebf74..ab702b9 100644
--- a/src/pulse/internal.h
+++ b/src/pulse/internal.h
@@ -34,7 +34,6 @@
#include <pulsecore/socket-client.h>
#include <pulsecore/pstream.h>
#include <pulsecore/pdispatch.h>
-#include <pulsecore/dynarray.h>
#include <pulsecore/llist.h>
#include <pulsecore/native-common.h>
#include <pulsecore/strlist.h>
@@ -66,7 +65,7 @@ struct pa_context {
pa_pstream *pstream;
pa_pdispatch *pdispatch;
- pa_dynarray *record_streams, *playback_streams;
+ pa_hashmap *record_streams, *playback_streams;
PA_LLIST_HEAD(pa_stream, streams);
PA_LLIST_HEAD(pa_operation, operations);
diff --git a/src/pulse/stream.c b/src/pulse/stream.c
index daeb53a..ab8f8f4 100644
--- a/src/pulse/stream.c
+++ b/src/pulse/stream.c
@@ -201,7 +201,7 @@ static void stream_unlink(pa_stream *s) {
pa_pdispatch_unregister_reply(s->context->pdispatch, s);
if (s->channel_valid) {
- pa_dynarray_put((s->direction == PA_STREAM_PLAYBACK) ? s->context->playback_streams : s->context->record_streams, s->channel, NULL);
+ pa_hashmap_remove((s->direction == PA_STREAM_PLAYBACK) ? s->context->playback_streams : s->context->record_streams, PA_UINT32_TO_PTR(s->channel));
s->channel = 0;
s->channel_valid = FALSE;
}
@@ -356,7 +356,7 @@ void pa_command_stream_killed(pa_pdispatch *pd, uint32_t command, uint32_t tag,
goto finish;
}
- if (!(s = pa_dynarray_get(command == PA_COMMAND_PLAYBACK_STREAM_KILLED ? c->playback_streams : c->record_streams, channel)))
+ if (!(s = pa_hashmap_get(command == PA_COMMAND_PLAYBACK_STREAM_KILLED ? c->playback_streams : c->record_streams, PA_UINT32_TO_PTR(channel))))
goto finish;
if (s->state != PA_STREAM_READY)
@@ -476,7 +476,7 @@ void pa_command_stream_moved(pa_pdispatch *pd, uint32_t command, uint32_t tag, p
goto finish;
}
- if (!(s = pa_dynarray_get(command == PA_COMMAND_PLAYBACK_STREAM_MOVED ? c->playback_streams : c->record_streams, channel)))
+ if (!(s = pa_hashmap_get(command == PA_COMMAND_PLAYBACK_STREAM_MOVED ? c->playback_streams : c->record_streams, PA_UINT32_TO_PTR(channel))))
goto finish;
if (s->state != PA_STREAM_READY)
@@ -559,7 +559,7 @@ void pa_command_stream_buffer_attr(pa_pdispatch *pd, uint32_t command, uint32_t
goto finish;
}
- if (!(s = pa_dynarray_get(command == PA_COMMAND_PLAYBACK_BUFFER_ATTR_CHANGED ? c->playback_streams : c->record_streams, channel)))
+ if (!(s = pa_hashmap_get(command == PA_COMMAND_PLAYBACK_BUFFER_ATTR_CHANGED ? c->playback_streams : c->record_streams, PA_UINT32_TO_PTR(channel))))
goto finish;
if (s->state != PA_STREAM_READY)
@@ -611,7 +611,7 @@ void pa_command_stream_suspended(pa_pdispatch *pd, uint32_t command, uint32_t ta
goto finish;
}
- if (!(s = pa_dynarray_get(command == PA_COMMAND_PLAYBACK_STREAM_SUSPENDED ? c->playback_streams : c->record_streams, channel)))
+ if (!(s = pa_hashmap_get(command == PA_COMMAND_PLAYBACK_STREAM_SUSPENDED ? c->playback_streams : c->record_streams, PA_UINT32_TO_PTR(channel))))
goto finish;
if (s->state != PA_STREAM_READY)
@@ -653,7 +653,7 @@ void pa_command_stream_started(pa_pdispatch *pd, uint32_t command, uint32_t tag,
goto finish;
}
- if (!(s = pa_dynarray_get(c->playback_streams, channel)))
+ if (!(s = pa_hashmap_get(c->playback_streams, PA_UINT32_TO_PTR(channel))))
goto finish;
if (s->state != PA_STREAM_READY)
@@ -699,7 +699,7 @@ void pa_command_stream_event(pa_pdispatch *pd, uint32_t command, uint32_t tag, p
goto finish;
}
- if (!(s = pa_dynarray_get(command == PA_COMMAND_PLAYBACK_STREAM_EVENT ? c->playback_streams : c->record_streams, channel)))
+ if (!(s = pa_hashmap_get(command == PA_COMMAND_PLAYBACK_STREAM_EVENT ? c->playback_streams : c->record_streams, PA_UINT32_TO_PTR(channel))))
goto finish;
if (s->state != PA_STREAM_READY)
@@ -735,7 +735,7 @@ void pa_command_request(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tag
goto finish;
}
- if (!(s = pa_dynarray_get(c->playback_streams, channel)))
+ if (!(s = pa_hashmap_get(c->playback_streams, PA_UINT32_TO_PTR(channel))))
goto finish;
if (s->state != PA_STREAM_READY)
@@ -771,7 +771,7 @@ void pa_command_overflow_or_underflow(pa_pdispatch *pd, uint32_t command, uint32
goto finish;
}
- if (!(s = pa_dynarray_get(c->playback_streams, channel)))
+ if (!(s = pa_hashmap_get(c->playback_streams, PA_UINT32_TO_PTR(channel))))
goto finish;
if (s->state != PA_STREAM_READY)
@@ -1019,7 +1019,7 @@ void pa_create_stream_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag,
}
s->channel_valid = TRUE;
- pa_dynarray_put((s->direction == PA_STREAM_RECORD) ? s->context->record_streams : s->context->playback_streams, s->channel, s);
+ pa_hashmap_put((s->direction == PA_STREAM_RECORD) ? s->context->record_streams : s->context->playback_streams, PA_UINT32_TO_PTR(s->channel), s);
create_stream_complete(s);
commit 84782f24c5f43456430c796bd12f9face24f0573
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Jan 18 01:33:04 2010 +0100
native: rework handling of seeks that depend on variables the client does not know anything about
All seeks/flushes that depend on the playback buffer read pointer cannot
be accounted for properly in the client since it does not know the
actual read pointer. Due to that the clients do not account for it at
all. We need do the same on the server side. And we did, but a little
bit too extreme. While we properly have not applied the changes to the
"request" counter we still do have to apply it to the "missing" counter.
This patch fixes that.
diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c
index 62e6267..cffb901 100644
--- a/src/modules/module-combine.c
+++ b/src/modules/module-combine.c
@@ -562,7 +562,7 @@ static int sink_input_process_msg(pa_msgobject *obj, int code, void *data, int64
if (PA_SINK_IS_OPENED(o->sink_input->sink->thread_info.state))
pa_memblockq_push_align(o->memblockq, chunk);
else
- pa_memblockq_flush_write(o->memblockq);
+ pa_memblockq_flush_write(o->memblockq, TRUE);
return 0;
}
@@ -982,7 +982,7 @@ static void output_disable(struct output *o) {
o->sink_input = NULL;
/* Finally, drop all queued data */
- pa_memblockq_flush_write(o->memblockq);
+ pa_memblockq_flush_write(o->memblockq, TRUE);
pa_asyncmsgq_flush(o->inq, FALSE);
pa_asyncmsgq_flush(o->outq, FALSE);
}
diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c
index bb0182b..15ef96e 100644
--- a/src/modules/module-loopback.c
+++ b/src/modules/module-loopback.c
@@ -430,7 +430,7 @@ static int sink_input_process_msg_cb(pa_msgobject *obj, int code, void *data, in
if (PA_SINK_IS_OPENED(u->sink_input->sink->thread_info.state))
pa_memblockq_push_align(u->memblockq, chunk);
else
- pa_memblockq_flush_write(u->memblockq);
+ pa_memblockq_flush_write(u->memblockq, TRUE);
update_min_memblockq_length(u);
@@ -457,7 +457,7 @@ static int sink_input_process_msg_cb(pa_msgobject *obj, int code, void *data, in
if (PA_SINK_IS_OPENED(u->sink_input->sink->thread_info.state))
pa_memblockq_seek(u->memblockq, -offset, PA_SEEK_RELATIVE, TRUE);
else
- pa_memblockq_flush_write(u->memblockq);
+ pa_memblockq_flush_write(u->memblockq, TRUE);
u->recv_counter -= offset;
diff --git a/src/pulse/stream.c b/src/pulse/stream.c
index ab8f8f4..8da40ec 100644
--- a/src/pulse/stream.c
+++ b/src/pulse/stream.c
@@ -2146,6 +2146,11 @@ pa_operation* pa_stream_flush(pa_stream *s, pa_stream_success_cb_t cb, void *use
* index, but the read index might jump. */
invalidate_indexes(s, TRUE, FALSE);
+ /* Note that we do not update requested_bytes here. This is
+ * because we cannot really know how data actually was dropped
+ * from the write index due to this. This 'error' will be applied
+ * by both client and server and hence we should be fine. */
+
return o;
}
diff --git a/src/pulsecore/memblockq.c b/src/pulsecore/memblockq.c
index 4641801..2b063fa 100644
--- a/src/pulsecore/memblockq.c
+++ b/src/pulsecore/memblockq.c
@@ -254,6 +254,8 @@ static void write_index_changed(pa_memblockq *bq, int64_t old_write_index, pa_bo
if (account)
bq->requested -= delta;
+ else
+ bq->missing -= delta;
/* pa_log("pushed/seeked %lli: requested counter at %lli, account=%i", (long long) delta, (long long) bq->requested, account); */
}
@@ -642,7 +644,7 @@ void pa_memblockq_seek(pa_memblockq *bq, int64_t offset, pa_seek_mode_t seek, pa
write_index_changed(bq, old, account);
}
-void pa_memblockq_flush_write(pa_memblockq *bq) {
+void pa_memblockq_flush_write(pa_memblockq *bq, pa_bool_t account) {
int64_t old;
pa_assert(bq);
@@ -652,7 +654,7 @@ void pa_memblockq_flush_write(pa_memblockq *bq) {
bq->write_index = bq->read_index;
pa_memblockq_prebuf_force(bq);
- write_index_changed(bq, old, TRUE);
+ write_index_changed(bq, old, account);
}
void pa_memblockq_flush_read(pa_memblockq *bq) {
diff --git a/src/pulsecore/memblockq.h b/src/pulsecore/memblockq.h
index 587c364..6132f31 100644
--- a/src/pulsecore/memblockq.h
+++ b/src/pulsecore/memblockq.h
@@ -118,7 +118,7 @@ size_t pa_memblockq_pop_missing(pa_memblockq *bq);
int pa_memblockq_splice(pa_memblockq *bq, pa_memblockq *source);
/* Set the queue to silence, set write index to read index */
-void pa_memblockq_flush_write(pa_memblockq *bq);
+void pa_memblockq_flush_write(pa_memblockq *bq, pa_bool_t account);
/* Set the queue to silence, set write read index to write index*/
void pa_memblockq_flush_read(pa_memblockq *bq);
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index b7b3f59..f80b0c2 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -1325,6 +1325,10 @@ static void handle_seek(playback_stream *s, int64_t indexw) {
playback_stream_request_bytes(s);
}
+static void flush_write_no_account(pa_memblockq *q) {
+ pa_memblockq_flush_write(q, FALSE);
+}
+
/* Called from thread context */
static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offset, pa_memchunk *chunk) {
pa_sink_input *i = PA_SINK_INPUT(o);
@@ -1386,7 +1390,7 @@ static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int
switch (code) {
case SINK_INPUT_MESSAGE_FLUSH:
- func = pa_memblockq_flush_write;
+ func = flush_write_no_account;
break;
case SINK_INPUT_MESSAGE_PREBUF_FORCE:
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index aa84ccb..7acb25f 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -801,7 +801,7 @@ void pa_sink_input_process_rewind(pa_sink_input *i, size_t nbytes /* in sink sam
/* We were asked to drop all buffered data, and rerequest new
* data from implementor the next time push() is called */
- pa_memblockq_flush_write(i->thread_info.render_memblockq);
+ pa_memblockq_flush_write(i->thread_info.render_memblockq, TRUE);
} else if (i->thread_info.rewrite_nbytes > 0) {
size_t max_rewrite, amount;
--
hooks/post-receive
PulseAudio Sound Server
More information about the pulseaudio-commits
mailing list