mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-28 06:46:42 -04:00
roc-source: handle some errors better
This commit is contained in:
parent
30a77456fc
commit
1825bf696e
1 changed files with 8 additions and 4 deletions
|
|
@ -217,25 +217,28 @@ static int start_receiving(struct module_roc_source_data *data)
|
||||||
if (roc_receiver_bind(data->receiver, ROC_SLOT_DEFAULT, ROC_INTERFACE_AUDIO_SOURCE,
|
if (roc_receiver_bind(data->receiver, ROC_SLOT_DEFAULT, ROC_INTERFACE_AUDIO_SOURCE,
|
||||||
data->local_source_addr) != 0) {
|
data->local_source_addr) != 0) {
|
||||||
pw_log_error("can't connect roc receiver to local source address");
|
pw_log_error("can't connect roc receiver to local source address");
|
||||||
return -EINVAL;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (data->local_repair_addr != NULL) {
|
if (data->local_repair_addr != NULL) {
|
||||||
if (roc_receiver_bind(data->receiver, ROC_SLOT_DEFAULT, ROC_INTERFACE_AUDIO_REPAIR,
|
if (roc_receiver_bind(data->receiver, ROC_SLOT_DEFAULT, ROC_INTERFACE_AUDIO_REPAIR,
|
||||||
data->local_repair_addr) != 0) {
|
data->local_repair_addr) != 0) {
|
||||||
pw_log_error("can't connect roc receiver to local repair address");
|
pw_log_error("can't connect roc receiver to local repair address");
|
||||||
return -EINVAL;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (data->local_control_addr != NULL) {
|
if (data->local_control_addr != NULL) {
|
||||||
if (roc_receiver_bind(data->receiver, ROC_SLOT_DEFAULT, ROC_INTERFACE_AUDIO_CONTROL,
|
if (roc_receiver_bind(data->receiver, ROC_SLOT_DEFAULT, ROC_INTERFACE_AUDIO_CONTROL,
|
||||||
data->local_control_addr) != 0) {
|
data->local_control_addr) != 0) {
|
||||||
pw_log_error("can't connect roc receiver to local control address");
|
pw_log_error("can't connect roc receiver to local control address");
|
||||||
return -EINVAL;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data->receiving = true;
|
data->receiving = true;
|
||||||
return 0;
|
return 0;
|
||||||
|
error:
|
||||||
|
roc_receiver_unlink(data->receiver, ROC_SLOT_DEFAULT);
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int stop_receiving(struct module_roc_source_data *data)
|
static int stop_receiving(struct module_roc_source_data *data)
|
||||||
|
|
@ -265,7 +268,8 @@ static void on_stream_state_changed(void *d, enum pw_stream_state old,
|
||||||
pw_log_error("stream error: %s", error);
|
pw_log_error("stream error: %s", error);
|
||||||
break;
|
break;
|
||||||
case PW_STREAM_STATE_STREAMING:
|
case PW_STREAM_STATE_STREAMING:
|
||||||
start_receiving(data);
|
if (start_receiving(data) < 0)
|
||||||
|
pw_impl_module_schedule_destroy(data->module);
|
||||||
break;
|
break;
|
||||||
case PW_STREAM_STATE_PAUSED:
|
case PW_STREAM_STATE_PAUSED:
|
||||||
stop_receiving(data);
|
stop_receiving(data);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue