diff --git a/src/audio/filter/controlport_stats.cpp b/src/audio/filter/controlport_stats.cpp index 2b035ff4c..afc2d3958 100644 --- a/src/audio/filter/controlport_stats.cpp +++ b/src/audio/filter/controlport_stats.cpp @@ -3,7 +3,7 @@ * @author Martin Piatka */ /* - * Copyright (c) 2022 CESNET, z. s. p. o. + * Copyright (c) 2022-2025 CESNET * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -55,7 +55,9 @@ struct state_controlport_stats{ state_controlport_stats(struct module *mod) : mod(MODULE_CLASS_DATA, mod, this) { - control = (control_state *) (get_module(get_root_module(mod), "control")); + control = (control_state *) (get_module(get_root_module(mod), + "control")) + ->priv_data; } module_raii mod; diff --git a/src/module.h b/src/module.h index a626d2aec..83d26490b 100644 --- a/src/module.h +++ b/src/module.h @@ -106,8 +106,9 @@ typedef void (*notify_t)(struct module *); struct module { enum module_class cls; notify_t new_message; ///< if set, notifies module that new message is in queue, receiver lock is hold during the call - void *priv_data; ///< can be used to store state pointer for - ///< new_message(); uneeded otherwise + void *priv_data; ///< optional; can be used to store state pointer for + ///< new_message() or to retreive the state from the + ///< module (control_socket) char name[128]; ///< optional name of the module. May be used for indexing. struct module_priv_state *module_priv; diff --git a/src/rtp/video_decoders.cpp b/src/rtp/video_decoders.cpp index d83f260aa..a9238ed9e 100644 --- a/src/rtp/video_decoders.cpp +++ b/src/rtp/video_decoders.cpp @@ -341,7 +341,9 @@ struct state_video_decoder mod.priv_data = this; mod.new_message = decoder_process_message; module_register(&mod, parent); - control = (struct control_state *) get_module(get_root_module(parent), "control"); + control = (struct control_state *) get_module( + get_root_module(parent), "control") + ->priv_data; } ~state_video_decoder() { module_done(&mod); diff --git a/src/transmit.cpp b/src/transmit.cpp index 7895f4634..323519d05 100644 --- a/src/transmit.cpp +++ b/src/transmit.cpp @@ -264,8 +264,10 @@ struct tx *tx_init(struct module *parent, unsigned mtu, enum tx_media_type media tx->bitrate = bitrate; - if(parent) - tx->control = (struct control_state *) get_module(get_root_module(parent), "control"); + if (parent) { + tx->control = (struct control_state *) get_module( + get_root_module(parent), "control")->priv_data; + } return tx; } diff --git a/src/video_rxtx/ultragrid_rtp.cpp b/src/video_rxtx/ultragrid_rtp.cpp index 3b238f361..b0d1eb663 100644 --- a/src/video_rxtx/ultragrid_rtp.cpp +++ b/src/video_rxtx/ultragrid_rtp.cpp @@ -3,7 +3,7 @@ * @author Martin Pulec */ /* - * Copyright (c) 2013-2023 CESNET z.s.p.o. + * Copyright (c) 2013-2025 CESNET * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -93,7 +93,7 @@ ultragrid_rtp_video_rxtx::ultragrid_rtp_video_rxtx(const map &p } m_control = (struct control_state *) get_module( - get_root_module(m_common.parent), "control"); + get_root_module(m_common.parent), "control")->priv_data; } ultragrid_rtp_video_rxtx::~ultragrid_rtp_video_rxtx()