mpegts: Add extra weight for inputs with more subscribers
This simple code assures that the inputs having more subscribers will be selected after ones with less subscribers.
This commit is contained in:
parent
63dd191bd2
commit
8d9608b611
1 changed files with 4 additions and 2 deletions
|
@ -192,12 +192,13 @@ mpegts_input_get_weight ( mpegts_input_t *mi )
|
|||
const mpegts_mux_instance_t *mmi;
|
||||
const service_t *s;
|
||||
const th_subscription_t *ths;
|
||||
int w = 0;
|
||||
int w = 0, count = 0;
|
||||
|
||||
/* Direct subs */
|
||||
LIST_FOREACH(mmi, &mi->mi_mux_active, mmi_active_link) {
|
||||
LIST_FOREACH(ths, &mmi->mmi_subs, ths_mmi_link) {
|
||||
w = MAX(w, ths->ths_weight);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -206,10 +207,11 @@ mpegts_input_get_weight ( mpegts_input_t *mi )
|
|||
LIST_FOREACH(s, &mi->mi_transports, s_active_link) {
|
||||
LIST_FOREACH(ths, &s->s_subscriptions, ths_service_link) {
|
||||
w = MAX(w, ths->ths_weight);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&mi->mi_output_lock);
|
||||
return w;
|
||||
return w > 0 ? w + count - 1 : 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Add table
Reference in a new issue