USB: usb-mic: send 1ms worth of samples for 48kHz and 8kHz sample rates

This commit is contained in:
jackun 2021-02-21 04:42:12 +02:00
parent aa338d234d
commit c695a7eabb
No known key found for this signature in database
GPG Key ID: 119DB3F1D05A9ED3
1 changed files with 5 additions and 0 deletions

View File

@ -585,6 +585,11 @@ namespace usb_mic
int16_t* dst = nullptr;
std::vector<int16_t> dst_alloc(0); //TODO
size_t len = p->iov.size;
// send only 1ms (bInterval) of samples
if (s->f.srate[0] == 48000 || s->f.srate[0] == 8000)
len = std::min(p->iov.size, outChns * sizeof(int16_t) * s->f.srate[0] / 1000);
//Divide 'len' bytes between 2 channels of 16 bits
uint32_t max_frames = len / (outChns * sizeof(uint16_t));