@@ -54,7 +54,7 @@ pub struct Node {
54
54
/// Outgoing edges: tuple of outcoming node reference, our output index and their input index
55
55
outgoing_edges : SmallVec < [ OutgoingEdge ; 2 ] > ,
56
56
/// Indicates if the control thread has dropped this Node
57
- free_when_finished : bool ,
57
+ control_handle_dropped : bool ,
58
58
/// Indicates if the node has any incoming connections (for lifecycle management)
59
59
has_inputs_connected : bool ,
60
60
/// Indicates if the node can act as a cycle breaker (only DelayNode for now)
@@ -68,7 +68,7 @@ impl std::fmt::Debug for Node {
68
68
. field ( "processor" , & self . processor )
69
69
. field ( "channel_config" , & self . channel_config )
70
70
. field ( "outgoing_edges" , & self . outgoing_edges )
71
- . field ( "free_when_finished " , & self . free_when_finished )
71
+ . field ( "control_handle_dropped " , & self . control_handle_dropped )
72
72
. field ( "cycle_breaker" , & self . cycle_breaker )
73
73
. finish_non_exhaustive ( )
74
74
}
@@ -85,7 +85,7 @@ impl Node {
85
85
fn can_free ( & self , tail_time : bool ) -> bool {
86
86
// Only drop when the Control thread has dropped its handle.
87
87
// Otherwise the node can be reconnected/restarted etc.
88
- if !self . free_when_finished {
88
+ if !self . control_handle_dropped {
89
89
return false ;
90
90
}
91
91
@@ -185,7 +185,7 @@ impl Graph {
185
185
outputs,
186
186
channel_config,
187
187
outgoing_edges : smallvec ! [ ] ,
188
- free_when_finished : false ,
188
+ control_handle_dropped : false ,
189
189
has_inputs_connected : false ,
190
190
cycle_breaker : false ,
191
191
} ) ,
@@ -231,12 +231,12 @@ impl Graph {
231
231
self . ordered . clear ( ) ; // void current ordering
232
232
}
233
233
234
- pub fn mark_free_when_finished ( & mut self , index : AudioNodeId ) {
234
+ pub fn mark_control_handle_dropped ( & mut self , index : AudioNodeId ) {
235
235
// Issue #92, a race condition can occur for AudioParams. They may have already been
236
236
// removed from the audio graph if the node they feed into was dropped.
237
237
// Therefore, do not assume this node still exists:
238
238
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 ;
240
240
}
241
241
}
242
242
@@ -509,7 +509,7 @@ impl Graph {
509
509
// - special node (destination = id 0, listener = id 1), or
510
510
// - not connected to this dropped node, or
511
511
// - 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 ;
513
513
514
514
if !retain {
515
515
self . reclaim_id_channel
@@ -735,7 +735,7 @@ mod tests {
735
735
// dropped and the AudioNodeId(3) should be reclaimed
736
736
add_node ( & mut graph, 2 , node. clone ( ) ) ;
737
737
// 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 ;
739
739
740
740
// Connect the regular node to the AudioDestinationNode
741
741
add_edge ( & mut graph, 2 , 0 ) ;
@@ -777,7 +777,7 @@ mod tests {
777
777
// dropped and the AudioNodeId(3) should be reclaimed
778
778
add_node ( & mut graph, 2 , node. clone ( ) ) ;
779
779
// 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 ;
781
781
782
782
// Connect the regular node to the AudioDestinationNode
783
783
add_edge ( & mut graph, 2 , 0 ) ;
@@ -786,7 +786,7 @@ mod tests {
786
786
let param = Box :: new ( TestNode { tail_time : true } ) ; // audio params have tail time true
787
787
add_node ( & mut graph, 3 , param) ;
788
788
// 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 ;
790
790
791
791
// Connect the audioparam to the regular node
792
792
add_audioparam ( & mut graph, 3 , 2 ) ;
@@ -828,7 +828,7 @@ mod tests {
828
828
add_node ( & mut graph, 2 , node) ;
829
829
830
830
// 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 ;
832
832
833
833
// Render a single quantum
834
834
let scope = AudioWorkletGlobalScope {
0 commit comments