mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 04:40:16 +00:00
control_socket acquire: get the pointer from priv_data
Do not assume that (struct module) is first in the (struct control_state) anymore in particular and in any structure in general.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* @author Martin Piatka <piatka@cesnet.cz>
|
||||
*/
|
||||
/*
|
||||
* 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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* @author Martin Pulec <pulec@cesnet.cz>
|
||||
*/
|
||||
/*
|
||||
* 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<string, param_u> &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()
|
||||
|
||||
Reference in New Issue
Block a user