Improve rate matching and clock slaving

Use a new rate_match io area to exhange rate matching info between
sink/source and resampler.
Compensate for the rate match delay when scheduling timeouts.
Let the resampler notify the source of how many samples it needs to
produce the desired quantum. Make sure we keep an extra buffer in
the device to be able to make this possible.
Let the adapter directly call the slave node process function.
This commit is contained in:
Wim Taymans 2019-07-09 16:56:05 +02:00
parent 595dc0ab5b
commit c7d7058896
10 changed files with 147 additions and 98 deletions

View file

@ -102,6 +102,9 @@ struct state {
int rate;
int channels;
size_t frame_size;
int rate_denom;
int delay;
int read_size;
uint64_t port_info_all;
struct spa_port_info port_info;
@ -109,7 +112,7 @@ struct state {
struct spa_io_buffers *io;
struct spa_io_clock *clock;
struct spa_io_position *position;
struct spa_io_sequence *notify;
struct spa_io_rate_match *rate_match;
struct buffer buffers[MAX_BUFFERS];
unsigned int n_buffers;
@ -124,6 +127,9 @@ struct state {
int timerfd;
uint32_t threshold;
uint32_t last_threshold;
uint32_t size;
uint32_t last_size;
uint64_t last_position;
unsigned int alsa_started:1;
unsigned int alsa_sync:1;