mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
pulse-server: start with underrun_for = -1
PulseAudio starts with underrun_for equal to -1, sets it to 0 when something was played and increments it from then on with the number of bytes played.
This commit is contained in:
parent
55915f420e
commit
02931df835
1 changed files with 11 additions and 6 deletions
|
|
@ -1364,6 +1364,7 @@ do_process_done(struct spa_loop *loop,
|
|||
if (stream->direction == PW_DIRECTION_OUTPUT) {
|
||||
stream->read_index = pd->read_index;
|
||||
if (stream->corked) {
|
||||
if (stream->underrun_for != (uint64_t)-1)
|
||||
stream->underrun_for += pd->underrun_for;
|
||||
stream->playing_for = 0;
|
||||
return 0;
|
||||
|
|
@ -1380,6 +1381,7 @@ do_process_done(struct spa_loop *loop,
|
|||
stream->missing += pd->playing_for + pd->underrun_for;
|
||||
stream->missing = SPA_MIN(stream->missing, stream->attr.tlength);
|
||||
stream->playing_for += pd->playing_for;
|
||||
if (stream->underrun_for != (uint64_t)-1)
|
||||
stream->underrun_for += pd->underrun_for;
|
||||
|
||||
send_command_request(stream);
|
||||
|
|
@ -1719,6 +1721,7 @@ static int do_create_playback_stream(struct client *client, uint32_t command, ui
|
|||
stream->muted_set = muted_set;
|
||||
stream->attr = attr;
|
||||
stream->is_underrun = true;
|
||||
stream->underrun_for = -1;
|
||||
|
||||
if (no_remix)
|
||||
pw_properties_set(props, PW_KEY_STREAM_DONT_REMIX, "true");
|
||||
|
|
@ -2492,10 +2495,12 @@ static int do_cork_stream(struct client *client, uint32_t command, uint32_t tag,
|
|||
|
||||
pw_stream_set_active(stream->stream, !cork);
|
||||
stream->corked = cork;
|
||||
stream->playing_for = 0;
|
||||
stream->underrun_for = 0;
|
||||
if (cork)
|
||||
if (cork) {
|
||||
stream->is_underrun = true;
|
||||
} else {
|
||||
stream->playing_for = 0;
|
||||
stream->underrun_for = -1;
|
||||
}
|
||||
|
||||
return reply_simple_ack(client, tag);
|
||||
}
|
||||
|
|
@ -2513,7 +2518,7 @@ static void stream_flush(struct stream *stream)
|
|||
stream->in_prebuf = true;
|
||||
|
||||
stream->playing_for = 0;
|
||||
stream->underrun_for = 0;
|
||||
stream->underrun_for = -1;
|
||||
stream->is_underrun = true;
|
||||
|
||||
send_command_request(stream);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue