jack: don't emit bufsize_callback from activate()

We just check the initial size of the buffer and remember that, we
should not emit (or schedule) a bufsize change callback.

Emiting the callback should really only be done after the buffer size
changes after activate completed.

Fixes some jconvolver startup problems.
This commit is contained in:
Wim Taymans 2021-09-08 11:24:57 +02:00
parent 4562ef4ed0
commit 8f88792a9a

View file

@ -1159,12 +1159,13 @@ do_buffer_frames(struct spa_loop *loop,
return 0; return 0;
} }
static inline void check_buffer_frames(struct client *c, struct spa_io_position *pos) static inline void check_buffer_frames(struct client *c, struct spa_io_position *pos, bool emit)
{ {
uint32_t buffer_frames = pos->clock.duration; uint32_t buffer_frames = pos->clock.duration;
if (SPA_UNLIKELY(buffer_frames != c->buffer_frames)) { if (SPA_UNLIKELY(buffer_frames != c->buffer_frames)) {
pw_log_info(NAME" %p: bufferframes %d", c, buffer_frames); pw_log_info(NAME" %p: bufferframes %d", c, buffer_frames);
c->buffer_frames = buffer_frames; c->buffer_frames = buffer_frames;
if (emit)
pw_loop_invoke(c->context.l, do_buffer_frames, 0, pw_loop_invoke(c->context.l, do_buffer_frames, 0,
&buffer_frames, sizeof(buffer_frames), false, c); &buffer_frames, sizeof(buffer_frames), false, c);
} }
@ -1228,7 +1229,7 @@ static inline uint32_t cycle_run(struct client *c)
return 0; return 0;
} }
check_buffer_frames(c, pos); check_buffer_frames(c, pos, true);
check_sample_rate(c, pos); check_sample_rate(c, pos);
if (SPA_LIKELY(driver)) { if (SPA_LIKELY(driver)) {
@ -3312,7 +3313,7 @@ int jack_activate (jack_client_t *client)
c->active = true; c->active = true;
if (c->position) if (c->position)
check_buffer_frames(c, c->position); check_buffer_frames(c, c->position, false);
do_callback(c, graph_callback, c->graph_arg); do_callback(c, graph_callback, c->graph_arg);