protocol-native: fix bytes-to-usec conversion of "on-the-fly" data

The on_the_fly_snapshot variable contains the amount of bytes that has
been sent from the source IO thread to the main thread, but not yet
pushed to the stream memblockq. The data is in the stream format, but
the bytes-to-usec conversion used the source format, which caused random
latency reporting errors.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=81075
This commit is contained in:
Tanu Kaskinen 2017-07-11 21:16:17 +03:00
parent a448cc587c
commit e7d7b29c17

View file

@ -2922,7 +2922,7 @@ static void command_get_record_latency(pa_pdispatch *pd, uint32_t command, uint3
pa_tagstruct_put_usec(reply, s->current_monitor_latency);
pa_tagstruct_put_usec(reply,
s->current_source_latency +
pa_bytes_to_usec(s->on_the_fly_snapshot, &s->source_output->source->sample_spec));
pa_bytes_to_usec(s->on_the_fly_snapshot, &s->source_output->sample_spec));
pa_tagstruct_put_boolean(reply,
pa_source_get_state(s->source_output->source) == PA_SOURCE_RUNNING &&
pa_source_output_get_state(s->source_output) == PA_SOURCE_OUTPUT_RUNNING);