mozilla / cubeb-pulse-rs

ISC License
15 stars 17 forks source link

Use the input data ring buffer to count input frames read #63

Closed padenot closed 3 years ago

padenot commented 3 years ago

This is what we need. When starting a stream, there are two cases:

get_linear_input_data() underruns gracefully and fill the remaining space with silence.

padenot commented 3 years ago

@ChunMinChang, this is similar to what we do in the mac backend, conceptually, but there is a way to know how much is buffered there, to not trim when there is not enough data, instead of trimming in all cases and returning early when there's nothing to do.

padenot commented 3 years ago

If input_frame_count > nframes > _frames in input_buffermanager, then we may have a out-of-sync problem between input_frame_count and input_buffer_manager. I'd prefer we totally remove the input_frame_count and only use input_buffer_manager to calculate frames, if this is the case (IIRC, this is what macos backend does).

I'll do this, it's better.