Bug 861936 - Allow calling cubeb_stream_get_position while in the callback when using the pulseaudio backend. r=kinetik

This commit is contained in:
Paul Adenot 2013-04-17 14:02:01 +02:00
Родитель 09c0944c7e
Коммит 480557614f
2 изменённых файлов: 12 добавлений и 4 удалений

Просмотреть файл

@ -5,4 +5,4 @@ Makefile.in build files for the Mozilla build system.
The cubeb git repository is: git://github.com/kinetiknz/cubeb.git
The git commit ID used was a2f8aca29015dc0c0e0ac67e3710cd2df5d042c4.
The git commit ID used was 951a3c6a88aa723e222715a89bfdc65f547ddf9e.

Просмотреть файл

@ -43,6 +43,7 @@ MAKE_TYPEDEF(pa_stream_write);
MAKE_TYPEDEF(pa_threaded_mainloop_free);
MAKE_TYPEDEF(pa_threaded_mainloop_get_api);
MAKE_TYPEDEF(pa_threaded_mainloop_lock);
MAKE_TYPEDEF(pa_threaded_mainloop_in_thread);
MAKE_TYPEDEF(pa_threaded_mainloop_new);
MAKE_TYPEDEF(pa_threaded_mainloop_signal);
MAKE_TYPEDEF(pa_threaded_mainloop_start);
@ -296,6 +297,7 @@ pulse_init(cubeb ** context, char const * context_name)
LOAD(pa_threaded_mainloop_free);
LOAD(pa_threaded_mainloop_get_api);
LOAD(pa_threaded_mainloop_lock);
LOAD(pa_threaded_mainloop_in_thread);
LOAD(pa_threaded_mainloop_new);
LOAD(pa_threaded_mainloop_signal);
LOAD(pa_threaded_mainloop_start);
@ -494,13 +496,19 @@ pulse_stream_stop(cubeb_stream * stm)
static int
pulse_stream_get_position(cubeb_stream * stm, uint64_t * position)
{
int r;
int r, in_thread;
pa_usec_t r_usec;
uint64_t bytes;
WRAP(pa_threaded_mainloop_lock)(stm->context->mainloop);
in_thread = WRAP(pa_threaded_mainloop_in_thread)(stm->context->mainloop);
if (!in_thread) {
WRAP(pa_threaded_mainloop_lock)(stm->context->mainloop);
}
r = WRAP(pa_stream_get_time)(stm->stream, &r_usec);
WRAP(pa_threaded_mainloop_unlock)(stm->context->mainloop);
if (!in_thread) {
WRAP(pa_threaded_mainloop_unlock)(stm->context->mainloop);
}
if (r != 0) {
return CUBEB_ERROR;