[pulseaudio-commits] src/modules
Tanu Kaskinen
tanuk at kemper.freedesktop.org
Tue May 2 13:53:56 UTC 2017
src/modules/jack/module-jack-sink.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 4e3aa53a3f8b5d81441ee0f3d61fc2d1db57908f
Author: Tanu Kaskinen <tanuk at iki.fi>
Date: Tue May 2 16:44:29 2017 +0300
jack-sink: fix latency calculation
The compiler warned about number_of_frames being possibly used
uninitialized, and on closer inspection I found that it was indeed not
initialized if saved_frame_time_valid is false.
In commit fe70b9e11a "source/sink: Allow pa_{source,
sink}_get_latency_within_thread() to return negative values" the
number_of_frames variable was added as an unsigned version of the l
variable, and number_of_frames partially replaced the l variable. The
replacement should have gone all the way, however. This patch removes
the remaining uses of the l variable and substitutes number_of_frames
on its place, and as a result, number_of_frames is now always
initialized.
diff --git a/src/modules/jack/module-jack-sink.c b/src/modules/jack/module-jack-sink.c
index 74053865..82bfccd9 100644
--- a/src/modules/jack/module-jack-sink.c
+++ b/src/modules/jack/module-jack-sink.c
@@ -165,14 +165,14 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
return 0;
case PA_SINK_MESSAGE_GET_LATENCY: {
- jack_nframes_t l, ft, d;
+ jack_nframes_t ft, d;
jack_latency_range_t r;
size_t n;
int32_t number_of_frames;
/* This is the "worst-case" latency */
jack_port_get_latency_range(u->port[0], JackPlaybackLatency, &r);
- l = r.max + u->frames_in_buffer;
+ number_of_frames = r.max + u->frames_in_buffer;
if (u->saved_frame_time_valid) {
/* Adjust the worst case latency by the time that
@@ -180,7 +180,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
ft = jack_frame_time(u->client);
d = ft > u->saved_frame_time ? ft - u->saved_frame_time : 0;
- number_of_frames = (int32_t)l - d;
+ number_of_frames -= d;
}
/* Convert it to usec */
More information about the pulseaudio-commits
mailing list