MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ mark_buffer_processed()

bool MayaFlux::Nodes::Node::mark_buffer_processed ( )

Marks the node as having been processed by a buffer.

Returns
true if the buffer was successfully marked as processed

This method checks if the node can be marked as processed based on the current buffer count and node state. If conditions are met, it updates the processed flag and increments the reset counter.

Definition at line 134 of file Node.cpp.

135{
136 uint32_t count = m_buffer_count.load(std::memory_order_acquire);
137 auto state = m_state.load(std::memory_order_acquire);
138
139 if (count >= 1 && state == Utils::NodeState::INACTIVE) {
140 if (count == 1) {
141 return true;
142 }
143 bool expected = false;
144 if (m_buffer_processed.compare_exchange_strong(expected, true,
145 std::memory_order_acq_rel)) {
146 m_buffer_reset_count.fetch_add(1, std::memory_order_release);
147 return true;
148 }
149 }
150 return false;
151}
std::atomic< bool > m_buffer_processed
Flag indicating whether the buffer has been processed This atomic flag is set when the buffer has bee...
Definition Node.hpp:625
std::atomic< uint32_t > m_buffer_reset_count
Counter tracking how many buffers have requested a reset.
Definition Node.hpp:634
std::atomic< uint32_t > m_buffer_count
Counter tracking how many buffers are using this node This counter is incremented when a buffer start...
Definition Node.hpp:618
std::atomic< Utils::NodeState > m_state
Atomic state flag tracking the node's processing status.
Definition Node.hpp:463
@ INACTIVE
Engine is not processing this node.
Definition Utils.hpp:29

References MayaFlux::Utils::INACTIVE, m_buffer_count, m_buffer_processed, m_buffer_reset_count, and m_state.