alsa: Implement playback/capture rate control for USB gadgets

If we detect Playback/Capture Pitch 1000000, we can adjust those values
to update the feedback endpoint for the host. On the capture side, this
will instruct the host to adjust the rate at which data is being sent.
On the playback side, this will adjust the amount of data the USB gadget
driver sends out in each USB tick.
This commit is contained in:
Arun Raghavan 2023-06-08 17:37:04 -04:00 committed by Wim Taymans
parent 2919b55f7f
commit abb300750f
4 changed files with 105 additions and 2 deletions

View file

@ -218,6 +218,11 @@ struct state {
struct spa_latency_info latency[2];
struct spa_process_latency_info process_latency;
/* Rate match via an ALSA ctl */
snd_ctl_t *ctl;
snd_ctl_elem_value_t *pitch_elem;
double last_rate;
};
struct spa_pod *spa_alsa_enum_propinfo(struct state *state,
@ -230,6 +235,7 @@ int spa_alsa_enum_format(struct state *state, int seq,
const struct spa_pod *filter);
int spa_alsa_set_format(struct state *state, struct spa_audio_info *info, uint32_t flags);
int spa_alsa_update_rate_match(struct state *state);
int spa_alsa_init(struct state *state, const struct spa_dict *info);
int spa_alsa_clear(struct state *state);