Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/common/ChooserDefault.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ void CRepresentationChooserDefault::SetSecureSession(const bool isSecureSession)

void CRepresentationChooserDefault::PostInit()
{
m_screenLastWidth = m_screenCurrentWidth;
m_screenLastHeight = m_screenCurrentHeight;

RefreshResolution();

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

void CRepresentationChooserDefault::CheckResolution()
{
if (m_screenWidth != m_screenCurrentWidth || m_screenHeight != m_screenCurrentHeight)
if (m_screenLastWidth != m_screenCurrentWidth || m_screenLastHeight != m_screenCurrentHeight)
{
// Update the screen resolution values only after n seconds
// to prevent too fast update when Kodi window will be resized
Expand All @@ -128,6 +131,8 @@ void CRepresentationChooserDefault::CheckResolution()
return;
}
RefreshResolution();
m_screenLastWidth = m_screenCurrentWidth;
m_screenLastHeight = m_screenCurrentHeight;
m_screenResLastUpdate = std::chrono::steady_clock::now();
LOG::Log(LOGDEBUG, "[Repr. chooser] Screen resolution has changed: %ix%i", m_screenCurrentWidth,
m_screenCurrentHeight);
Expand Down
2 changes: 2 additions & 0 deletions src/common/ChooserDefault.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class ATTR_DLL_LOCAL CRepresentationChooserDefault : public IRepresentationChoos

int m_screenWidth{0};
int m_screenHeight{0};
int m_screenLastWidth{0};
int m_screenLastHeight{0};
std::optional<std::chrono::steady_clock::time_point> m_screenResLastUpdate;

std::pair<int, int> m_screenResMax; // Max resolution for non-protected video content
Expand Down
6 changes: 4 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,12 @@ bool CInputStreamAdaptive::OpenStream(int streamid)
if (!stream)
return false;

const bool isStreamChanged{stream->m_adStream.StreamChanged()};

if (stream->IsEnabled())
{
// Stream quality changed (by "adaptive" streaming, not OSD)
if (stream->m_adStream.StreamChanged())
if (isStreamChanged)
{
stream->Reset();
stream->m_adStream.Reset();
Expand Down Expand Up @@ -221,7 +223,7 @@ bool CInputStreamAdaptive::OpenStream(int streamid)
}
}

if (m_checkCoreReopen)
if (m_checkCoreReopen && !isStreamChanged)
{
LOG::Log(LOGDEBUG, "OpenStream(%d): The stream has already been opened", streamid);
return false;
Expand Down