fix regression no volume metadata was being sent if configured to ignore volume control -- issue #903.

This commit is contained in:
Mike Brady
2019-09-10 09:56:25 +01:00
parent c7a290c36a
commit b59dd4229e
+21 -6
View File
@@ -2870,20 +2870,19 @@ void player_volume_without_notification(double airplay_volume, rtsp_conn_info *c
if (config.logOutputLevel) {
inform("Output Level set to: %.2f dB.", scaled_attenuation / 100.0);
}
#ifdef CONFIG_METADATA
// here, send the 'pvol' metadata message when the airplay volume information
// is being used by shairport sync to control the output volume
char *dv = malloc(128); // will be freed in the metadata thread
if (dv) {
memset(dv, 0, 128);
if (config.ignore_volume_control == 1)
snprintf(dv, 127, "%.2f,%.2f,%.2f,%.2f", airplay_volume, 0.0, 0.0, 0.0);
else
snprintf(dv, 127, "%.2f,%.2f,%.2f,%.2f", airplay_volume, scaled_attenuation / 100.0,
snprintf(dv, 127, "%.2f,%.2f,%.2f,%.2f", airplay_volume, scaled_attenuation / 100.0,
min_db / 100.0, max_db / 100.0);
send_ssnc_metadata('pvol', dv, strlen(dv), 1);
}
#endif
// here, store the volume for possible use in the future
if (config.output->mute)
config.output->mute(0);
@@ -2895,6 +2894,22 @@ void player_volume_without_notification(double airplay_volume, rtsp_conn_info *c
volume_mode, airplay_volume, software_attenuation, hardware_attenuation);
}
}
#ifdef CONFIG_METADATA
else {
// here, send the 'pvol' metadata message when the airplay volume information
// is not being used by shairport sync to control the output volume
char *dv = malloc(128); // will be freed in the metadata thread
if (dv) {
memset(dv, 0, 128);
snprintf(dv, 127, "%.2f,%.2f,%.2f,%.2f", airplay_volume, 0.0, 0.0, 0.0);
send_ssnc_metadata('pvol', dv, strlen(dv), 1);
}
}
#endif
// here, store the volume for possible use in the future
config.airplay_volume = airplay_volume;
debug_mutex_unlock(&conn->volume_control_mutex, 3);
}