From 2c7272a13a2629b56c7d603451560d24fb5e99cf Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Wed, 19 Jun 2024 10:22:08 -0400 Subject: [PATCH] module-rtp: Set receiving state on stream as a property There isn't a good way to surface this information to the module owner yet, so let's publish the information on the stream so we can try to manage things in policy. --- src/modules/module-rtp-source.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/modules/module-rtp-source.c b/src/modules/module-rtp-source.c index 03a647387..006f396c4 100644 --- a/src/modules/module-rtp-source.c +++ b/src/modules/module-rtp-source.c @@ -165,6 +165,7 @@ struct impl { struct spa_source *source; unsigned receiving:1; + unsigned last_receiving:1; }; static void @@ -427,6 +428,15 @@ static void on_timer_event(void *data, uint64_t expirations) { struct impl *impl = data; + if (impl->receiving != impl->last_receiving) { + struct spa_dict_item item[1]; + + impl->last_receiving = impl->receiving; + + item[0] = SPA_DICT_ITEM_INIT("rtp.receiving", impl->receiving ? "true" : "false"); + rtp_stream_update_properties(impl->stream, &SPA_DICT_INIT(item, 1)); + } + if (!impl->receiving) { pw_log_info("timeout, inactive RTP source"); //pw_impl_module_schedule_destroy(impl->module);