module-rtp: don't autoconnect midi

Don't unload module for inactive source, we should signal the owner
of the module with a property update instead.
This commit is contained in:
Wim Taymans 2023-02-21 17:42:01 +01:00
parent a48822c38a
commit e010559ffe
2 changed files with 12 additions and 8 deletions

View file

@ -685,6 +685,7 @@ static int setup_stream(struct impl *impl)
uint32_t n_params; uint32_t n_params;
uint8_t buffer[1024]; uint8_t buffer[1024];
struct pw_properties *props; struct pw_properties *props;
enum pw_stream_flags flags;
int res, fd; int res, fd;
props = pw_properties_copy(impl->stream_props); props = pw_properties_copy(impl->stream_props);
@ -709,10 +710,13 @@ static int setup_stream(struct impl *impl)
n_params = 0; n_params = 0;
spa_pod_builder_init(&b, buffer, sizeof(buffer)); spa_pod_builder_init(&b, buffer, sizeof(buffer));
flags = PW_STREAM_FLAG_MAP_BUFFERS | PW_STREAM_FLAG_RT_PROCESS;
switch (impl->info.media_type) { switch (impl->info.media_type) {
case SPA_MEDIA_TYPE_audio: case SPA_MEDIA_TYPE_audio:
params[n_params++] = spa_format_audio_build(&b, params[n_params++] = spa_format_audio_build(&b,
SPA_PARAM_EnumFormat, &impl->info); SPA_PARAM_EnumFormat, &impl->info);
flags |= PW_STREAM_FLAG_AUTOCONNECT;
break; break;
case SPA_MEDIA_TYPE_application: case SPA_MEDIA_TYPE_application:
params[n_params++] = spa_pod_builder_add_object(&b, params[n_params++] = spa_pod_builder_add_object(&b,
@ -727,9 +731,7 @@ static int setup_stream(struct impl *impl)
if ((res = pw_stream_connect(impl->stream, if ((res = pw_stream_connect(impl->stream,
PW_DIRECTION_INPUT, PW_DIRECTION_INPUT,
PW_ID_ANY, PW_ID_ANY,
PW_STREAM_FLAG_MAP_BUFFERS | flags,
PW_STREAM_FLAG_AUTOCONNECT |
PW_STREAM_FLAG_RT_PROCESS,
params, n_params)) < 0) params, n_params)) < 0)
return res; return res;

View file

@ -885,6 +885,7 @@ static int setup_stream(struct impl *impl)
const struct spa_pod *params[1]; const struct spa_pod *params[1];
struct spa_pod_builder b; struct spa_pod_builder b;
uint32_t n_params; uint32_t n_params;
enum pw_stream_flags flags;
uint8_t buffer[1024]; uint8_t buffer[1024];
struct pw_properties *props; struct pw_properties *props;
int res; int res;
@ -916,10 +917,13 @@ static int setup_stream(struct impl *impl)
n_params = 0; n_params = 0;
spa_pod_builder_init(&b, buffer, sizeof(buffer)); spa_pod_builder_init(&b, buffer, sizeof(buffer));
flags = PW_STREAM_FLAG_MAP_BUFFERS | PW_STREAM_FLAG_RT_PROCESS;
switch (impl->info.media_type) { switch (impl->info.media_type) {
case SPA_MEDIA_TYPE_audio: case SPA_MEDIA_TYPE_audio:
params[n_params++] = spa_format_audio_build(&b, params[n_params++] = spa_format_audio_build(&b,
SPA_PARAM_EnumFormat, &impl->info); SPA_PARAM_EnumFormat, &impl->info);
flags |= PW_STREAM_FLAG_AUTOCONNECT;
break; break;
case SPA_MEDIA_TYPE_application: case SPA_MEDIA_TYPE_application:
params[n_params++] = spa_pod_builder_add_object(&b, params[n_params++] = spa_pod_builder_add_object(&b,
@ -934,9 +938,7 @@ static int setup_stream(struct impl *impl)
if ((res = pw_stream_connect(impl->stream, if ((res = pw_stream_connect(impl->stream,
PW_DIRECTION_OUTPUT, PW_DIRECTION_OUTPUT,
PW_ID_ANY, PW_ID_ANY,
PW_STREAM_FLAG_MAP_BUFFERS | flags,
PW_STREAM_FLAG_AUTOCONNECT |
PW_STREAM_FLAG_RT_PROCESS,
params, n_params)) < 0) { params, n_params)) < 0) {
pw_log_error("can't connect stream: %s", spa_strerror(res)); pw_log_error("can't connect stream: %s", spa_strerror(res));
goto error; goto error;
@ -956,8 +958,8 @@ static void on_timer_event(void *data, uint64_t expirations)
struct impl *impl = data; struct impl *impl = data;
if (!impl->receiving) { if (!impl->receiving) {
pw_log_info("timeout, closing inactive RTP source"); pw_log_info("timeout, inactive RTP source");
pw_impl_module_schedule_destroy(impl->module); //pw_impl_module_schedule_destroy(impl->module);
} else { } else {
pw_log_debug("timeout, keeping active RTP source"); pw_log_debug("timeout, keeping active RTP source");
} }