@@ -37,35 +37,26 @@ impl DspBatcher {
3737 }
3838 }
3939
40- fn push (
41- & mut self ,
42- manager : & mut VisualManager ,
43- mut samples : & [ f32 ] ,
44- format : AudioFormat ,
45- ) -> usize {
40+ fn push ( & mut self , manager : & mut VisualManager , mut samples : & [ f32 ] , format : AudioFormat ) {
4641 if self . format . is_some_and ( |current| current != format) {
4742 self . samples . clear ( ) ;
4843 }
4944 self . format = Some ( format) ;
5045 let batch = scaled_samples ( DSP_BATCH_FRAMES_AT_48K , format) ;
51- let mut count = 0 ;
5246 if !self . samples . is_empty ( ) {
5347 let take = ( batch - self . samples . len ( ) ) . min ( samples. len ( ) ) ;
5448 self . samples . extend_from_slice ( & samples[ ..take] ) ;
5549 samples = & samples[ take..] ;
5650 if self . samples . len ( ) == batch {
5751 manager. ingest_samples ( & self . samples , format) ;
5852 self . samples . clear ( ) ;
59- count += 1 ;
6053 }
6154 }
6255 let ready = samples. len ( ) / batch * batch;
6356 for chunk in samples[ ..ready] . chunks ( scaled_samples ( MAX_DSP_INGEST_FRAMES_AT_48K , format) ) {
6457 manager. ingest_samples ( chunk, format) ;
65- count += 1 ;
6658 }
6759 self . samples . extend_from_slice ( & samples[ ready..] ) ;
68- count
6960 }
7061
7162 fn reset ( & mut self , manager : & mut VisualManager ) {
@@ -214,11 +205,8 @@ mod tests {
214205 let format = format ( 2 , 48_000.0 , 1 ) ;
215206 let block = [ 0.25 ; 64 * 2 ] ;
216207 let storage = ( batcher. samples . as_ptr ( ) , batcher. samples . capacity ( ) ) ;
217- for index in 0 ..4 {
218- assert_eq ! (
219- batcher. push( & mut manager, & block, format) ,
220- usize :: from( index == 3 )
221- ) ;
208+ for _ in 0 ..4 {
209+ batcher. push ( & mut manager, & block, format) ;
222210 }
223211 assert ! ( batcher. samples. is_empty( ) ) ;
224212 assert_eq ! (
@@ -230,43 +218,26 @@ mod tests {
230218 sample_rate : 96_000.0 ,
231219 ..format
232220 } ;
233- for index in 0 ..8 {
234- assert_eq ! (
235- batcher. push( & mut manager, & block, high_rate) ,
236- usize :: from( index == 7 )
237- ) ;
221+ for _ in 0 ..8 {
222+ batcher. push ( & mut manager, & block, high_rate) ;
238223 }
239224 assert_eq ! (
240225 ( batcher. samples. as_ptr( ) , batcher. samples. capacity( ) ) ,
241226 storage
242227 ) ;
243228 }
244229
245- #[ test]
246- fn dsp_batches_coalesce_large_capture_backlogs ( ) {
247- let mut manager = VisualManager :: default ( ) ;
248- let mut batcher = DspBatcher :: new ( ) ;
249- let format = format ( 2 , 48_000.0 , 1 ) ;
250- assert_eq ! (
251- batcher. push( & mut manager, & [ 0.25 ; ( 256 * 6 + 17 ) * 2 ] , format) ,
252- 2
253- ) ;
254- assert_eq ! ( batcher. samples. len( ) , 17 * 2 ) ;
255- assert_eq ! ( batcher. push( & mut manager, & [ 0.25 ; 239 * 2 ] , format) , 1 ) ;
256- assert ! ( batcher. samples. is_empty( ) ) ;
257- }
258-
259230 #[ test]
260231 fn dsp_batches_never_mix_format_generations ( ) {
261232 let mut manager = VisualManager :: default ( ) ;
262233 let mut batcher = DspBatcher :: new ( ) ;
263234 let old = format ( 2 , 48_000.0 , 1 ) ;
264- assert_eq ! ( batcher. push( & mut manager, & [ 0.25 ; 128 * 2 ] , old) , 0 ) ;
235+ batcher. push ( & mut manager, & [ 0.25 ; 128 * 2 ] , old) ;
265236 let new = AudioFormat {
266237 generation : 2 ,
267238 ..old
268239 } ;
269- assert_eq ! ( batcher. push( & mut manager, & [ 0.5 ; 2 ] , new) , 0 ) ;
240+ batcher. push ( & mut manager, & [ 0.5 ; 2 ] , new) ;
270241 assert_eq ! ( batcher. samples. as_slice( ) , & [ 0.5 , 0.5 ] ) ;
271242 assert_eq ! ( batcher. format, Some ( new) ) ;
272243 }
@@ -276,10 +247,7 @@ mod tests {
276247 let mut manager = VisualManager :: default ( ) ;
277248 let mut batcher = DspBatcher :: new ( ) ;
278249 let format = format ( MAX_CAPTURE_CHANNELS , 192_000.0 , 1 ) ;
279- assert_eq ! (
280- batcher. push( & mut manager, & [ 0.25 ; 128 * MAX_CAPTURE_CHANNELS ] , format) ,
281- 0
282- ) ;
250+ batcher. push ( & mut manager, & [ 0.25 ; 128 * MAX_CAPTURE_CHANNELS ] , format) ;
283251 let scratch = [ 0.0 ; SILENCE_CHUNK_FRAMES * MAX_CAPTURE_CHANNELS ] ;
284252 ingest_silence (
285253 & mut manager,
0 commit comments