pulse-server: track quantum and update tlength

Keep track of the current quantum and recalculate the tlength in the
same way that pulseaudio does.

Send a bufferattr changed message to a client when we change the
parameters.

This fixes the case where the quantum is increased and there needs to be
more buffering to keep the stream going.
This commit is contained in:
Wim Taymans 2021-12-14 15:48:54 +01:00
parent 6b81be5ac3
commit 1f4254b344
3 changed files with 56 additions and 5 deletions

View file

@ -67,6 +67,7 @@ struct stream {
struct spa_hook stream_listener;
struct spa_io_rate_match *rate_match;
struct spa_io_position *position;
struct spa_ringbuffer ring;
void *buffer;
@ -78,8 +79,9 @@ struct stream {
uint64_t timestamp;
int64_t delay;
uint32_t missing;
uint32_t requested;
uint32_t last_quantum;
int64_t missing;
int64_t requested;
struct sample_spec ss;
struct channel_map map;
@ -112,5 +114,6 @@ int stream_send_overflow(struct stream *stream);
int stream_send_killed(struct stream *stream);
int stream_send_started(struct stream *stream);
int stream_send_request(struct stream *stream);
int stream_update_minreq(struct stream *stream, uint32_t minreq);
#endif /* PULSER_SERVER_STREAM_H */