i->get_latency = NULL;
i->userdata = NULL;
- i->corked = 0;
i->volume = PA_VOLUME_NORM;
i->resampled_chunk.memblock = NULL;
}
void pa_sink_input_disconnect(struct pa_sink_input *i) {
- assert(i && i->state == PA_SINK_INPUT_RUNNING && i->sink && i->sink->core);
+ assert(i && i->state != PA_SINK_INPUT_DISCONNECTED && i->sink && i->sink->core);
pa_idxset_remove_by_data(i->sink->core->sink_inputs, i, NULL);
pa_idxset_remove_by_data(i->sink->inputs, i, NULL);
if (!i->peek || !i->drop)
return -1;
- if (i->corked)
+ if (i->state == PA_SINK_INPUT_CORKED)
return -1;
if (!i->resampler)
void pa_sink_input_cork(struct pa_sink_input *i, int b) {
int n;
assert(i && i->ref >= 1);
-
- n = i->corked && !b;
- i->corked = b;
+
+ if (i->state == PA_SINK_INPUT_DISCONNECTED)
+ return;
+
+ n = i->state == PA_SINK_INPUT_CORKED && !b;
+ i->state = b ? PA_SINK_INPUT_CORKED : PA_SINK_INPUT_RUNNING;
if (n)
pa_sink_notify(i->sink);