Skip to content

Commit

Permalink
Use pkg-config to find libdaemon -- useful in FreeBSD -- and quieten …
Browse files Browse the repository at this point in the history
…a few warnings in FreeBSD
  • Loading branch information
mikebrady committed Oct 11, 2014
1 parent f7c0754 commit e052b5f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 15 deletions.
10 changes: 5 additions & 5 deletions audio_alsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ static int init(int argc, char **argv) {
debug(1, "Hardware mixer has dB volume from %f to %f.", (1.0 * alsa_mix_mindb) / 100.0,
(1.0 * alsa_mix_maxdb) / 100.0);
} else {
debug(1, "Hardware mixer does not have dB volume -- not used.");
inform("note: the hardware mixer specified -- \"%s\" -- does not have dB volume, so it can not be used for volume control.",alsa_mix_ctrl);
}
}
if (snd_mixer_selem_has_playback_switch(alsa_mix_elem)) {
Expand Down Expand Up @@ -304,7 +304,7 @@ static uint32_t delay() {
current_delay = -1;
debug(1, "Error -- ALSA delay(): bad state: %d.", snd_pcm_state(alsa_handle));
}
if (derr = snd_pcm_prepare(alsa_handle)) {
if ((derr = snd_pcm_prepare(alsa_handle))) {
ignore = snd_pcm_recover(alsa_handle, derr, 0);
debug(1, "Error preparing after delay error: %s.", snd_strerror(derr));
current_delay = -1;
Expand Down Expand Up @@ -336,7 +336,7 @@ static void play(short buf[], int samples) {
} else {
debug(1, "Error -- ALSA device in incorrect state (%d) for play.",
snd_pcm_state(alsa_handle));
if (err = snd_pcm_prepare(alsa_handle)) {
if ((err = snd_pcm_prepare(alsa_handle))) {
ignore = snd_pcm_recover(alsa_handle, err, 0);
debug(1, "Error preparing after play error: %s.", snd_strerror(err));
}
Expand All @@ -349,10 +349,10 @@ static void flush(void) {
int derr;
if (alsa_handle) {
// debug(1,"Dropping frames for flush...");
if (derr = snd_pcm_drop(alsa_handle))
if ((derr = snd_pcm_drop(alsa_handle)))
debug(1, "Error dropping frames: %s.", snd_strerror(derr));
// debug(1,"Dropped frames ok. State is %d.",snd_pcm_state(alsa_handle));
if (derr = snd_pcm_prepare(alsa_handle))
if ((derr = snd_pcm_prepare(alsa_handle)))
debug(1, "Error preparing after flush: %s.", snd_strerror(derr));
// debug(1,"Frames successfully dropped.");
/*
Expand Down
12 changes: 10 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.50])
AC_INIT([shairport-sync], [2.5.0.2], [[email protected]])
AC_INIT([shairport-sync], [2.5.0.3], [[email protected]])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([shairport.c])
AC_CONFIG_HEADERS([config.h])
Expand Down Expand Up @@ -34,7 +34,15 @@ fi
AC_ARG_WITH([pkg_config],
[ --with-pkg-config = use pkg-config to find libraries], ,[with_pkg_config=yes])

AC_CHECK_LIB([daemon],[daemon_log], , AC_MSG_ERROR(libdaemon needed))
AC_MSG_RESULT(>>Including libdaemon)
if test "x${with_pkg_config}" = xyes ; then
PKG_CHECK_MODULES(
[DAEMON], [libdaemon],
[LIBS="${DAEMON_LIBS} ${LIBS}"])
else
AC_CHECK_LIB([daemon],[daemon_fork], , AC_MSG_ERROR(libdaemon needed))
fi

AC_CHECK_LIB([pthread],[pthread_create], , AC_MSG_ERROR(pthread library needed))
AC_CHECK_LIB([m],[exp], , AC_MSG_ERROR(maths library needed))

Expand Down
8 changes: 5 additions & 3 deletions player.c
Original file line number Diff line number Diff line change
Expand Up @@ -1152,8 +1152,8 @@ static void *player_thread_func(void *arg) {
(1.0 * tsum_of_insertions_and_deletions) / number_of_statistics;
double moving_average_drift = (1.0 * tsum_of_drifts) / number_of_statistics;
// if ((play_number/print_interval)%20==0)
if (config.statistics_requested)
if (at_least_one_frame_seen)
if (config.statistics_requested) {
if (at_least_one_frame_seen) {
if (config.output->delay)
inform("Sync error: %.1f (frames); net correction: %.1f (ppm); corrections: %.1f "
"(ppm); missing packets %llu; late packets %llu; too late packets %llu; "
Expand All @@ -1170,8 +1170,10 @@ static void *player_thread_func(void *arg) {
missing_packets,
late_packets, too_late_packets, resend_requests,
minimum_buffer_occupancy, maximum_buffer_occupancy);
else
} else {
inform("No frames received in the last sampling interval.");
}
}
minimum_dac_queue_size = 1000000; // hack reset
maximum_buffer_occupancy = 0; // can't be less than this
minimum_buffer_occupancy = BUFFER_FRAMES; // can't be more than this
Expand Down
6 changes: 3 additions & 3 deletions rtsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ static enum rtsp_read_request_response rtsp_read_request(int fd, rtsp_message **
msg_free(msg); // which will free the content and everything else
}
// in case the message wasn't formed or wasn't fully initialised
if ((msg) && (msg->content == NULL) || (!msg))
if ((msg && (msg->content == NULL)) || (!msg))
free(buf);
*the_packet = NULL;
return reply;
Expand Down Expand Up @@ -973,7 +973,7 @@ void metadata_process(uint32_t type, uint32_t code, char *data, uint32_t length)
if (towrite_count > 57)
towrite_count = 57;
size_t outbuf_size = 76; // size of output buffer on entry, length of result on exit
if (base64_encode_so(remaining_data, towrite_count, outbuf, &outbuf_size) == NULL)
if (base64_encode_so((unsigned char *)remaining_data, towrite_count, outbuf, &outbuf_size) == NULL)
debug(1, "Error encoding base64 data.");
// debug(1,"Remaining count: %d ret: %d, outbuf_size: %d.",remaining_count,ret,outbuf_size);
ret = non_blocking_write(fd, outbuf, outbuf_size);
Expand Down Expand Up @@ -1390,7 +1390,7 @@ static int rtsp_auth(char **nonce, rtsp_message *req, rtsp_message *resp) {
MD5_Update(&ctx, *nonce, strlen(*nonce));
MD5_Update(&ctx, ":", 1);
for (i = 0; i < 16; i++)
sprintf(buf + 2 * i, "%02X", digest_mu[i]);
sprintf((char *)buf + 2 * i, "%02X", digest_mu[i]);
MD5_Update(&ctx, buf, 32);
MD5_Final(digest_total, &ctx);
#endif
Expand Down
5 changes: 3 additions & 2 deletions shairport.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,13 +380,14 @@ int parse_options(int argc, char **argv) {
config.resyncthreshold = value;

/* Get the verbosity setting. */
if (config_lookup_int(config.cfg, "general.log_verbosity", &value))
if (config_lookup_int(config.cfg, "general.log_verbosity", &value)) {
if ((value >= 0) && (value <= 3))
debuglev = value;
else
die("Invalid log verbosity setting option choice \"%d\". It should be between 0 and 3, "
"inclusive.",
value);
}

/* Get the ignore_volume_control setting. */
if (config_lookup_string(config.cfg, "general.ignore_volume_control", &str)) {
Expand Down Expand Up @@ -629,7 +630,7 @@ int main(int argc, char **argv) {
strcat(configuration_file_path, ".conf");
config.configfile = configuration_file_path;

config.statistics_requested - 0; // don't print stats in the log
config.statistics_requested = 0; // don't print stats in the log
config.latency = 88200; // AirPlay. Is also reset in rtsp.c when play is about to start
config.userSuppliedLatency = 0; // zero means none supplied
config.iTunesLatency = 99400; // this seems to work pretty well for iTunes from Version 10 (?)
Expand Down

1 comment on commit e052b5f

@mikebrady
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dates on this are wrong. Actually these changes were pushed on September 20, 2015.

Please sign in to comment.