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,7 +1364,8 @@ do_process_done(struct spa_loop *loop,
|
||||||
if (stream->direction == PW_DIRECTION_OUTPUT) {
|
if (stream->direction == PW_DIRECTION_OUTPUT) {
|
||||||
stream->read_index = pd->read_index;
|
stream->read_index = pd->read_index;
|
||||||
if (stream->corked) {
|
if (stream->corked) {
|
||||||
stream->underrun_for += pd->underrun_for;
|
if (stream->underrun_for != (uint64_t)-1)
|
||||||
|
stream->underrun_for += pd->underrun_for;
|
||||||
stream->playing_for = 0;
|
stream->playing_for = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1380,7 +1381,8 @@ do_process_done(struct spa_loop *loop,
|
||||||
stream->missing += pd->playing_for + pd->underrun_for;
|
stream->missing += pd->playing_for + pd->underrun_for;
|
||||||
stream->missing = SPA_MIN(stream->missing, stream->attr.tlength);
|
stream->missing = SPA_MIN(stream->missing, stream->attr.tlength);
|
||||||
stream->playing_for += pd->playing_for;
|
stream->playing_for += pd->playing_for;
|
||||||
stream->underrun_for += pd->underrun_for;
|
if (stream->underrun_for != (uint64_t)-1)
|
||||||
|
stream->underrun_for += pd->underrun_for;
|
||||||
|
|
||||||
send_command_request(stream);
|
send_command_request(stream);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1719,6 +1721,7 @@ static int do_create_playback_stream(struct client *client, uint32_t command, ui
|
||||||
stream->muted_set = muted_set;
|
stream->muted_set = muted_set;
|
||||||
stream->attr = attr;
|
stream->attr = attr;
|
||||||
stream->is_underrun = true;
|
stream->is_underrun = true;
|
||||||
|
stream->underrun_for = -1;
|
||||||
|
|
||||||
if (no_remix)
|
if (no_remix)
|
||||||
pw_properties_set(props, PW_KEY_STREAM_DONT_REMIX, "true");
|
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);
|
pw_stream_set_active(stream->stream, !cork);
|
||||||
stream->corked = cork;
|
stream->corked = cork;
|
||||||
stream->playing_for = 0;
|
if (cork) {
|
||||||
stream->underrun_for = 0;
|
|
||||||
if (cork)
|
|
||||||
stream->is_underrun = true;
|
stream->is_underrun = true;
|
||||||
|
} else {
|
||||||
|
stream->playing_for = 0;
|
||||||
|
stream->underrun_for = -1;
|
||||||
|
}
|
||||||
|
|
||||||
return reply_simple_ack(client, tag);
|
return reply_simple_ack(client, tag);
|
||||||
}
|
}
|
||||||
|
|
@ -2513,7 +2518,7 @@ static void stream_flush(struct stream *stream)
|
||||||
stream->in_prebuf = true;
|
stream->in_prebuf = true;
|
||||||
|
|
||||||
stream->playing_for = 0;
|
stream->playing_for = 0;
|
||||||
stream->underrun_for = 0;
|
stream->underrun_for = -1;
|
||||||
stream->is_underrun = true;
|
stream->is_underrun = true;
|
||||||
|
|
||||||
send_command_request(stream);
|
send_command_request(stream);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue