simple: set ADJUST_LATENCY by default

This commit is contained in:
Lennart Poettering 2009-05-27 23:18:55 +02:00
parent 19d7ced40d
commit 6601e09929

View file

@ -50,35 +50,38 @@ struct pa_simple {
int operation_success; int operation_success;
}; };
#define CHECK_VALIDITY_RETURN_ANY(rerror, expression, error, ret) do { \ #define CHECK_VALIDITY_RETURN_ANY(rerror, expression, error, ret) \
if (!(expression)) { \ do { \
if (rerror) \ if (!(expression)) { \
*(rerror) = error; \ if (rerror) \
return (ret); \ *(rerror) = error; \
} \ return (ret); \
} while(0); } \
} while(FALSE);
#define CHECK_SUCCESS_GOTO(p, rerror, expression, label) do { \ #define CHECK_SUCCESS_GOTO(p, rerror, expression, label) \
if (!(expression)) { \ do { \
if (rerror) \ if (!(expression)) { \
*(rerror) = pa_context_errno((p)->context); \ if (rerror) \
goto label; \ *(rerror) = pa_context_errno((p)->context); \
} \ goto label; \
} while(0); } \
} while(FALSE);
#define CHECK_DEAD_GOTO(p, rerror, label) do { \ #define CHECK_DEAD_GOTO(p, rerror, label) \
if (!(p)->context || pa_context_get_state((p)->context) != PA_CONTEXT_READY || \ do { \
!(p)->stream || pa_stream_get_state((p)->stream) != PA_STREAM_READY) { \ if (!(p)->context || pa_context_get_state((p)->context) != PA_CONTEXT_READY || \
if (((p)->context && pa_context_get_state((p)->context) == PA_CONTEXT_FAILED) || \ !(p)->stream || pa_stream_get_state((p)->stream) != PA_STREAM_READY) { \
((p)->stream && pa_stream_get_state((p)->stream) == PA_STREAM_FAILED)) { \ if (((p)->context && pa_context_get_state((p)->context) == PA_CONTEXT_FAILED) || \
if (rerror) \ ((p)->stream && pa_stream_get_state((p)->stream) == PA_STREAM_FAILED)) { \
*(rerror) = pa_context_errno((p)->context); \ if (rerror) \
} else \ *(rerror) = pa_context_errno((p)->context); \
if (rerror) \ } else \
*(rerror) = PA_ERR_BADSTATE; \ if (rerror) \
goto label; \ *(rerror) = PA_ERR_BADSTATE; \
} \ goto label; \
} while(0); } \
} while(FALSE);
static void context_state_cb(pa_context *c, void *userdata) { static void context_state_cb(pa_context *c, void *userdata) {
pa_simple *p = userdata; pa_simple *p = userdata;
@ -198,9 +201,15 @@ pa_simple* pa_simple_new(
pa_stream_set_latency_update_callback(p->stream, stream_latency_update_cb, p); pa_stream_set_latency_update_callback(p->stream, stream_latency_update_cb, p);
if (dir == PA_STREAM_PLAYBACK) if (dir == PA_STREAM_PLAYBACK)
r = pa_stream_connect_playback(p->stream, dev, attr, PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE, NULL, NULL); r = pa_stream_connect_playback(p->stream, dev, attr,
PA_STREAM_INTERPOLATE_TIMING
|PA_STREAM_ADJUST_LATENCY
|PA_STREAM_AUTO_TIMING_UPDATE, NULL, NULL);
else else
r = pa_stream_connect_record(p->stream, dev, attr, PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE); r = pa_stream_connect_record(p->stream, dev, attr,
PA_STREAM_INTERPOLATE_TIMING
|PA_STREAM_ADJUST_LATENCY
|PA_STREAM_AUTO_TIMING_UPDATE);
if (r < 0) { if (r < 0) {
error = pa_context_errno(p->context); error = pa_context_errno(p->context);