~diwic/ubuntu/lucid/pulseaudio/bugfixes

« back to all changes in this revision

Viewing changes to src/pulsecore/thread-mq.c

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2008-11-04 15:46:00 UTC
  • mfrom: (1.2.1 upstream) (1.1.6 lenny)
  • Revision ID: james.westby@ubuntu.com-20081104154600-hlzknpcazaam0nxm
Tags: 0.9.13-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Don't build against, and create jack package. Jack is not in main.
  - Remove --disable-per-user-esound-socket from configure flags, as we still
    want per user esound sockets.
  - Remove stop links from rc0 and rc6.
  - Change default resample algorithm and bubffer size.
  - Add alsa configuration files to route alsa applications via pulseaudio.
  - Move libasound2-plugins from Recommends to Depends.
* debian/pulseaudio.preinst: When upgrading from intrepid, remove
  /etc/X11/Xsession.d/70pulseaudio, as this was used to minimize a race
  condition when starting GNOME in intrepid. This race should not exist in
  jaunty once libcanberra is built to use pulseaudio as a backend.
* Do not spawn a pulseaudio server if clients fail to find a running server.
* Remove explicit version dependency for libspeex-dev to allow the package
  to be built for now.
* Regenerate autotools files to work with Ubuntu's newer libtool/libltdl.
* debian/control: libpulsecore5 -> libpulsecore8 to match the library
  soname.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id$ */
2
 
 
3
1
/***
4
2
  This file is part of PulseAudio.
5
3
 
43
41
 
44
42
PA_STATIC_TLS_DECLARE_NO_FREE(thread_mq);
45
43
 
46
 
static void asyncmsgq_cb(pa_mainloop_api*api, pa_io_event* e, int fd, pa_io_event_flags_t events, void *userdata) {
 
44
static void asyncmsgq_read_cb(pa_mainloop_api*api, pa_io_event* e, int fd, pa_io_event_flags_t events, void *userdata) {
47
45
    pa_thread_mq *q = userdata;
48
46
    pa_asyncmsgq *aq;
49
47
 
50
 
    pa_assert(pa_asyncmsgq_get_fd(q->outq) == fd);
 
48
    pa_assert(pa_asyncmsgq_read_fd(q->outq) == fd);
51
49
    pa_assert(events == PA_IO_EVENT_INPUT);
52
50
 
53
51
    pa_asyncmsgq_ref(aq = q->outq);
54
 
    pa_asyncmsgq_after_poll(aq);
 
52
    pa_asyncmsgq_write_after_poll(aq);
55
53
 
56
54
    for (;;) {
57
55
        pa_msgobject *object;
68
66
            pa_asyncmsgq_done(aq, ret);
69
67
        }
70
68
 
71
 
        if (pa_asyncmsgq_before_poll(aq) == 0)
 
69
        if (pa_asyncmsgq_read_before_poll(aq) == 0)
72
70
            break;
73
71
    }
74
72
 
75
73
    pa_asyncmsgq_unref(aq);
76
74
}
77
75
 
78
 
void pa_thread_mq_init(pa_thread_mq *q, pa_mainloop_api *mainloop) {
 
76
static void asyncmsgq_write_cb(pa_mainloop_api*api, pa_io_event* e, int fd, pa_io_event_flags_t events, void *userdata) {
 
77
    pa_thread_mq *q = userdata;
 
78
 
 
79
    pa_assert(pa_asyncmsgq_write_fd(q->inq) == fd);
 
80
    pa_assert(events == PA_IO_EVENT_INPUT);
 
81
 
 
82
    pa_asyncmsgq_write_after_poll(q->inq);
 
83
    pa_asyncmsgq_write_before_poll(q->inq);
 
84
}
 
85
 
 
86
void pa_thread_mq_init(pa_thread_mq *q, pa_mainloop_api *mainloop, pa_rtpoll *rtpoll) {
79
87
    pa_assert(q);
80
88
    pa_assert(mainloop);
81
89
 
83
91
    pa_assert_se(q->inq = pa_asyncmsgq_new(0));
84
92
    pa_assert_se(q->outq = pa_asyncmsgq_new(0));
85
93
 
86
 
    pa_assert_se(pa_asyncmsgq_before_poll(q->outq) == 0);
87
 
    pa_assert_se(q->io_event = mainloop->io_new(mainloop, pa_asyncmsgq_get_fd(q->outq), PA_IO_EVENT_INPUT, asyncmsgq_cb, q));
 
94
    pa_assert_se(pa_asyncmsgq_read_before_poll(q->outq) == 0);
 
95
    pa_assert_se(q->read_event = mainloop->io_new(mainloop, pa_asyncmsgq_read_fd(q->outq), PA_IO_EVENT_INPUT, asyncmsgq_read_cb, q));
 
96
 
 
97
    pa_asyncmsgq_write_before_poll(q->inq);
 
98
    pa_assert_se(q->write_event = mainloop->io_new(mainloop, pa_asyncmsgq_write_fd(q->inq), PA_IO_EVENT_INPUT, asyncmsgq_write_cb, q));
 
99
 
 
100
    pa_rtpoll_item_new_asyncmsgq_read(rtpoll, PA_RTPOLL_EARLY, q->inq);
 
101
    pa_rtpoll_item_new_asyncmsgq_write(rtpoll, PA_RTPOLL_LATE, q->outq);
88
102
}
89
103
 
90
104
void pa_thread_mq_done(pa_thread_mq *q) {
91
105
    pa_assert(q);
92
106
 
93
 
    q->mainloop->io_free(q->io_event);
94
 
    q->io_event = NULL;
 
107
    q->mainloop->io_free(q->read_event);
 
108
    q->mainloop->io_free(q->write_event);
 
109
    q->read_event = q->write_event = NULL;
95
110
 
96
111
    pa_asyncmsgq_unref(q->inq);
97
112
    pa_asyncmsgq_unref(q->outq);