mpegts: try to make debug about failed tuning a bit more helpful.

This commit is contained in:
Adam Sutton 2013-10-09 20:25:22 +01:00
parent ea64db66d8
commit 3f702cf2a4
2 changed files with 23 additions and 11 deletions

View file

@ -529,8 +529,10 @@ static void
linuxdvb_mux_create_instances ( mpegts_mux_t *mm )
{
mpegts_input_t *mi;
LIST_FOREACH(mi, &mm->mm_network->mn_inputs, mi_network_link)
mi->mi_create_mux_instance(mi, mm);
LIST_FOREACH(mi, &mm->mm_network->mn_inputs, mi_network_link) {
if (mi->mi_is_enabled(mi))
mi->mi_create_mux_instance(mi, mm);
}
}
static void

View file

@ -300,7 +300,7 @@ static int
mpegts_mux_start
( mpegts_mux_t *mm, const char *reason, int weight )
{
int pass, fail, havefree = 0;
int pass, havefree = 0, enabled = 0;
char buf[256];
mpegts_mux_instance_t *mmi, *tune;
@ -323,12 +323,11 @@ mpegts_mux_start
/* Create mux instances (where needed) */
mm->mm_create_instances(mm);
if (!LIST_FIRST(&mm->mm_instances)) {
tvhtrace("mpegts", "%s - has no instances", buf);
tvhtrace("mpegts", "%s - has no instances, tuners enabled?", buf);
return SM_CODE_NO_VALID_ADAPTER;
}
/* Find */
fail = 0;
pass = 0;
mmi = NULL;
while (pass < 2) {
@ -341,6 +340,7 @@ mpegts_mux_start
int e = mmi->mmi_input->mi_is_enabled(mmi->mmi_input);
int f = mmi->mmi_input->mi_is_free(mmi->mmi_input);
tvhtrace("mpegts", "%s - enabled %d free %d\n", buf, e, f);
if (e) enabled = 1;
if (e && f) {
havefree = 1;
@ -366,7 +366,7 @@ mpegts_mux_start
if (tune) {
tvhinfo("mpegts", "%s - starting for '%s' (weight %d)",
buf, reason, weight);
if (!(fail = mpegts_mux_instance_start(&tune))) break;
if (!mpegts_mux_instance_start(&tune)) break;
tune = NULL;
tvhwarn("mpegts", "%s - failed to start, try another", buf);
}
@ -377,11 +377,21 @@ mpegts_mux_start
}
if (!tune) {
tvhdebug("mpegts", "%s - no free input (fail=%d)", buf, fail);
LIST_FOREACH(mmi, &mm->mm_instances, mmi_mux_link)
if (!mmi->mmi_tune_failed)
return havefree ? SM_CODE_NO_VALID_ADAPTER : SM_CODE_NO_FREE_ADAPTER;
tvhdebug("mpegts", "%s - tuning failed", buf);
LIST_FOREACH(mmi, &mm->mm_instances, mmi_mux_link) {
if (!mmi->mmi_tune_failed) {
if (!enabled) {
tvhdebug("mpegts", "%s - no tuners enabled", buf);
return SM_CODE_NO_VALID_ADAPTER;
} else if (havefree) {
tvhdebug("mpegts", "%s - no valid tuner available", buf);
return SM_CODE_NO_VALID_ADAPTER;
} else {
tvhdebug("mpegts", "%s - no free tuner available", buf);
return SM_CODE_NO_FREE_ADAPTER;
}
}
}
tvhdebug("mpegts", "%s - tuning failed, invalid config?", buf);
return SM_CODE_TUNING_FAILED;
}