int joined;
float volume;
+ int volume_changed;
unsigned char *metadata;
int metadata_len;
unsigned char *coverart;
}
static int
-raop_rtp_process_events(raop_rtp_t *raop_rtp, void *cb_data, float *volume)
+raop_rtp_process_events(raop_rtp_t *raop_rtp, void *cb_data)
{
int flush;
+ float volume;
int volume_changed;
unsigned char *metadata;
int metadata_len;
int coverart_len;
assert(raop_rtp);
- assert(volume);
MUTEX_LOCK(raop_rtp->run_mutex);
if (!raop_rtp->running) {
}
/* Read the volume level */
- volume_changed = (*volume != raop_rtp->volume);
- *volume = raop_rtp->volume;
+ volume = raop_rtp->volume;
+ volume_changed = raop_rtp->volume_changed;
+ raop_rtp->volume_changed = 0;
/* Read the flush value */
flush = raop_rtp->flush;
/* Call set_volume callback if changed */
if (volume_changed) {
if (raop_rtp->callbacks.audio_set_volume) {
- raop_rtp->callbacks.audio_set_volume(raop_rtp->callbacks.cls, cb_data, *volume);
+ raop_rtp->callbacks.audio_set_volume(raop_rtp->callbacks.cls, cb_data, volume);
}
}
unsigned int packetlen;
struct sockaddr_storage saddr;
socklen_t saddrlen;
- float volume = 0.0;
const ALACSpecificConfig *config;
void *cb_data = NULL;
int nfds, ret;
/* Check if we are still running and process callbacks */
- if (raop_rtp_process_events(raop_rtp, cb_data, &volume)) {
+ if (raop_rtp_process_events(raop_rtp, cb_data)) {
break;
}
int stream_fd = -1;
unsigned char packet[RAOP_PACKET_LEN];
unsigned int packetlen = 0;
- float volume = 0.0;
const ALACSpecificConfig *config;
void *cb_data = NULL;
int nfds, ret;
/* Check if we are still running and process callbacks */
- if (raop_rtp_process_events(raop_rtp, cb_data, &volume)) {
+ if (raop_rtp_process_events(raop_rtp, cb_data)) {
break;
}
/* Set volume in thread instead */
MUTEX_LOCK(raop_rtp->run_mutex);
raop_rtp->volume = volume;
+ raop_rtp->volume_changed = 1;
MUTEX_UNLOCK(raop_rtp->run_mutex);
}