File tree 7 files changed +719
-100
lines changed
7 files changed +719
-100
lines changed Original file line number Diff line number Diff line change @@ -203,6 +203,17 @@ impl ConcreteBaseAudioContext {
203
203
}
204
204
}
205
205
206
+ /// Inform render thread that this node can act as a cycle breaker
207
+ #[ doc( hidden) ]
208
+ pub fn mark_cycle_breaker ( & self , reg : & AudioContextRegistration ) {
209
+ let id = reg. id ( ) . 0 ;
210
+ let message = ControlMessage :: MarkCycleBreaker { id } ;
211
+
212
+ // Sending the message will fail when the render thread has already shut down.
213
+ // This is fine
214
+ let _r = self . inner . render_channel . send ( message) ;
215
+ }
216
+
206
217
/// `ChannelConfig` of the `AudioDestinationNode`
207
218
pub ( super ) fn destination_channel_config ( & self ) -> ChannelConfig {
208
219
self . inner . destination_channel_config . clone ( )
Original file line number Diff line number Diff line change @@ -26,17 +26,28 @@ pub(crate) enum ControlMessage {
26
26
} ,
27
27
28
28
/// Clear the connection between two given nodes in the audio graph
29
- DisconnectNode { from : u64 , to : u64 } ,
29
+ DisconnectNode {
30
+ from : u64 ,
31
+ to : u64 ,
32
+ } ,
30
33
31
34
/// Disconnect this node from the audio graph (drop all its connections)
32
- DisconnectAll { from : u64 } ,
35
+ DisconnectAll {
36
+ from : u64 ,
37
+ } ,
33
38
34
39
/// Notify the render thread this node is dropped in the control thread
35
- FreeWhenFinished { id : u64 } ,
40
+ FreeWhenFinished {
41
+ id : u64 ,
42
+ } ,
36
43
37
44
/// Pass an AudioParam AutomationEvent to the relevant node
38
45
AudioParamEvent {
39
46
to : Sender < AudioParamEvent > ,
40
47
event : AudioParamEvent ,
41
48
} ,
49
+
50
+ MarkCycleBreaker {
51
+ id : u64 ,
52
+ } ,
42
53
}
Original file line number Diff line number Diff line change @@ -162,11 +162,6 @@ impl AudioProcessor for ConstantSourceRenderer {
162
162
return true ;
163
163
}
164
164
165
- if stop_time < scope. current_time {
166
- output. make_silent ( ) ;
167
- return false ;
168
- }
169
-
170
165
output. force_mono ( ) ;
171
166
172
167
let offset_values = params. get ( & self . offset ) ;
@@ -186,7 +181,8 @@ impl AudioProcessor for ConstantSourceRenderer {
186
181
current_time += dt;
187
182
}
188
183
189
- true
184
+ // tail_time false when output has ended this quantum
185
+ stop_time >= next_block_time
190
186
}
191
187
}
192
188
You can’t perform that action at this time.
0 commit comments