pulse: wait for READY before calling callbacks

This commit is contained in:
Wim Taymans 2020-07-07 13:42:56 +02:00
parent e030445e49
commit 2991a814cd
2 changed files with 4 additions and 4 deletions

View file

@ -139,7 +139,7 @@ void pa_context_fail(PA_CONST pa_context *c, int error);
#define PA_CHECK_VALIDITY(context, expression, error) \
do { \
if (!(expression)) { \
pw_log_trace("'%s' failed at %s:%u %s()", \
pw_log_debug("'%s' failed at %s:%u %s()", \
#expression, __FILE__, __LINE__, __func__); \
return -pa_context_set_error((context), (error)); \
} \
@ -148,7 +148,7 @@ do { \
#define PA_CHECK_VALIDITY_RETURN_ANY(context, expression, error, value) \
do { \
if (!(expression)) { \
pw_log_trace("'%s' failed at %s:%u %s()", \
pw_log_debug("'%s' failed at %s:%u %s()", \
#expression, __FILE__, __LINE__, __func__); \
pa_context_set_error((context), (error)); \
return value; \

View file

@ -554,13 +554,13 @@ static void stream_process(void *data)
if (s->direction == PA_STREAM_PLAYBACK) {
queue_output(s);
if (s->write_callback)
if (s->write_callback && s->state == PA_STREAM_READY)
s->write_callback(s, s->maxblock, s->write_userdata);
}
else {
pull_input(s);
if (s->read_callback && s->ready_bytes > 0)
if (s->read_callback && s->ready_bytes > 0 && s->state == PA_STREAM_READY)
s->read_callback(s, s->ready_bytes, s->read_userdata);
}
}