summaryrefslogtreecommitdiff
path: root/src/examples
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2020-07-22 17:24:58 +0200
committerWim Taymans <wtaymans@redhat.com>2020-07-22 17:24:58 +0200
commit193b9afdff2b6f778aaee53aecfa7d3390f9d858 (patch)
tree3d17c1c14d00c9b512e6acddcd2cb47ec0f73895 /src/examples
parent201d762b2a25e5b1ed8d32939e7131b2a77a6f5d (diff)
media-session: always prefer a port match
First find a port match and then increase the score when the port was unconnected.
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/media-session/media-session.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/examples/media-session/media-session.c b/src/examples/media-session/media-session.c
index 2a26f228..9109337c 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;
}