clang format

This commit is contained in:
Mike Brady
2019-01-04 17:26:55 +00:00
parent 9552b278b7
commit 80f15e1f57
7 changed files with 34 additions and 21 deletions
+5 -3
View File
@@ -152,15 +152,17 @@ void parse_general_audio_options(void) {
config.audio_backend_buffer_desired_length = dvalue;
}
}
/* Get the minumum buffer size for fancy interpolation setting in seconds. */
if (config_lookup_float(config.cfg, "general.audio_backend_buffer_interpolation_threshold_in_seconds",
if (config_lookup_float(config.cfg,
"general.audio_backend_buffer_interpolation_threshold_in_seconds",
&dvalue)) {
if ((dvalue < 0) || (dvalue > config.audio_backend_buffer_desired_length)) {
die("Invalid audio_backend_buffer_interpolation_threshold_in_seconds value: \"%f\". It "
"should be between 0 and "
"audio_backend_buffer_desired_length_in_seconds of %.3f, default is %.3f seconds",
dvalue, config.audio_backend_buffer_desired_length,config.audio_backend_buffer_interpolation_threshold_in_seconds);
dvalue, config.audio_backend_buffer_desired_length,
config.audio_backend_buffer_interpolation_threshold_in_seconds);
} else {
config.audio_backend_buffer_interpolation_threshold_in_seconds = dvalue;
}
+12 -9
View File
@@ -637,7 +637,8 @@ static int init(int argc, char **argv) {
config.audio_backend_latency_offset = 0;
config.audio_backend_buffer_desired_length = 0.15;
config.audio_backend_buffer_interpolation_threshold_in_seconds = 0.050; // below this, basic interpolation will be used to save time.
config.audio_backend_buffer_interpolation_threshold_in_seconds =
0.050; // below this, basic interpolation will be used to save time.
config.alsa_maximum_stall_time = 0.200; // 200 milliseconds -- if it takes longer, it's a problem
// get settings from settings file first, allow them to be overridden by
@@ -1145,11 +1146,12 @@ int untimed_play(void *buf, int samples) {
if (ret == 0) { // will be non-zero if an error or a stall
if ((samples != 0) && (buf != NULL)) {
// jut check the state of the DAC
if ((state != SND_PCM_STATE_PREPARED) && (state != SND_PCM_STATE_RUNNING) && (state != SND_PCM_STATE_XRUN)) {
debug(1,"alsa: DAC in odd SND_PCM_STATE_* %d prior to writing.",state);
if ((state != SND_PCM_STATE_PREPARED) && (state != SND_PCM_STATE_RUNNING) &&
(state != SND_PCM_STATE_XRUN)) {
debug(1, "alsa: DAC in odd SND_PCM_STATE_* %d prior to writing.", state);
}
// debug(3, "write %d frames.", samples);
@@ -1188,7 +1190,8 @@ int untimed_play(void *buf, int samples) {
if (ret == -EPIPE) { /* underrun */
ret = snd_pcm_recover(alsa_handle, ret, debuglev > 0 ? 1 : 0);
if (ret < 0) {
debug(1, "alsa: failed to recover from SND_PCM_STATE_XRUN with snd_pcm_recover(); trying snd_pcm_prepare().");
debug(1, "alsa: failed to recover from SND_PCM_STATE_XRUN with snd_pcm_recover(); "
"trying snd_pcm_prepare().");
ret = snd_pcm_prepare(alsa_handle);
if (ret < 0)
warn("alsa: can't recover from SND_PCM_STATE_XRUN, snd_pcm_recover() and "
@@ -1196,8 +1199,8 @@ int untimed_play(void *buf, int samples) {
snd_strerror(ret));
}
} else if (ret == -ESTRPIPE) { /* suspended */
while ((ret = snd_pcm_resume(alsa_handle)) == -EAGAIN) {
sleep(1); /* wait until the suspend flag is released */
while ((ret = snd_pcm_resume(alsa_handle)) == -EAGAIN) {
sleep(1); /* wait until the suspend flag is released */
if (ret < 0) {
ret = snd_pcm_prepare(alsa_handle);
if (ret < 0)
@@ -1209,7 +1212,7 @@ int untimed_play(void *buf, int samples) {
}
}
}
} else {
} else {
debug(1, "alsa: device status %d faulty for play.", state);
frame_index = 0;
measurement_data_is_valid = 0;
+3 -1
View File
@@ -301,7 +301,9 @@ void *open_client_if_necessary_thread_function(void *arg) {
int jack_init(__attribute__((unused)) int argc, __attribute__((unused)) char **argv) {
config.audio_backend_latency_offset = 0;
config.audio_backend_buffer_desired_length = 0.500;
config.audio_backend_buffer_interpolation_threshold_in_seconds = 0.25; // below this, soxr interpolation will not occur -- it'll be basic interpolation instead.
config.audio_backend_buffer_interpolation_threshold_in_seconds =
0.25; // below this, soxr interpolation will not occur -- it'll be basic interpolation
// instead.
config.jack_auto_client_open_interval = 1; // check every second
// get settings from settings file first, allow them to be overridden by
+3 -1
View File
@@ -70,7 +70,9 @@ static int init(__attribute__((unused)) int argc, __attribute__((unused)) char *
// set up default values first
config.audio_backend_buffer_desired_length = 0.35;
config.audio_backend_buffer_interpolation_threshold_in_seconds = 0.02; // below this, soxr interpolation will not occur -- it'll be basic interpolation instead.
config.audio_backend_buffer_interpolation_threshold_in_seconds =
0.02; // below this, soxr interpolation will not occur -- it'll be basic interpolation
// instead.
config.audio_backend_latency_offset = 0;
+3 -1
View File
@@ -99,7 +99,9 @@ static int init(int argc, char **argv) {
devname = SIO_DEVANY;
config.audio_backend_buffer_desired_length = 1.0;
config.audio_backend_buffer_interpolation_threshold_in_seconds = 0.25; // below this, soxr interpolation will not occur -- it'll be basic interpolation instead.
config.audio_backend_buffer_interpolation_threshold_in_seconds =
0.25; // below this, soxr interpolation will not occur -- it'll be basic interpolation
// instead.
config.audio_backend_latency_offset = 0;
// get settings from settings file
+3 -1
View File
@@ -168,7 +168,9 @@ typedef struct {
int interface_index; // only valid if the interface string is non-NULL
double audio_backend_buffer_desired_length; // this will be the length in seconds of the
// audio backend buffer -- the DAC buffer for ALSA
double audio_backend_buffer_interpolation_threshold_in_seconds; // below this, soxr interpolation will not occur -- it'll be basic interpolation instead.
double audio_backend_buffer_interpolation_threshold_in_seconds; // below this, soxr interpolation
// will not occur -- it'll be
// basic interpolation instead.
double audio_backend_latency_offset; // this will be the offset in seconds to compensate for any
// fixed latency there might be in the audio path
double audio_backend_silent_lead_in_time; // the length of the silence that should precede a play.
+5 -5
View File
@@ -1491,7 +1491,7 @@ void *player_thread_func(void *arg) {
conn->first_packet_timestamp = 0;
conn->flush_requested = 0;
conn->fix_volume = 0x10000;
if (conn->latency == 0) {
debug(3, "No latency has (yet) been specified. Setting 88,200 (2 seconds) frames "
"as a default.");
@@ -1551,9 +1551,10 @@ void *player_thread_func(void *arg) {
debug(3, "Output frame bytes is %d.", conn->output_bytes_per_frame);
conn->dac_buffer_queue_minimum_length = (int64_t)(config.audio_backend_buffer_interpolation_threshold_in_seconds *
config.output_rate);
debug(1,"dac_buffer_queue_minimum_length is %" PRId64 " frames.", conn->dac_buffer_queue_minimum_length);
conn->dac_buffer_queue_minimum_length = (int64_t)(
config.audio_backend_buffer_interpolation_threshold_in_seconds * config.output_rate);
debug(1, "dac_buffer_queue_minimum_length is %" PRId64 " frames.",
conn->dac_buffer_queue_minimum_length);
conn->session_corrections = 0;
// conn->play_segment_reference_frame = 0; // zero signals that we are not in a play segment
@@ -2835,4 +2836,3 @@ int player_stop(rtsp_conn_info *conn) {
return -1;
}
}