common: Refactor input stream closing a bit.
This commit is contained in:
parent
1f6e402f82
commit
1866de8e8d
1 changed files with 4 additions and 11 deletions
|
|
@ -1510,13 +1510,13 @@ done:
|
|||
static void input_stream_close(pa_droid_stream *s) {
|
||||
pa_assert(s);
|
||||
pa_assert(s->input);
|
||||
pa_assert(s->input->stream);
|
||||
|
||||
if (!s->input->stream)
|
||||
return;
|
||||
|
||||
pa_mutex_lock(s->module->input_mutex);
|
||||
set_active_input(s->module, NULL);
|
||||
s->input->stream->common.standby(&s->input->stream->common);
|
||||
s->module->device->close_input_stream(s->module->device, s->input->stream);
|
||||
s->input->stream = NULL;
|
||||
pa_log_debug("Closed input stream %p", (void *) s);
|
||||
|
|
@ -1580,14 +1580,8 @@ void pa_droid_stream_unref(pa_droid_stream *s) {
|
|||
pa_xfree(s->output);
|
||||
} else {
|
||||
pa_log_debug("Destroy input stream %p", (void *) s);
|
||||
set_active_input(s->module, NULL);
|
||||
pa_mutex_lock(s->module->input_mutex);
|
||||
pa_idxset_remove_by_data(s->module->inputs, s, NULL);
|
||||
if (s->input->stream) {
|
||||
s->input->stream->common.standby(&s->input->stream->common);
|
||||
s->module->device->close_input_stream(s->module->device, s->input->stream);
|
||||
}
|
||||
pa_mutex_unlock(s->module->input_mutex);
|
||||
input_stream_close(s);
|
||||
pa_xfree(s->input);
|
||||
}
|
||||
|
||||
|
|
@ -1812,10 +1806,9 @@ int pa_droid_stream_suspend(pa_droid_stream *s, bool suspend) {
|
|||
} else {
|
||||
if (suspend) {
|
||||
if (s->input->stream) {
|
||||
if (pa_droid_quirk(s->module, QUIRK_CLOSE_INPUT)) {
|
||||
s->input->stream->common.standby(&s->input->stream->common);
|
||||
if (pa_droid_quirk(s->module, QUIRK_CLOSE_INPUT))
|
||||
input_stream_close(s);
|
||||
} else
|
||||
else
|
||||
return stream_standby(s);
|
||||
}
|
||||
} else if (pa_droid_quirk(s->module, QUIRK_CLOSE_INPUT))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue