@@ -33,12 +33,27 @@ void remove_action(struct action** addr, const struct state* state)
3333 }
3434}
3535
36- void get_stats (PaStreamCallbackFlags flags , struct stats * stats )
36+ void get_stats (frame_t frameCount , PaStreamCallbackFlags flags
37+ , struct stats * stats )
3738{
39+ if (stats -> blocks == 0 )
40+ {
41+ stats -> min_blocksize = frameCount ;
42+ stats -> max_blocksize = frameCount ;
43+ }
44+ else
45+ {
46+ if (frameCount < stats -> min_blocksize )
47+ {
48+ stats -> min_blocksize = frameCount ;
49+ }
50+ if (frameCount > stats -> max_blocksize )
51+ {
52+ stats -> max_blocksize = frameCount ;
53+ }
54+ }
3855 stats -> blocks ++ ;
3956
40- // TODO: store min/max block size?
41-
4257 if (flags & paInputUnderflow ) { stats -> input_underflows ++ ; }
4358 if (flags & paInputOverflow ) { stats -> input_overflows ++ ; }
4459 if (flags & paOutputUnderflow ) { stats -> output_underflows ++ ; }
@@ -114,7 +129,7 @@ int callback(const void* input, void* output, frame_t frameCount
114129
115130 memset (output , 0 , sizeof (float ) * state -> output_channels * frameCount );
116131
117- get_stats (statusFlags , & (state -> stats ));
132+ get_stats (frameCount , statusFlags , & (state -> stats ));
118133
119134 get_new_actions (state );
120135
@@ -249,9 +264,9 @@ int callback(const void* input, void* output, frame_t frameCount
249264 continue ;
250265 }
251266
252- // Store buffer over-/underflow information
267+ // Store buffer over-/underflow information etc.
253268
254- get_stats (statusFlags , & (action -> stats ));
269+ get_stats (frameCount , statusFlags , & (action -> stats ));
255270
256271 // Get number of remaining frames in the current block
257272
0 commit comments