mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
pipewire: module-roc-{sink,source}: deduplicate protocol selection
This commit is contained in:
parent
333fd8d2ae
commit
6d8a31a3e4
3 changed files with 21 additions and 30 deletions
|
|
@ -282,21 +282,7 @@ static int roc_sink_setup(struct module_roc_sink_data *data)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
switch (data->fec_code) {
|
||||
case ROC_FEC_ENCODING_DEFAULT:
|
||||
case ROC_FEC_ENCODING_RS8M:
|
||||
audio_proto = ROC_PROTO_RTP_RS8M_SOURCE;
|
||||
repair_proto = ROC_PROTO_RS8M_REPAIR;
|
||||
break;
|
||||
case ROC_FEC_ENCODING_LDPC_STAIRCASE:
|
||||
audio_proto = ROC_PROTO_RTP_LDPC_SOURCE;
|
||||
repair_proto = ROC_PROTO_LDPC_REPAIR;
|
||||
break;
|
||||
default:
|
||||
audio_proto = ROC_PROTO_RTP;
|
||||
repair_proto = 0;
|
||||
break;
|
||||
}
|
||||
pw_roc_fec_encoding_to_proto(data->fec_code, &audio_proto, &repair_proto);
|
||||
|
||||
res = pw_roc_create_endpoint(&data->remote_source_addr, audio_proto, data->remote_ip, data->remote_source_port);
|
||||
if (res < 0) {
|
||||
|
|
|
|||
|
|
@ -304,21 +304,7 @@ static int roc_source_setup(struct module_roc_source_data *data)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
switch (data->fec_code) {
|
||||
case ROC_FEC_ENCODING_DEFAULT:
|
||||
case ROC_FEC_ENCODING_RS8M:
|
||||
audio_proto = ROC_PROTO_RTP_RS8M_SOURCE;
|
||||
repair_proto = ROC_PROTO_RS8M_REPAIR;
|
||||
break;
|
||||
case ROC_FEC_ENCODING_LDPC_STAIRCASE:
|
||||
audio_proto = ROC_PROTO_RTP_LDPC_SOURCE;
|
||||
repair_proto = ROC_PROTO_LDPC_REPAIR;
|
||||
break;
|
||||
default:
|
||||
audio_proto = ROC_PROTO_RTP;
|
||||
repair_proto = 0;
|
||||
break;
|
||||
}
|
||||
pw_roc_fec_encoding_to_proto(data->fec_code, &audio_proto, &repair_proto);
|
||||
|
||||
res = pw_roc_create_endpoint(&data->local_source_addr, audio_proto, data->local_ip, data->local_source_port);
|
||||
if (res < 0) {
|
||||
|
|
|
|||
|
|
@ -66,4 +66,23 @@ out_error_free_ep:
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline void pw_roc_fec_encoding_to_proto(roc_fec_encoding fec_code, roc_protocol *audio, roc_protocol *repair)
|
||||
{
|
||||
switch (fec_code) {
|
||||
case ROC_FEC_ENCODING_DEFAULT:
|
||||
case ROC_FEC_ENCODING_RS8M:
|
||||
*audio = ROC_PROTO_RTP_RS8M_SOURCE;
|
||||
*repair = ROC_PROTO_RS8M_REPAIR;
|
||||
break;
|
||||
case ROC_FEC_ENCODING_LDPC_STAIRCASE:
|
||||
*audio = ROC_PROTO_RTP_LDPC_SOURCE;
|
||||
*repair = ROC_PROTO_LDPC_REPAIR;
|
||||
break;
|
||||
default:
|
||||
*audio = ROC_PROTO_RTP;
|
||||
*repair = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* MODULE_ROC_COMMON_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue