Ver Fonte

DisplayManager: fix more refresh rate selection issues

Exact matches should be strictly preferred over inexact ones. There can
be rates which are multiple+close+both, whose weights add up to more
than the exact match weight (75+50+25=150>100). So increase the exact
match weight.

Also, don't compare the float refresh rate values with ==, as small
deviations will make the comparison fail. It's sort of amazing that it
worked at all. In this case, a rate of 23.9761 was not considered equal
to 23.976.

Note that if we have multiple close matches, we still don't pick the
closest rate. I don't think the weighting approach allows much
improvements here without turning it into a clusterfuck. But the
selection is probably fine now.
Vincent Lang há 7 anos atrás
pai
commit
39ed643465

+ 1 - 0
release-notes/1.1.7.txt

@@ -13,3 +13,4 @@ FIXED:
   - (Embedded) Fix performance regression on RPI
   - Subtitle selection for vobsubs with multiple stream should now finally work
   - Fix rate display mode auto switching with imprecise media FPS values values like 24.999
+    (and the same for imprecise display refresh rates)

+ 1 - 1
src/display/DisplayManager.cpp

@@ -126,7 +126,7 @@ int DisplayManager::findBestMatch(int display, DMMatchMediaInfo& matchInfo)
 
     // weight refresh rate
     // exact Match
-    if (candidate->m_refreshRate == matchInfo.m_refreshRate)
+    if (fabs(candidate->m_refreshRate - matchInfo.m_refreshRate) <= 0.01)
       weights[candidate->m_id]->m_weight += MATCH_WEIGHT_REFRESH_RATE_EXACT;
 
     // exact multiple refresh rate

+ 1 - 1
src/display/DisplayManager.h

@@ -73,7 +73,7 @@ public:
 // Matching weights
 #define MATCH_WEIGHT_RES 1000
 
-#define MATCH_WEIGHT_REFRESH_RATE_EXACT               100
+#define MATCH_WEIGHT_REFRESH_RATE_EXACT               200
 #define MATCH_WEIGHT_REFRESH_RATE_MULTIPLE            75
 #define MATCH_WEIGHT_REFRESH_RATE_CLOSE               50
 #define MATCH_WEIGHT_REFRESH_RATE_MULTIPLE_CLOSE      25