@@ -54,7 +54,7 @@ pub struct Node {
5454 /// Outgoing edges: tuple of outcoming node reference, our output index and their input index
5555 outgoing_edges : SmallVec < [ OutgoingEdge ; 2 ] > ,
5656 /// Indicates if the control thread has dropped this Node
57- free_when_finished : bool ,
57+ control_handle_dropped : bool ,
5858 /// Indicates if the node has any incoming connections (for lifecycle management)
5959 has_inputs_connected : bool ,
6060 /// Indicates if the node can act as a cycle breaker (only DelayNode for now)
@@ -68,7 +68,7 @@ impl std::fmt::Debug for Node {
6868 . field ( "processor" , & self . processor )
6969 . field ( "channel_config" , & self . channel_config )
7070 . field ( "outgoing_edges" , & self . outgoing_edges )
71- . field ( "free_when_finished " , & self . free_when_finished )
71+ . field ( "control_handle_dropped " , & self . control_handle_dropped )
7272 . field ( "cycle_breaker" , & self . cycle_breaker )
7373 . finish_non_exhaustive ( )
7474 }
@@ -85,7 +85,7 @@ impl Node {
8585 fn can_free ( & self , tail_time : bool ) -> bool {
8686 // Only drop when the Control thread has dropped its handle.
8787 // Otherwise the node can be reconnected/restarted etc.
88- if !self . free_when_finished {
88+ if !self . control_handle_dropped {
8989 return false ;
9090 }
9191
@@ -185,7 +185,7 @@ impl Graph {
185185 outputs,
186186 channel_config,
187187 outgoing_edges : smallvec ! [ ] ,
188- free_when_finished : false ,
188+ control_handle_dropped : false ,
189189 has_inputs_connected : false ,
190190 cycle_breaker : false ,
191191 } ) ,
@@ -231,12 +231,12 @@ impl Graph {
231231 self . ordered . clear ( ) ; // void current ordering
232232 }
233233
234- pub fn mark_free_when_finished ( & mut self , index : AudioNodeId ) {
234+ pub fn mark_control_handle_dropped ( & mut self , index : AudioNodeId ) {
235235 // Issue #92, a race condition can occur for AudioParams. They may have already been
236236 // removed from the audio graph if the node they feed into was dropped.
237237 // Therefore, do not assume this node still exists:
238238 if let Some ( node) = self . nodes . get_mut ( index) {
239- node. get_mut ( ) . free_when_finished = true ;
239+ node. get_mut ( ) . control_handle_dropped = true ;
240240 }
241241 }
242242
@@ -509,7 +509,7 @@ impl Graph {
509509 // - special node (destination = id 0, listener = id 1), or
510510 // - not connected to this dropped node, or
511511 // - if the control thread still has a handle to it.
512- let retain = id. 0 < 2 || !was_connected || !node. free_when_finished ;
512+ let retain = id. 0 < 2 || !was_connected || !node. control_handle_dropped ;
513513
514514 if !retain {
515515 self . reclaim_id_channel
@@ -735,7 +735,7 @@ mod tests {
735735 // dropped and the AudioNodeId(3) should be reclaimed
736736 add_node ( & mut graph, 2 , node. clone ( ) ) ;
737737 // Mark the node as 'detached from the control thread', so it is allowed to drop
738- graph. nodes [ AudioNodeId ( 2 ) ] . get_mut ( ) . free_when_finished = true ;
738+ graph. nodes [ AudioNodeId ( 2 ) ] . get_mut ( ) . control_handle_dropped = true ;
739739
740740 // Connect the regular node to the AudioDestinationNode
741741 add_edge ( & mut graph, 2 , 0 ) ;
@@ -777,7 +777,7 @@ mod tests {
777777 // dropped and the AudioNodeId(3) should be reclaimed
778778 add_node ( & mut graph, 2 , node. clone ( ) ) ;
779779 // Mark the node as 'detached from the control thread', so it is allowed to drop
780- graph. nodes [ AudioNodeId ( 2 ) ] . get_mut ( ) . free_when_finished = true ;
780+ graph. nodes [ AudioNodeId ( 2 ) ] . get_mut ( ) . control_handle_dropped = true ;
781781
782782 // Connect the regular node to the AudioDestinationNode
783783 add_edge ( & mut graph, 2 , 0 ) ;
@@ -786,7 +786,7 @@ mod tests {
786786 let param = Box :: new ( TestNode { tail_time : true } ) ; // audio params have tail time true
787787 add_node ( & mut graph, 3 , param) ;
788788 // Mark the node as 'detached from the control thread', so it is allowed to drop
789- graph. nodes [ AudioNodeId ( 3 ) ] . get_mut ( ) . free_when_finished = true ;
789+ graph. nodes [ AudioNodeId ( 3 ) ] . get_mut ( ) . control_handle_dropped = true ;
790790
791791 // Connect the audioparam to the regular node
792792 add_audioparam ( & mut graph, 3 , 2 ) ;
@@ -828,7 +828,7 @@ mod tests {
828828 add_node ( & mut graph, 2 , node) ;
829829
830830 // Mark the node as 'detached from the control thread', so it is allowed to drop
831- graph. nodes [ AudioNodeId ( 2 ) ] . get_mut ( ) . free_when_finished = true ;
831+ graph. nodes [ AudioNodeId ( 2 ) ] . get_mut ( ) . control_handle_dropped = true ;
832832
833833 // Render a single quantum
834834 let scope = AudioWorkletGlobalScope {
0 commit comments