Fix a stupid divide-by-zero error and remove unrecognised warning options for FreeBSD
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@ shairport_sync_SOURCES = shairport.c rtsp.c mdns.c mdns_external.c common.c rtp.
|
||||
|
||||
AM_CFLAGS = -Wno-multichar -Wall -Wextra -Wno-clobbered -Wno-psabi -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
if BUILD_FOR_FREEBSD
|
||||
AM_CXXFLAGS = -I/usr/local/include -Wno-multichar -Wall -Wextra -Wno-clobbered -Wno-psabi -pthread -DSYSCONFDIR=\"$(sysconfdir)\" -O2
|
||||
AM_CXXFLAGS = -I/usr/local/include -Wno-multichar -Wall -Wextra -pthread -DSYSCONFDIR=\"$(sysconfdir)\" -O2
|
||||
else
|
||||
if BUILD_FOR_OPENBSD
|
||||
AM_CXXFLAGS = -I/usr/local/include -Wno-multichar -Wall -Wextra -Wno-clobbered -Wno-psabi -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
|
||||
@@ -2095,8 +2095,12 @@ void *player_thread_func(void *arg) {
|
||||
|
||||
int64_t should_be_frame;
|
||||
local_time_to_frame(local_time_now, &should_be_frame, conn);
|
||||
|
||||
int64_t absolute_difference_in_frames = td_in_frames + rt - should_be_frame;
|
||||
if (absolute_difference_in_frames < 0)
|
||||
absolute_difference_in_frames = -absolute_difference_in_frames;
|
||||
|
||||
if (abs(td_in_frames + rt - should_be_frame) > 10 * conn->output_sample_ratio)
|
||||
if (absolute_difference_in_frames > 10 * conn->output_sample_ratio)
|
||||
debug(1, "Difference between old and new frame number is %" PRId64 " frames.",
|
||||
td_in_frames + rt - should_be_frame);
|
||||
// this is the actual delay, including the latency we actually want, which will
|
||||
|
||||
@@ -765,35 +765,34 @@ void *rtp_timing_receiver(void *arg) {
|
||||
x_bar += (conn->time_pings[cc].local_time >> 12);
|
||||
sample_count++;
|
||||
}
|
||||
|
||||
y_bar = y_bar / sample_count;
|
||||
x_bar = x_bar / sample_count;
|
||||
|
||||
int64_t xid, yid;
|
||||
int64_t mtl, mbl;
|
||||
mtl = 0;
|
||||
mbl = 0;
|
||||
for (cc = 0; cc < conn->time_ping_count; cc++)
|
||||
if ((conn->time_pings[cc].chosen) &&
|
||||
(conn->time_pings[cc].sequence_number > (settling_time / 3))) {
|
||||
|
||||
uint64_t slt = conn->time_pings[cc].local_time >> 12;
|
||||
if (slt > x_bar)
|
||||
xid = slt - x_bar;
|
||||
else
|
||||
xid = -(x_bar - slt);
|
||||
|
||||
uint64_t srt = conn->time_pings[cc].remote_time >> 12;
|
||||
if (srt > y_bar)
|
||||
yid = srt - y_bar;
|
||||
else
|
||||
yid = -(y_bar - srt);
|
||||
|
||||
mtl = mtl + xid * yid;
|
||||
mbl = mbl + xid * xid;
|
||||
}
|
||||
conn->local_to_remote_time_gradient_sample_count = sample_count;
|
||||
if (sample_count > sample_point_minimum) {
|
||||
y_bar = y_bar / sample_count;
|
||||
x_bar = x_bar / sample_count;
|
||||
|
||||
int64_t xid, yid;
|
||||
int64_t mtl, mbl;
|
||||
mtl = 0;
|
||||
mbl = 0;
|
||||
for (cc = 0; cc < conn->time_ping_count; cc++)
|
||||
if ((conn->time_pings[cc].chosen) &&
|
||||
(conn->time_pings[cc].sequence_number > (settling_time / 3))) {
|
||||
|
||||
uint64_t slt = conn->time_pings[cc].local_time >> 12;
|
||||
if (slt > x_bar)
|
||||
xid = slt - x_bar;
|
||||
else
|
||||
xid = -(x_bar - slt);
|
||||
|
||||
uint64_t srt = conn->time_pings[cc].remote_time >> 12;
|
||||
if (srt > y_bar)
|
||||
yid = srt - y_bar;
|
||||
else
|
||||
yid = -(y_bar - srt);
|
||||
|
||||
mtl = mtl + xid * yid;
|
||||
mbl = mbl + xid * xid;
|
||||
}
|
||||
conn->local_to_remote_time_gradient_sample_count = sample_count;
|
||||
conn->local_to_remote_time_gradient = (1.0 * mtl) / mbl;
|
||||
// debug(1,"Drift is %12.2f ppm, based on %d
|
||||
// samples.",(1.0-conn->local_to_remote_time_gradient)*1000000,sample_count);
|
||||
|
||||
Reference in New Issue
Block a user