diff options
Diffstat (limited to 'src/pulse')
-rw-r--r-- | src/pulse/context.c | 19 | ||||
-rw-r--r-- | src/pulse/introspect.c | 12 | ||||
-rw-r--r-- | src/pulse/introspect.h | 4 | ||||
-rw-r--r-- | src/pulse/util.c | 6 |
4 files changed, 28 insertions, 13 deletions
diff --git a/src/pulse/context.c b/src/pulse/context.c index 8686e0de..9309c6b7 100644 --- a/src/pulse/context.c +++ b/src/pulse/context.c @@ -335,8 +335,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o pa_assert(p); pa_assert(chunk); - pa_assert(chunk->memblock); - pa_assert(chunk->length); + pa_assert(chunk->length > 0); pa_assert(c); pa_assert(PA_REFCNT_VALUE(c) >= 1); @@ -344,11 +343,11 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o if ((s = pa_dynarray_get(c->record_streams, channel))) { - pa_assert(seek == PA_SEEK_RELATIVE); - pa_assert(offset == 0); - - pa_memblockq_seek(s->record_memblockq, offset, seek); - pa_memblockq_push_align(s->record_memblockq, chunk); + if (chunk->memblock) { + pa_memblockq_seek(s->record_memblockq, offset, seek); + pa_memblockq_push_align(s->record_memblockq, chunk); + } else + pa_memblockq_seek(s->record_memblockq, offset+chunk->length, seek); if (s->read_callback) { size_t l; @@ -555,6 +554,7 @@ static void setup_context(pa_context *c, pa_iochannel *io) { pa_context_unref(c); } +#if ENABLE_LEGACY_RUNTIME_DIR static char *get_old_legacy_runtime_dir(void) { char *p, u[128]; struct stat st; @@ -598,10 +598,12 @@ static char *get_very_old_legacy_runtime_dir(void) { return p; } - +#endif static pa_strlist *prepend_per_user(pa_strlist *l) { char *ufn; + +#if ENABLE_LEGACY_RUNTIME_DIR static char *legacy_dir; /* The very old per-user instance path (< 0.9.11). This is supported only to ease upgrades */ @@ -619,6 +621,7 @@ static pa_strlist *prepend_per_user(pa_strlist *l) { pa_xfree(p); pa_xfree(legacy_dir); } +#endif /* The per-user instance */ if ((ufn = pa_runtime_path(PA_NATIVE_DEFAULT_UNIX_SOCKET))) { diff --git a/src/pulse/introspect.c b/src/pulse/introspect.c index 1d50939c..04bcd4f5 100644 --- a/src/pulse/introspect.c +++ b/src/pulse/introspect.c @@ -162,6 +162,7 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u i.n_volume_steps = PA_VOLUME_NORM+1; mute = FALSE; state = PA_SINK_INVALID_STATE; + i.card = PA_INVALID_INDEX; if (pa_tagstruct_getu32(t, &i.index) < 0 || pa_tagstruct_gets(t, &i.name) < 0 || @@ -182,7 +183,8 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u (o->context->version >= 15 && (pa_tagstruct_get_volume(t, &i.base_volume) < 0 || pa_tagstruct_getu32(t, &state) < 0 || - pa_tagstruct_getu32(t, &i.n_volume_steps) < 0))) { + pa_tagstruct_getu32(t, &i.n_volume_steps) < 0 || + pa_tagstruct_getu32(t, &i.card) < 0))) { pa_context_fail(o->context, PA_ERR_PROTOCOL); pa_proplist_free(i.proplist); @@ -293,6 +295,7 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command, i.n_volume_steps = PA_VOLUME_NORM+1; mute = FALSE; state = PA_SOURCE_INVALID_STATE; + i.card = PA_INVALID_INDEX; if (pa_tagstruct_getu32(t, &i.index) < 0 || pa_tagstruct_gets(t, &i.name) < 0 || @@ -313,7 +316,8 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command, (o->context->version >= 15 && (pa_tagstruct_get_volume(t, &i.base_volume) < 0 || pa_tagstruct_getu32(t, &state) < 0 || - pa_tagstruct_getu32(t, &i.n_volume_steps) < 0))) { + pa_tagstruct_getu32(t, &i.n_volume_steps) < 0 || + pa_tagstruct_getu32(t, &i.card) < 0))) { pa_context_fail(o->context, PA_ERR_PROTOCOL); pa_proplist_free(i.proplist); @@ -517,7 +521,9 @@ static void context_get_card_info_callback(pa_pdispatch *pd, uint32_t command, u for (j = 0; j < i.n_profiles; j++) { if (pa_tagstruct_gets(t, &i.profiles[j].name) < 0 || - pa_tagstruct_gets(t, &i.profiles[j].description) < 0) { + pa_tagstruct_gets(t, &i.profiles[j].description) < 0 || + pa_tagstruct_getu32(t, &i.profiles[j].n_sinks) < 0 || + pa_tagstruct_getu32(t, &i.profiles[j].n_sources)< 0) { pa_context_fail(o->context, PA_ERR_PROTOCOL); pa_xfree(i.profiles); diff --git a/src/pulse/introspect.h b/src/pulse/introspect.h index badc787e..b873a84a 100644 --- a/src/pulse/introspect.h +++ b/src/pulse/introspect.h @@ -215,6 +215,7 @@ typedef struct pa_sink_info { pa_volume_t base_volume; /**< Some kind of "base" volume that refers to unamplified/unattenuated volume in the context of the output device. \since 0.9.15 */ pa_sink_state_t state; /**< State \since 0.9.15 */ uint32_t n_volume_steps; /**< Number of volume steps for sinks which do not support arbitrary volumes. \since 0.9.15 */ + uint32_t card; /**< Card index, or PA_INVALID_INDEX. \since 0.9.15 */ } pa_sink_info; /** Callback prototype for pa_context_get_sink_info_by_name() and friends */ @@ -273,6 +274,7 @@ typedef struct pa_source_info { pa_volume_t base_volume; /**< Some kind of "base" volume that refers to unamplified/unattenuated volume in the context of the input device. \since 0.9.15 */ pa_source_state_t state; /**< State \since 0.9.15 */ uint32_t n_volume_steps; /**< Number of volume steps for sources which do not support arbitrary volumes. \since 0.9.15 */ + uint32_t card; /**< Card index, or PA_INVALID_INDEX. \since 0.9.15 */ } pa_source_info; /** Callback prototype for pa_context_get_source_info_by_name() and friends */ @@ -396,6 +398,8 @@ pa_operation* pa_context_kill_client(pa_context *c, uint32_t idx, pa_context_suc typedef struct pa_card_profile_info { const char *name; /**< Name of this profile */ const char *description; /**< Description of this profile */ + uint32_t n_sinks; /**< Number of sinks this profile would create */ + uint32_t n_sources; /**< Number of sources this profile would create */ } pa_card_profile_info; /** Stores information about cards. Please note that this structure diff --git a/src/pulse/util.c b/src/pulse/util.c index b20ea46a..54a188d5 100644 --- a/src/pulse/util.c +++ b/src/pulse/util.c @@ -54,6 +54,8 @@ #endif #include <pulse/xmalloc.h> +#include <pulse/timeval.h> + #include <pulsecore/winsock.h> #include <pulsecore/core-error.h> #include <pulsecore/log.h> @@ -260,8 +262,8 @@ int pa_msleep(unsigned long t) { #elif defined(HAVE_NANOSLEEP) struct timespec ts; - ts.tv_sec = (time_t) (t/1000UL); - ts.tv_nsec = (long) ((t % 1000UL) * 1000000UL); + ts.tv_sec = (time_t) (t / PA_MSEC_PER_SEC); + ts.tv_nsec = (long) ((t % PA_MSEC_PER_SEC) * PA_NSEC_PER_MSEC); return nanosleep(&ts, NULL); #else |