From 193b9afdff2b6f778aaee53aecfa7d3390f9d858 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 22 Jul 2020 17:24:58 +0200 Subject: [PATCH] media-session: always prefer a port match First find a port match and then increase the score when the port was unconnected. --- src/examples/media-session/media-session.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/examples/media-session/media-session.c b/src/examples/media-session/media-session.c index 2a26f2287..9109337c0 100644 --- a/src/examples/media-session/media-session.c +++ b/src/examples/media-session/media-session.c @@ -1507,8 +1507,6 @@ static int score_ports(struct sm_port *out, struct sm_port *in) in->type != out->type) return 0; - if (!in->visited) - score += 5; if (out->channel == in->channel) score += 100; else if ((out->channel == SPA_AUDIO_CHANNEL_SL && in->channel == SPA_AUDIO_CHANNEL_RL) || @@ -1523,6 +1521,8 @@ static int score_ports(struct sm_port *out, struct sm_port *in) score += 30; else if (in->channel == SPA_AUDIO_CHANNEL_MONO) score += 20; + if (score > 0 && !in->visited) + score += 5; return score; }