Getting buffered data while paused


I’m having an issue where even though my capture device is paused I am still getting buffered audio when I start recording. In other words I do the following:

  1. Pause capture device.
  2. Speak (count 1 - 5)
  3. Unpause capture device.
  4. Speak (count 6 - 10)
  5. Pause capture device.
  6. Playback audio (I get 1 - 10)

I have SDL Version: 2.0.16 and pulseaudio 13.99.1 on Ubuntu 20.04. I have read this was an issue in earlier versions. Is this still an issue? What can I do to fix? I tried opening/closing the devices as I need them (which works) but then I get random crashes (somewhere in pulseaudio memblock.c:1016) which I am guessing is related to the constant opening and closing. Any help is appreciated!