diff options
author | Felipe Sateler <fsateler@debian.org> | 2017-09-05 19:43:54 -0300 |
---|---|---|
committer | Felipe Sateler <fsateler@debian.org> | 2017-09-05 19:43:54 -0300 |
commit | ca2caf1bf96616b01894110ad45c2c41a4265812 (patch) | |
tree | 1b7d3298f95555149c28e9b5e2be7b4446587369 /src | |
parent | aafa305f5f4ddaf6ed627d3f68c8925e54e18508 (diff) |
New upstream version 11.0
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/bluetooth/module-bluez5-device.c | 13 | ||||
-rw-r--r-- | src/modules/echo-cancel/module-echo-cancel.c | 6 | ||||
-rw-r--r-- | src/modules/module-tunnel-sink-new.c | 15 | ||||
-rw-r--r-- | src/modules/module-tunnel-source-new.c | 12 | ||||
-rw-r--r-- | src/pulse/version.h | 6 | ||||
-rw-r--r-- | src/pulsecore/conf-parser.c | 42 | ||||
-rw-r--r-- | src/pulsecore/core.c | 6 | ||||
-rw-r--r-- | src/utils/pacat.c | 6 |
8 files changed, 98 insertions, 8 deletions
diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c index 12a4984..c0e681b 100644 --- a/src/modules/bluetooth/module-bluez5-device.c +++ b/src/modules/bluetooth/module-bluez5-device.c @@ -1607,6 +1607,12 @@ static int start_thread(struct userdata *u) { if (u->sink) { pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq); pa_sink_set_rtpoll(u->sink, u->rtpoll); + + /* If we are in the headset role, the sink should not become default + * unless there is no other sound device available. */ + if (u->profile == PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY) + u->sink->priority = 1500; + pa_sink_put(u->sink); if (u->sink->set_volume) @@ -1616,6 +1622,13 @@ static int start_thread(struct userdata *u) { if (u->source) { pa_source_set_asyncmsgq(u->source, u->thread_mq.inq); pa_source_set_rtpoll(u->source, u->rtpoll); + + /* If we are in the headset role or the device is an a2dp source, + * the source should not become default unless there is no other + * sound device available. */ + if (u->profile == PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY || u->profile == PA_BLUETOOTH_PROFILE_A2DP_SOURCE) + u->source->priority = 1500; + pa_source_put(u->source); if (u->source->set_volume) diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c index a1eeace..b28d60a 100644 --- a/src/modules/echo-cancel/module-echo-cancel.c +++ b/src/modules/echo-cancel/module-echo-cancel.c @@ -2054,11 +2054,13 @@ int pa__init(pa_module*m) { /* We don't want to deal with too many chunks at a time */ blocksize_usec = pa_bytes_to_usec(u->source_blocksize, &u->source->sample_spec); - pa_source_set_latency_range(u->source, blocksize_usec, blocksize_usec * MAX_LATENCY_BLOCKS); + if (u->source->flags & PA_SOURCE_DYNAMIC_LATENCY) + pa_source_set_latency_range(u->source, blocksize_usec, blocksize_usec * MAX_LATENCY_BLOCKS); pa_source_output_set_requested_latency(u->source_output, blocksize_usec * MAX_LATENCY_BLOCKS); blocksize_usec = pa_bytes_to_usec(u->sink_blocksize, &u->sink->sample_spec); - pa_sink_set_latency_range(u->sink, blocksize_usec, blocksize_usec * MAX_LATENCY_BLOCKS); + if (u->sink->flags & PA_SINK_DYNAMIC_LATENCY) + pa_sink_set_latency_range(u->sink, blocksize_usec, blocksize_usec * MAX_LATENCY_BLOCKS); pa_sink_input_set_requested_latency(u->sink_input, blocksize_usec * MAX_LATENCY_BLOCKS); /* The order here is important. The input/output must be put first, diff --git a/src/modules/module-tunnel-sink-new.c b/src/modules/module-tunnel-sink-new.c index dd6c886..7962a5a 100644 --- a/src/modules/module-tunnel-sink-new.c +++ b/src/modules/module-tunnel-sink-new.c @@ -38,6 +38,7 @@ #include <pulsecore/thread.h> #include <pulsecore/thread-mq.h> #include <pulsecore/poll.h> +#include <pulsecore/rtpoll.h> #include <pulsecore/proplist-util.h> #include "module-tunnel-sink-new-symdef.h" @@ -77,6 +78,7 @@ struct userdata { pa_context *context; pa_stream *stream; + pa_rtpoll *rtpoll; bool update_stream_bufferattr_after_connect; @@ -503,6 +505,15 @@ int pa__init(pa_module *m) { goto fail; } + /* The rtpoll created here is never run. It is only necessary to avoid crashes + * when module-tunnel-sink-new is used together with module-loopback or + * module-combine-sink. Both modules base their asyncmsq on the rtpoll provided + * by the sink. module-loopback and combine-sink only work because they call + * pa_asyncmsq_process_one() themselves. module_rtp_recv also uses the rtpoll, + * but never calls pa_asyncmsq_process_one(), so it will not work in combination + * with module-tunnel-sink-new. */ + u->rtpoll = pa_rtpoll_new(); + /* Create sink */ pa_sink_new_data_init(&sink_data); sink_data.driver = __FILE__; @@ -541,6 +552,7 @@ int pa__init(pa_module *m) { /* set thread message queue */ pa_sink_set_asyncmsgq(u->sink, u->thread_mq->inq); + pa_sink_set_rtpoll(u->sink, u->rtpoll); if (!(u->thread = pa_thread_new("tunnel-sink", thread_func, u))) { pa_log("Failed to create thread."); @@ -601,5 +613,8 @@ void pa__done(pa_module *m) { if (u->sink) pa_sink_unref(u->sink); + if (u->rtpoll) + pa_rtpoll_free(u->rtpoll); + pa_xfree(u); } diff --git a/src/modules/module-tunnel-source-new.c b/src/modules/module-tunnel-source-new.c index 2db928c..f547911 100644 --- a/src/modules/module-tunnel-source-new.c +++ b/src/modules/module-tunnel-source-new.c @@ -38,6 +38,7 @@ #include <pulsecore/thread.h> #include <pulsecore/thread-mq.h> #include <pulsecore/poll.h> +#include <pulsecore/rtpoll.h> #include <pulsecore/proplist-util.h> #include "module-tunnel-source-new-symdef.h" @@ -75,6 +76,7 @@ struct userdata { pa_context *context; pa_stream *stream; + pa_rtpoll *rtpoll; bool update_stream_bufferattr_after_connect; bool connected; @@ -502,6 +504,12 @@ int pa__init(pa_module *m) { goto fail; } + /* The rtpoll created here is never run. It is only necessary to avoid crashes + * when module-tunnel-source-new is used together with module-loopback. + * module-loopback bases the asyncmsq on the rtpoll provided by the source and + * only works because it calls pa_asyncmsq_process_one(). */ + u->rtpoll = pa_rtpoll_new(); + /* Create source */ pa_source_new_data_init(&source_data); source_data.driver = __FILE__; @@ -538,6 +546,7 @@ int pa__init(pa_module *m) { u->source->update_requested_latency = source_update_requested_latency_cb; pa_source_set_asyncmsgq(u->source, u->thread_mq->inq); + pa_source_set_rtpoll(u->source, u->rtpoll); if (!(u->thread = pa_thread_new("tunnel-source", thread_func, u))) { pa_log("Failed to create thread."); @@ -598,5 +607,8 @@ void pa__done(pa_module *m) { if (u->source) pa_source_unref(u->source); + if (u->rtpoll) + pa_rtpoll_free(u->rtpoll); + pa_xfree(u); } diff --git a/src/pulse/version.h b/src/pulse/version.h index cc61e12..06b09e1 100644 --- a/src/pulse/version.h +++ b/src/pulse/version.h @@ -33,7 +33,7 @@ PA_C_DECL_BEGIN /** Return the version of the header files. Keep in mind that this is a macro and not a function, so it is impossible to get the pointer of it. */ -#define pa_get_headers_version() ("10.99.0") +#define pa_get_headers_version() ("11.0.0") /** Return the version of the library the current application is * linked to. */ @@ -50,10 +50,10 @@ const char* pa_get_library_version(void); #define PA_PROTOCOL_VERSION 32 /** The major version of PA. \since 0.9.15 */ -#define PA_MAJOR 10 +#define PA_MAJOR 11 /** The minor version of PA. \since 0.9.15 */ -#define PA_MINOR 99 +#define PA_MINOR 0 /** The micro version of PA (will always be 0 from v1.0 onwards). \since 0.9.15 */ #define PA_MICRO 0 diff --git a/src/pulsecore/conf-parser.c b/src/pulsecore/conf-parser.c index 60345ad..73b7061 100644 --- a/src/pulsecore/conf-parser.c +++ b/src/pulsecore/conf-parser.c @@ -153,9 +153,11 @@ static int parse_line(pa_config_parser_state *state) { return normal_assignment(state); } +#ifndef OS_IS_WIN32 static int conf_filter(const struct dirent *entry) { return pa_endswith(entry->d_name, ".conf"); } +#endif /* Go through the file and parse each line */ int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, pa_proplist *proplist, bool use_dot_d, @@ -218,6 +220,45 @@ finish: fclose(f); if (use_dot_d) { +#ifdef OS_IS_WIN32 + char *dir_name = pa_sprintf_malloc("%s.d", filename); + char *pattern = pa_sprintf_malloc("%s\\*.conf", dir_name); + HANDLE fh; + WIN32_FIND_DATA wfd; + + fh = FindFirstFile(pattern, &wfd); + if (fh != INVALID_HANDLE_VALUE) { + do { + if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { + char *filename2 = pa_sprintf_malloc("%s\\%s", dir_name, wfd.cFileName); + pa_config_parse(filename2, NULL, t, proplist, false, userdata); + pa_xfree(filename2); + } + } while (FindNextFile(fh, &wfd)); + FindClose(fh); + } else { + DWORD err = GetLastError(); + + if (err == ERROR_PATH_NOT_FOUND) { + pa_log_debug("Pattern %s did not match any files, ignoring.", pattern); + } else { + LPVOID msgbuf; + DWORD fret = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&msgbuf, 0, NULL); + + if (fret != 0) { + pa_log_warn("FindFirstFile(%s) failed with error %ld (%s), ignoring.", pattern, err, (char*)msgbuf); + LocalFree(msgbuf); + } else { + pa_log_warn("FindFirstFile(%s) failed with error %ld, ignoring.", pattern, err); + pa_log_warn("FormatMessage failed with error %ld", GetLastError()); + } + } + } + + pa_xfree(pattern); + pa_xfree(dir_name); +#else char *dir_name; int n; struct dirent **entries = NULL; @@ -247,6 +288,7 @@ finish: } pa_xfree(dir_name); +#endif } return r; diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c index e01677d..454c566 100644 --- a/src/pulsecore/core.c +++ b/src/pulsecore/core.c @@ -315,6 +315,9 @@ void pa_core_update_default_sink(pa_core *core) { pa_assert(core); PA_IDXSET_FOREACH(sink, core->sinks, idx) { + if (!PA_SINK_IS_LINKED(sink->state)) + continue; + if (!best) { best = sink; continue; @@ -399,6 +402,9 @@ void pa_core_update_default_source(pa_core *core) { pa_assert(core); PA_IDXSET_FOREACH(source, core->sources, idx) { + if (!PA_SOURCE_IS_LINKED(source->state)) + continue; + if (!best) { best = source; continue; diff --git a/src/utils/pacat.c b/src/utils/pacat.c index 4e1bbfc..6c4db4b 100644 --- a/src/utils/pacat.c +++ b/src/utils/pacat.c @@ -251,11 +251,11 @@ static void stream_read_callback(pa_stream *s, size_t length, void *userdata) { /* If there is a hole in the stream, we generate silence, except * if it's a passthrough stream in which case we skip the hole. */ if (data || !(flags & PA_STREAM_PASSTHROUGH)) { - buffer = pa_xrealloc(buffer, buffer_length + length); + buffer = pa_xrealloc(buffer, buffer_index + buffer_length + length); if (data) - memcpy((uint8_t *) buffer + buffer_length, data, length); + memcpy((uint8_t *) buffer + buffer_index + buffer_length, data, length); else - pa_silence_memory((uint8_t *) buffer + buffer_length, length, &sample_spec); + pa_silence_memory((uint8_t *) buffer + buffer_index + buffer_length, length, &sample_spec); buffer_length += length; } |