add ability to not use mmap

This commit is contained in:
Mike Brady
2016-08-17 19:59:26 +01:00
parent 828cbc855b
commit c1e07b98d1
4 changed files with 13 additions and 2 deletions
+10 -1
View File
@@ -205,6 +205,15 @@ static int init(int argc, char **argv) {
die("Invalid disable_synchronization option choice \"%s\". It should be \"yes\" or \"no\"");
}
/* Get the use_mmap_if_available setting. */
if (config_lookup_string(config.cfg, "alsa.use_mmap_if_available", &str)) {
if (strcasecmp(str, "no") == 0)
config.no_mmap = 1;
else if (strcasecmp(str, "yes") == 0)
config.no_mmap = 0;
else
die("Invalid use_mmap_if_available option choice \"%s\". It should be \"yes\" or \"no\"");
}
/* Get the optional period size value */
if (config_lookup_int(config.cfg, "alsa.period_size",
&value)) {
@@ -393,7 +402,7 @@ int open_alsa_device(void) {
alsa_out_dev);
}
if (snd_pcm_hw_params_set_access(alsa_handle, alsa_params, SND_PCM_ACCESS_MMAP_INTERLEAVED) >= 0) {
if ((config.no_mmap == 0) && (snd_pcm_hw_params_set_access(alsa_handle, alsa_params, SND_PCM_ACCESS_MMAP_INTERLEAVED) >= 0)) {
if (output_method_signalled==0) {
debug(1,"Output written using MMAP");
output_method_signalled=1;
+1
View File
@@ -66,6 +66,7 @@ typedef struct {
int udp_port_range;
int ignore_volume_control;
int no_sync; // disable synchronisation, even if it's available
int no_mmap; // disable use of mmap-based output, even if it's available
int resyncthreshold; // if it get's out of whack my more than this, resync. Zero means never
// resync.
int allow_session_interruption;
+1 -1
View File
@@ -62,7 +62,7 @@ alsa =
// audio_backend_buffer_desired_length = 6615; // If set too small, buffer underflow occurs on low-powered machines. Too long and the response times with software mixer become annoying.
// disable_synchronization = "no"; // Set to "yes" to disable synchronization. Default is "no".
// period_size = <number>; // Use this optional advanced setting to set the alsa period size near to this value
// buffer_size = <number>; // Use this optional advanced setting to set the alsa buffer size near to this value
// use_mmap_if_available = "yes"; // Use this optional advanced setting to control whether MMAP-based output is used to communicate with the DAC. Default is "yes"
};
// These are parameters for the "pipe" audio back end, a back end that directs raw CD-style audio output to a pipe. No interpolation is done.
+1
View File
@@ -1012,6 +1012,7 @@ int main(int argc, char **argv) {
debug(1, "ignore_volume_control is %d.", config.ignore_volume_control);
debug(1, "playback_mode is %d (0-stereo, 1-mono).", config.playback_mode);
debug(1, "disable_synchronization is %d.", config.no_sync);
debug(1, "use_mmap_if_available is %d.", config.no_mmap ? 0 : 1);
debug(1, "audio backend desired buffer length is %d.",
config.audio_backend_buffer_desired_length);
debug(1, "audio backend latency offset is %d.", config.audio_backend_latency_offset);