Fix HS playback on OSX.
This commit is contained in:
@@ -2050,7 +2050,7 @@ static bool audiod_set_interface(uint8_t rhport, tusb_control_request_t const *
|
||||
|
||||
case AUDIO_FEEDBACK_METHOD_FIFO_COUNT:
|
||||
{
|
||||
/* Initialize the threshold level to half filled */
|
||||
// Initialize the threshold level to half filled
|
||||
uint16_t fifo_lvl_thr;
|
||||
#if CFG_TUD_AUDIO_ENABLE_DECODING
|
||||
fifo_lvl_thr = tu_fifo_depth(&audio->rx_supp_ff[0]) / 2;
|
||||
@@ -2059,11 +2059,16 @@ static bool audiod_set_interface(uint8_t rhport, tusb_control_request_t const *
|
||||
#endif
|
||||
audio->feedback.compute.fifo_count.fifo_lvl_thr = fifo_lvl_thr;
|
||||
audio->feedback.compute.fifo_count.fifo_lvl_avg = ((uint32_t)fifo_lvl_thr) << 16;
|
||||
/* Avoid 64bit division */
|
||||
// Avoid 64bit division
|
||||
uint32_t nominal = ((fb_param.sample_freq / 100) << 16) / (frame_div / 100);
|
||||
audio->feedback.compute.fifo_count.nom_value = nominal;
|
||||
audio->feedback.compute.fifo_count.rate_const[0] = (audio->feedback.max_value - nominal) / fifo_lvl_thr;
|
||||
audio->feedback.compute.fifo_count.rate_const[1] = (nominal - audio->feedback.min_value) / fifo_lvl_thr;
|
||||
// On HS feedback is more sensitive since packet size can vary every MSOF, could cause instability
|
||||
if(tud_speed_get() == TUSB_SPEED_HIGH) {
|
||||
audio->feedback.compute.fifo_count.rate_const[0] /= 8;
|
||||
audio->feedback.compute.fifo_count.rate_const[1] /= 8;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user