From 5f68941241de591098d2a5ecef4630143476a42c Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Fri, 17 Oct 2014 10:18:39 +0200 Subject: [PATCH] sources: select only when reference can be updated Before selecting the new synchronization source wait until the reference can be updated, i.e. the source has new samples. --- sources.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sources.c b/sources.c index 6e0cfae..6606e7b 100644 --- a/sources.c +++ b/sources.c @@ -875,7 +875,13 @@ SRC_SelectSource(SRC_Instance updated_inst) sources[selected_source_index]->status != SRC_SELECTABLE || (max_score_index != selected_source_index && max_score > SCORE_LIMIT)) { - /* We have to elect a new synchronisation source */ + /* Before selecting the new synchronisation source wait until the reference + can be updated */ + if (sources[max_score_index]->updates == 0) { + selected_source_index = INVALID_SOURCE; + DEBUG_LOG(LOGF_Sources, "best source has no updates"); + return; + } selected_source_index = max_score_index; log_selection_message("Selected source %s",