From d9790c96da17b2f298a8f2dfdfd9c9d6caa90f48 Mon Sep 17 00:00:00 2001 From: Riza Sulistyo Date: Thu, 26 Mar 2015 10:38:30 +0000 Subject: Re #1831: Fixed matching algorithm when the supported format only have one size. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5031 74dad513-b988-da41-8d7b-12977e46ad98 --- pjmedia/src/pjmedia/vid_port.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pjmedia/src/pjmedia/vid_port.c b/pjmedia/src/pjmedia/vid_port.c index 1671b477..57919d4d 100644 --- a/pjmedia/src/pjmedia/vid_port.c +++ b/pjmedia/src/pjmedia/vid_port.c @@ -346,6 +346,8 @@ static struct fmt_prop find_closest_fmt(pj_uint32_t req_fmt_id, } /* No need to calculate ratio if exact match is found. */ if (!found_exact_match) { + pj_bool_t found_match = PJ_FALSE; + /* We have the list of supported format with nearest width. Now get the * best ratio. */ @@ -360,7 +362,8 @@ static struct fmt_prop find_closest_fmt(pj_uint32_t req_fmt_id, diff_ratio = GET_DIFF(sup_ratio, req_ratio); - if ((i==0) || (diff_ratio <= min_diff_ratio)) { + if ((!found_match) || (diff_ratio <= min_diff_ratio)) { + found_match = PJ_TRUE; match_idx = i; min_diff_ratio = diff_ratio; } -- cgit v1.2.3