Closed thsno02 closed 2 years ago
In another works, overflow refers to the data feed exceeds the capacity of the volumn, and underflow means the date feed does not fill the volumn and rest some space.
The definitions are similar to the original linguistics meaning, both buffer overflow and buffer underflow can be counted as errors. 1
The former arises while the flow of data from the original data scource, typically the hard driver, was too large to store in the buffer memory, and the buffer memory tends to empty itself. This error leads to the terminatation of the data feeding process and device cannot handle the successive data feed.
The latter occurs while the data flow does not meet the threshold of the buffer memory. It's noteworthy that the threshold is not the capacity of the buffer memory, but a reading rate or processing rate that promises a continuous data transformation. This error leads to the buffer is always empty dynamically and may yield a discontinuous output.
For example, in audio playback scenario, buffer underflow leads to stuttering audio and buffe overflow may cause program breaking. 2
[1]: https://www.techtarget.com/searchsecurity/definition/buffer-underflow
[2]: https://stackoverflow.com/questions/26257639/c-what-is-a-example-of-a-buffer-underflow
The flags are used to tolerate errors.
sounddeivce.get_status()
gets info about over-/underflows in play()/rec()/playrec(), returns CallbackFlags – A CallbackFlags object that holds information about the last invocation of play(), rec() or playrec().callback
function needs this flag?