Trigger move callback a little bit earlier so that no IO thread is running

This commit is contained in:
Lennart Poettering 2009-03-30 18:21:34 +02:00
parent e3f15104cf
commit d04f3e1aef
5 changed files with 17 additions and 17 deletions

View file

@ -203,7 +203,7 @@ enum {
static int sink_input_pop_cb(pa_sink_input *i, size_t length, pa_memchunk *chunk);
static void sink_input_kill_cb(pa_sink_input *i);
static void sink_input_suspend_cb(pa_sink_input *i, pa_bool_t suspend);
static void sink_input_moved_cb(pa_sink_input *i);
static void sink_input_moving_cb(pa_sink_input *i);
static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes);
static void sink_input_update_max_rewind_cb(pa_sink_input *i, size_t nbytes);
static void sink_input_update_max_request_cb(pa_sink_input *i, size_t nbytes);
@ -215,7 +215,7 @@ static void playback_stream_request_bytes(struct playback_stream*s);
static void source_output_kill_cb(pa_source_output *o);
static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk);
static void source_output_suspend_cb(pa_source_output *o, pa_bool_t suspend);
static void source_output_moved_cb(pa_source_output *o);
static void source_output_moving_cb(pa_source_output *o);
static pa_usec_t source_output_get_latency_cb(pa_source_output *o);
static void source_output_send_event_cb(pa_source_output *o, const char *event, pa_proplist *pl);
@ -636,7 +636,7 @@ static record_stream* record_stream_new(
s->source_output->push = source_output_push_cb;
s->source_output->kill = source_output_kill_cb;
s->source_output->get_latency = source_output_get_latency_cb;
s->source_output->moved = source_output_moved_cb;
s->source_output->moving = source_output_moving_cb;
s->source_output->suspend = source_output_suspend_cb;
s->source_output->send_event = source_output_send_event_cb;
s->source_output->userdata = s;
@ -1049,7 +1049,7 @@ static playback_stream* playback_stream_new(
s->sink_input->update_max_rewind = sink_input_update_max_rewind_cb;
s->sink_input->update_max_request = sink_input_update_max_request_cb;
s->sink_input->kill = sink_input_kill_cb;
s->sink_input->moved = sink_input_moved_cb;
s->sink_input->moving = sink_input_moving_cb;
s->sink_input->suspend = sink_input_suspend_cb;
s->sink_input->send_event = sink_input_send_event_cb;
s->sink_input->userdata = s;
@ -1539,7 +1539,7 @@ static void sink_input_suspend_cb(pa_sink_input *i, pa_bool_t suspend) {
}
/* Called from main context */
static void sink_input_moved_cb(pa_sink_input *i) {
static void sink_input_moving_cb(pa_sink_input *i) {
playback_stream *s;
pa_tagstruct *t;
uint32_t maxlength, tlength, prebuf, minreq;
@ -1661,7 +1661,7 @@ static void source_output_suspend_cb(pa_source_output *o, pa_bool_t suspend) {
}
/* Called from main context */
static void source_output_moved_cb(pa_source_output *o) {
static void source_output_moving_cb(pa_source_output *o) {
record_stream *s;
pa_tagstruct *t;
uint32_t maxlength, fragsize;

View file

@ -117,7 +117,7 @@ static void reset_callbacks(pa_sink_input *i) {
i->attach = NULL;
i->detach = NULL;
i->suspend = NULL;
i->moved = NULL;
i->moving = NULL;
i->kill = NULL;
i->get_latency = NULL;
i->state_change = NULL;
@ -1169,6 +1169,9 @@ int pa_sink_input_finish_move(pa_sink_input *i, pa_sink *dest, pa_bool_t save) {
} else
new_resampler = NULL;
if (i->moving)
i->moving(i);
i->sink = dest;
i->save_sink = save;
pa_idxset_put(dest->inputs, i, NULL);
@ -1195,7 +1198,6 @@ int pa_sink_input_finish_move(pa_sink_input *i, pa_sink *dest, pa_bool_t save) {
0,
&i->sink->silence);
}
pa_sink_update_status(dest);
if (i->sink->flags & PA_SINK_FLAT_VOLUME) {
@ -1216,9 +1218,6 @@ int pa_sink_input_finish_move(pa_sink_input *i, pa_sink *dest, pa_bool_t save) {
pa_log_debug("Successfully moved sink input %i to %s.", i->index, dest->name);
/* Notify everyone */
if (i->moved)
i->moved(i);
pa_hook_fire(&i->core->hooks[PA_CORE_HOOK_SINK_INPUT_MOVE_FINISH], i);
pa_subscription_post(i->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_CHANGE, i->index);

View file

@ -150,7 +150,7 @@ struct pa_sink_input {
/* If non-NULL called whenever the the sink this input is attached
* to changes. Called from main context */
void (*moved) (pa_sink_input *i); /* may be NULL */
void (*moving) (pa_sink_input *i); /* may be NULL */
/* Supposed to unlink and destroy this stream. Called from main
* context. */

View file

@ -87,7 +87,7 @@ static void reset_callbacks(pa_source_output *o) {
o->attach = NULL;
o->detach = NULL;
o->suspend = NULL;
o->moved = NULL;
o->moving = NULL;
o->kill = NULL;
o->get_latency = NULL;
o->state_change = NULL;
@ -749,6 +749,9 @@ int pa_source_output_finish_move(pa_source_output *o, pa_source *dest, pa_bool_t
} else
new_resampler = NULL;
if (o->moving)
o->moving(o);
o->source = dest;
o->save_source = save;
pa_idxset_put(o->source->outputs, o, NULL);
@ -776,14 +779,12 @@ int pa_source_output_finish_move(pa_source_output *o, pa_source *dest, pa_bool_t
}
pa_source_update_status(dest);
pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o->source), PA_SOURCE_MESSAGE_ADD_OUTPUT, o, 0, NULL) == 0);
pa_log_debug("Successfully moved source output %i to %s.", o->index, dest->name);
/* Notify everyone */
if (o->moved)
o->moved(o);
pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_FINISH], o);
pa_subscription_post(o->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_CHANGE, o->index);

View file

@ -122,7 +122,7 @@ struct pa_source_output {
/* If non-NULL called whenever the the source this output is attached
* to changes. Called from main context */
void (*moved) (pa_source_output *o); /* may be NULL */
void (*moving) (pa_source_output *o); /* may be NULL */
/* Supposed to unlink and destroy this stream. Called from main
* context. */