[player] Add config option high_resolution_clock

This commit is contained in:
ejurgensen 2017-06-26 23:32:24 +02:00
parent c2b1706855
commit 81a93bbec1
3 changed files with 16 additions and 7 deletions

View File

@ -37,6 +37,11 @@ general {
# When starting playback, autoselect speaker (if none of the previously
# selected speakers/outputs are available)
# speaker_autoselect = yes
# Most modern systems have a high-resolution clock, but if you are on an
# unusual platform and experience audio drop-outs, you can try changing
# this option
# high_resolution_clock = yes
}
# Library configuration

View File

@ -56,6 +56,11 @@ static cfg_opt_t sec_general[] =
CFG_STR("cache_path", STATEDIR "/cache/" PACKAGE "/cache.db", CFGF_NONE),
CFG_INT("cache_daap_threshold", 1000, CFGF_NONE),
CFG_BOOL("speaker_autoselect", cfg_true, CFGF_NONE),
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
CFG_BOOL("high_resolution_clock", cfg_false, CFGF_NONE),
#else
CFG_BOOL("high_resolution_clock", cfg_true, CFGF_NONE),
#endif
CFG_STR("allow_origin", "*", CFGF_NONE),
CFG_END()
};

View File

@ -3173,13 +3173,12 @@ player_init(void)
return -1;
}
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
/* FreeBSD will report a resolution of 1, but actually has a resolution
* larger than an audio packet
*/
if (timer_res.tv_nsec == 1)
timer_res.tv_nsec = 2 * AIRTUNES_V2_STREAM_PERIOD;
#endif
if (!cfg_getbool(cfg_getsec(cfg, "general"), "high_resolution_clock"))
{
DPRINTF(E_INFO, L_PLAYER, "High resolution clock not enabled on this system (res is %ld)\n", timer_res.tv_nsec);
timer_res.tv_nsec = 2 * AIRTUNES_V2_STREAM_PERIOD;
}
// Set the tick interval for the playback timer
interval = MAX(timer_res.tv_nsec, AIRTUNES_V2_STREAM_PERIOD);