Skip to content

Commit 8070c8d

Browse files
linzackCastagnaIT
authored andcommitted
[chooser] Fix screen resolution false positives
CRepresentationChooserDefault::CheckResolution() compared the user-configured resolution limit (m_screenWidth) against the actual physical hardware resolution (m_screenCurrentWidth), resulting in perpetual false positives every 10 seconds. Dedicated tracking variables (m_screenLastWidth, m_screenLastHeight) now correctly isolate physical window resize detection from the addon's maximum quality configuration limits.
1 parent 5b12bb2 commit 8070c8d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/common/ChooserDefault.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ void CRepresentationChooserDefault::SetSecureSession(const bool isSecureSession)
9191

9292
void CRepresentationChooserDefault::PostInit()
9393
{
94+
m_screenLastWidth = m_screenCurrentWidth;
95+
m_screenLastHeight = m_screenCurrentHeight;
96+
9497
RefreshResolution();
9598

9699
if (!m_bandwidthInitAuto)
@@ -116,7 +119,7 @@ void CRepresentationChooserDefault::PostInit()
116119

117120
void CRepresentationChooserDefault::CheckResolution()
118121
{
119-
if (m_screenWidth != m_screenCurrentWidth || m_screenHeight != m_screenCurrentHeight)
122+
if (m_screenLastWidth != m_screenCurrentWidth || m_screenLastHeight != m_screenCurrentHeight)
120123
{
121124
// Update the screen resolution values only after n seconds
122125
// to prevent too fast update when Kodi window will be resized
@@ -128,6 +131,8 @@ void CRepresentationChooserDefault::CheckResolution()
128131
return;
129132
}
130133
RefreshResolution();
134+
m_screenLastWidth = m_screenCurrentWidth;
135+
m_screenLastHeight = m_screenCurrentHeight;
131136
m_screenResLastUpdate = std::chrono::steady_clock::now();
132137
LOG::Log(LOGDEBUG, "[Repr. chooser] Screen resolution has changed: %ix%i", m_screenCurrentWidth,
133138
m_screenCurrentHeight);

src/common/ChooserDefault.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class ATTR_DLL_LOCAL CRepresentationChooserDefault : public IRepresentationChoos
4949

5050
int m_screenWidth{0};
5151
int m_screenHeight{0};
52+
int m_screenLastWidth{0};
53+
int m_screenLastHeight{0};
5254
std::optional<std::chrono::steady_clock::time_point> m_screenResLastUpdate;
5355

5456
std::pair<int, int> m_screenResMax; // Max resolution for non-protected video content

0 commit comments

Comments
 (0)