diff options
author | Matthew Gregan <[email protected]> | 2012-05-07 12:14:12 +1200 |
---|---|---|
committer | Matthew Gregan <[email protected]> | 2012-05-07 12:14:12 +1200 |
commit | d7368445b56327015cad554cb62a4be31051ed4e (patch) | |
tree | 2f588991f736e961606837bd48c61c4f9e8c29e3 | |
parent | f2c941de0ed68f0d267228cde35ef9b612546f78 (diff) | |
download | cubeb-d7368445b56327015cad554cb62a4be31051ed4e.tar.gz cubeb-d7368445b56327015cad554cb62a4be31051ed4e.zip |
pulse: address mwu\'s review comments from bmo# 751030.
-rw-r--r-- | src/cubeb_pulse.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/cubeb_pulse.c b/src/cubeb_pulse.c index 26857f7..de86171 100644 --- a/src/cubeb_pulse.c +++ b/src/cubeb_pulse.c @@ -192,6 +192,7 @@ cubeb_init(cubeb ** context, char const * context_name) *context = NULL; ctx = calloc(1, sizeof(*ctx)); + assert(ctx); ctx->mainloop = pa_threaded_mainloop_new(); ctx->context = pa_context_new(pa_threaded_mainloop_get_api(ctx->mainloop), context_name); @@ -247,6 +248,8 @@ cubeb_stream_init(cubeb * context, cubeb_stream ** stream, char const * stream_n pa_buffer_attr battr; pa_channel_map map; + assert(context); + *stream = NULL; if (stream_params.rate < 1 || stream_params.rate > 192000 || @@ -282,7 +285,6 @@ cubeb_stream_init(cubeb * context, cubeb_stream ** stream, char const * stream_n assert(stm); stm->context = context; - assert(stm->context); stm->data_callback = data_callback; stm->state_callback = state_callback; @@ -291,7 +293,7 @@ cubeb_stream_init(cubeb * context, cubeb_stream ** stream, char const * stream_n stm->sample_spec = ss; battr.maxlength = -1; - battr.tlength = pa_usec_to_bytes(latency * 1000, &stm->sample_spec); + battr.tlength = pa_usec_to_bytes(latency * PA_USEC_PER_MSEC, &stm->sample_spec); battr.prebuf = -1; battr.minreq = battr.tlength / 2; battr.fragsize = -1; @@ -371,7 +373,6 @@ cubeb_stream_get_position(cubeb_stream * stm, uint64_t * position) return CUBEB_ERROR; } - /* XXX might be more accurate to compute directly from get_timing_info */ bytes = pa_usec_to_bytes(r_usec, &stm->sample_spec); *position = bytes / pa_frame_size(&stm->sample_spec); |