mozilla / cubeb

Cross platform audio library
ISC License
442 stars 126 forks source link

wasapi: Use stream rate when converting latency to hns. #663

Closed kinetiknz closed 3 years ago

kinetiknz commented 3 years ago

The caller's requested latency in frames is based on the stream's requested rate in stream_params. In the default case (when not overriding latency for BT headsets), use this rate when converting frames to hns.

This was discovered while investigating BMO 1732479, where a 192kHz stream created on a device using a 44.1kHz device rate resulted in streams with a latency of ~425ms instead of the expected ~100ms (causing very large shmem requests in AudioIPC; ~668kB for initial refill when the shmem was limited to 512kB).