Skip to content

Commit

Permalink
Fix a non-initialisation of parameters if no h/w mixer used. Add a fe…
Browse files Browse the repository at this point in the history
…w diagnostics, tidy up initial diagnostic message, add verbosity level and whether mixer used.
  • Loading branch information
mikebrady committed Dec 1, 2018
1 parent a5c65ce commit 2737222
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
10 changes: 5 additions & 5 deletions audio_alsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ audio_output audio_alsa = {
.rate_info = &get_rate_information,
.mute = NULL, // a function will be provided if it can, and is allowed to, do hardware mute
.volume = NULL, // a function will be provided if it can do hardware volume
.parameters = &parameters};
.parameters = NULL}; // a function will be provided if it can do hardware volume

static pthread_mutex_t alsa_mutex = PTHREAD_MUTEX_INITIALIZER;

Expand Down Expand Up @@ -402,7 +402,7 @@ static int init(int argc, char **argv) {
warn("Invalid audio argument: \"%s\" -- ignored", argv[optind]);
}

debug(1, "alsa output device name is \"%s\".", alsa_out_dev);
debug(1, "alsa: output device name is \"%s\".", alsa_out_dev);

if (hardware_mixer) {

Expand Down Expand Up @@ -453,8 +453,8 @@ static int init(int argc, char **argv) {
snd_ctl_elem_id_set_name(elem_id, alsa_mix_ctrl);

if (snd_ctl_get_dB_range(ctl, elem_id, &alsa_mix_mindb, &alsa_mix_maxdb) == 0) {
debug(1, "Volume control \"%s\" has dB volume from %f to %f.", alsa_mix_ctrl,
(1.0 * alsa_mix_mindb) / 100.0, (1.0 * alsa_mix_maxdb) / 100.0);
debug(1, "alsa: hardware mixer \"%s\" selected, with dB volume from %f to %f.",
alsa_mix_ctrl, (1.0 * alsa_mix_mindb) / 100.0, (1.0 * alsa_mix_maxdb) / 100.0);
has_softvol = 1;
audio_alsa.volume =
&volume; // insert the volume function now we know it can do dB stuff
Expand Down Expand Up @@ -492,7 +492,7 @@ static int init(int argc, char **argv) {
debug_mutex_unlock(&alsa_mutex, 3); // release the mutex
pthread_cleanup_pop(0);
} else {
// debug(1, "Has no mixer and thus no hardware mute.");
debug(1, "alsa: no hardware mixer selected.");
}

alsa_mix_handle = NULL;
Expand Down
12 changes: 9 additions & 3 deletions player.c
Original file line number Diff line number Diff line change
Expand Up @@ -1749,7 +1749,7 @@ void *player_thread_func(void *arg) {
#endif
pthread_setcancelstate(oldState, NULL);

// set the default volume to whaterver it was before, as stored in the config airplay_volume
// set the default volume to whatever it was before, as stored in the config airplay_volume
debug(2, "Set initial volume to %f.", config.airplay_volume);
player_volume(config.airplay_volume, conn); // will contain a cancellation point if asked to wait

Expand Down Expand Up @@ -2778,8 +2778,14 @@ int player_stop(rtsp_conn_info *conn) {
debug(2, "player_thread cancel...");
pthread_cancel(*conn->player_thread);
debug(2, "player_thread join...");
pthread_join(*conn->player_thread, NULL);
debug(2, "player_thread joined.");
if (pthread_join(*conn->player_thread, NULL) == -1) {
char errorstring[1024];
strerror_r(errno, (char *)errorstring, sizeof(errorstring));
debug(1, "Connection %d: error %d joining player thread: \"%s\".", conn->connection_number,
errno, (char *)errorstring);
} else {
debug(2, "player_thread joined.");
}
free(conn->player_thread);
conn->player_thread = NULL;
#ifdef CONFIG_METADATA
Expand Down
1 change: 1 addition & 0 deletions rtsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ int send_ssnc_metadata(uint32_t code, char *data, uint32_t length, int block) {
}

void pc_queue_cleanup_handler(void *arg) {
// debug(1, "pc_queue_cleanup_handler called.");
pc_queue *the_queue = (pc_queue *)arg;
int rc = pthread_mutex_unlock(&the_queue->pc_queue_lock);
if (rc)
Expand Down
13 changes: 7 additions & 6 deletions shairport.c
Original file line number Diff line number Diff line change
Expand Up @@ -1483,13 +1483,18 @@ int main(int argc, char **argv) {

char *version_dbs = get_version_string();
if (version_dbs) {
debug(1, "Version: \"%s\"", version_dbs);
debug(1, "software version: \"%s\"", version_dbs);
free(version_dbs);
} else {
debug(1, "Can't print the version information!");
debug(1, "can't print the version information!");
}

/* Print out options */
debug(1, "log verbosity is %d.", debuglev);
debug(1, "disable resend requests is %s.", config.disable_resend_requests ? "on" : "off");
debug(1, "diagnostic_drop_packet_fraction is %f. A value of 0.0 means no packets will be dropped "
"deliberately.",
config.diagnostic_drop_packet_fraction);
debug(1, "statistics_requester status is %d.", config.statistics_requested);
debug(1, "daemon status is %d.", config.daemonise);
debug(1, "deamon pid file path is \"%s\".", pid_file_proc());
Expand Down Expand Up @@ -1563,10 +1568,6 @@ int main(int argc, char **argv) {
#endif
debug(1, "loudness is %d.", config.loudness);
debug(1, "loudness reference level is %f", config.loudness_reference_volume_db);
debug(1, "disable resend requests is %s.", config.disable_resend_requests ? "on" : "off");
debug(1, "diagnostic_drop_packet_fraction is %f. A value of 0.0 means no packets will be dropped "
"deliberately.",
config.diagnostic_drop_packet_fraction);

uint8_t ap_md5[16];

Expand Down

0 comments on commit 2737222

Please sign in to comment.