else if (strcasecmp(str, "yes") == 0)
config.no_sync = 1;
else {
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
die("Invalid disable_synchronization option choice \"%s\". It should be \"yes\" or \"no\"");
}
}
else if (strcasecmp(str, "yes") == 0)
config.alsa_use_hardware_mute = 1;
else {
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
die("Invalid mute_using_playback_switch option choice \"%s\". It should be \"yes\" or "
"\"no\"");
}
else if (strcasecmp(str, "yes") == 0)
config.alsa_use_hardware_mute = 1;
else {
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
die("Invalid use_hardware_mute_if_available option choice \"%s\". It should be \"yes\" or "
"\"no\"");
}
else if (strcasecmp(str, "S8") == 0)
config.output_format = SPS_FORMAT_S8;
else {
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
die("Invalid output format \"%s\". It should be \"U8\", \"S8\", \"S16\", \"S24\", "
"\"S24_3LE\", \"S24_3BE\" or "
"\"S32\"",
config.output_rate = value;
break;
default:
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
die("Invalid output rate \"%d\". It should be a multiple of 44,100 up to 352,800", value);
}
}
else if (strcasecmp(str, "yes") == 0)
config.no_mmap = 0;
else {
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
die("Invalid use_mmap_if_available option choice \"%s\". It should be \"yes\" or \"no\"");
}
}
set_period_size_request = 1;
debug(1, "Value read for period size is %d.", value);
if (value < 0) {
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
die("Invalid alsa period size setting \"%d\". It "
"must be greater than 0.",
value);
set_buffer_size_request = 1;
debug(1, "Value read for buffer size is %d.", value);
if (value < 0) {
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
die("Invalid alsa buffer size setting \"%d\". It "
"must be greater than 0.",
value);
break;
default:
help();
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
die("Invalid audio option -%c specified", opt);
}
}
if (optind < argc) {
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
die("Invalid audio argument: %s", argv[optind]);
}
alsa_mix_ctrl);
if (snd_ctl_open(&ctl, alsa_mix_dev, 0) < 0) {
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
die("Cannot open control \"%s\"", alsa_mix_dev);
}
if (snd_ctl_elem_id_malloc(&elem_id) < 0) {
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
die("Cannot allocate memory for control \"%s\"", alsa_mix_dev);
}
snd_ctl_elem_id_set_interface(elem_id, SND_CTL_ELEM_IFACE_MIXER);
}
alsa_mix_handle = NULL;
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
return 0;
}
ret = snd_pcm_hw_params_any(alsa_handle, alsa_params);
if (ret < 0) {
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
;
die("audio_alsa: Broken configuration for device \"%s\": no configurations "
"available",
ret = snd_pcm_hw_params_set_access(alsa_handle, alsa_params, access);
if (ret < 0) {
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
die("audio_alsa: Access type not available for device \"%s\": %s", alsa_out_dev,
snd_strerror(ret));
}
sf = SND_PCM_FORMAT_S32;
break;
default:
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
sf = SND_PCM_FORMAT_S16; // this is just to quieten a compiler warning
die("Unsupported output format at audio_alsa.c");
}
ret = snd_pcm_hw_params_set_format(alsa_handle, alsa_params, sf);
if (ret < 0) {
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
die("audio_alsa: Sample format %d not available for device \"%s\": %s", sample_format,
alsa_out_dev, snd_strerror(ret));
}
ret = snd_pcm_hw_params_set_channels(alsa_handle, alsa_params, 2);
if (ret < 0) {
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
die("audio_alsa: Channels count (2) not available for device \"%s\": %s", alsa_out_dev,
snd_strerror(ret));
}
ret = snd_pcm_hw_params_set_period_size_near(alsa_handle, alsa_params, &period_size_requested,
&dir);
if (ret < 0) {
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
die("audio_alsa: cannot set period size of %lu: %s", period_size_requested,
snd_strerror(ret));
snd_pcm_uframes_t actual_period_size;
debug(1, "Attempting to set the buffer size to %lu", buffer_size_requested);
ret = snd_pcm_hw_params_set_buffer_size_near(alsa_handle, alsa_params, &buffer_size_requested);
if (ret < 0) {
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
die("audio_alsa: cannot set buffer size of %lu: %s", buffer_size_requested,
snd_strerror(ret));
}
ret = snd_pcm_hw_params(alsa_handle, alsa_params);
if (ret < 0) {
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
die("audio_alsa: Unable to set hw parameters for device \"%s\": %s.", alsa_out_dev,
snd_strerror(ret));
}
if (my_sample_rate != desired_sample_rate) {
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
die("Can't set the D/A converter to %d.", desired_sample_rate);
}
ret = snd_pcm_hw_params_get_buffer_size(alsa_params, &actual_buffer_length);
if (ret < 0) {
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
die("audio_alsa: Unable to get hw buffer length for device \"%s\": %s.", alsa_out_dev,
snd_strerror(ret));
}
debug(1, "Error preparing after delay error: \"%s\".", snd_strerror(derr));
}
}
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
// here, occasionally pretend there's a problem with pcm_get_delay()
// if ((random() % 100000) < 3) // keep it pretty rare
// reply = -EPERM; // pretend something bad has happened
if (audio_alsa.mute)
do_mute(0);
}
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
}
if (ret == 0) {
debug_mutex_lock(&alsa_mutex, 10000, 1);
debug(1, "Error preparing after play error: \"%s\".", snd_strerror(err));
}
}
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
}
}
alsa_handle = NULL;
}
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
}
static void stop(void) {
debug_mutex_lock(&alsa_mutex, 1000, 1);
volume_set_request = 1; // an external request has been made to set the volume
do_volume(vol);
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
}
/*
mute_request_pending = 1;
overriding_mute_state_requested = mute_state_requested;
do_mute(mute_state_requested);
- pthread_mutex_unlock(&alsa_mutex);
+ debug_mutex_unlock(&alsa_mutex, 3);
}
void do_mute(int mute_state_requested) {
debug_mutex_lock(&conn->flush_mutex, 1000, 1);
conn->flush_requested = 0;
conn->flush_rtp_timestamp = 0;
- pthread_mutex_unlock(&conn->flush_mutex);
+ debug_mutex_unlock(&conn->flush_mutex, 3);
}
- debug_mutex_lock(&conn->ab_mutex, 10000, 1);
+ debug_mutex_lock(&conn->ab_mutex, 40000, 1);
conn->packet_count++;
conn->time_of_last_audio_packet = get_absolute_time_in_fp();
if (conn->connection_state_to_output) { // if we are supposed to be processing these packets
if (rc)
debug(1, "Error signalling flowcontrol.");
}
- pthread_mutex_unlock(&conn->ab_mutex);
+ debug_mutex_unlock(&conn->ab_mutex, 3);
} else {
debug(
1,
abuf_t *curframe = 0;
int notified_buffer_empty = 0; // diagnostic only
- debug_mutex_lock(&conn->ab_mutex, 10000, 1);
+ debug_mutex_lock(&conn->ab_mutex, 40000, 1);
int wait;
long dac_delay = 0; // long because alsa returns a long
do {
if (conn->connection_state_to_output == 0) { // going off
debug_mutex_lock(&conn->flush_mutex, 1000, 1);
conn->flush_requested = 1;
- pthread_mutex_unlock(&conn->flush_mutex);
+ debug_mutex_unlock(&conn->flush_mutex, 3);
}
}
conn->time_since_play_started = 0;
conn->flush_requested = 0;
}
- pthread_mutex_unlock(&conn->flush_mutex);
+ debug_mutex_unlock(&conn->flush_mutex, 3);
uint32_t flush_limit = 0;
if (conn->ab_synced) {
if (conn->player_thread_please_stop) {
debug(3, "buffer_get_frame exiting due to thread stop request.");
- pthread_mutex_unlock(&conn->ab_mutex);
+ debug_mutex_unlock(&conn->ab_mutex, 3);
return 0;
}
curframe->ready = 0;
curframe->resend_level = 0;
conn->ab_read = SUCCESSOR(conn->ab_read);
- pthread_mutex_unlock(&conn->ab_mutex);
+ debug_mutex_unlock(&conn->ab_mutex, 3);
return curframe;
}
process_sample(*inptr++, &l_outptr, l_output_format, conn->fix_volume, dither, conn);
}
}
- pthread_mutex_unlock(&conn->vol_mutex);
+ debug_mutex_unlock(&conn->vol_mutex, 3);
conn->amountStuffed = tstuff;
return length + tstuff;
}
debug_mutex_lock(&conn->vol_mutex, 1000, 1);
conn->fix_volume = temp_fix_volume;
- pthread_mutex_unlock(&conn->vol_mutex);
+ debug_mutex_unlock(&conn->vol_mutex, 3);
if (config.loudness)
loudness_set_volume(software_attenuation / 100);
conn->flush_requested = 1;
// if (timestamp!=0)
conn->flush_rtp_timestamp = timestamp; // flush all packets up to (and including?) this
- pthread_mutex_unlock(&conn->flush_mutex);
+ debug_mutex_unlock(&conn->flush_mutex, 3);
conn->play_segment_reference_frame = 0;
conn->play_number_after_flush = 0;
#ifdef CONFIG_METADATA