aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Sommerfeld <3226626+ksooo@users.noreply.github.com>2024-10-20 09:21:29 +0200
committerGitHub <noreply@github.com>2024-10-20 09:21:29 +0200
commit0742fcb8da44a7693467e330005e806fadae78e8 (patch)
tree2c2eba896dac968a49a53db849ad9d2cb0dc9e78
parentf48cefb0e6268c439dcbd8fa0826caf90d903178 (diff)
parent0883d7de4991ee3498a903baadb2a8d79f20d706 (diff)
Merge pull request #25851 from ksooo/cores-optimize-dvr-streams
[cores] CInputStreamPVRBase: Optimize: Only close the stream if it is…
-rw-r--r--xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamPVRBase.cpp13
-rw-r--r--xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamPVRBase.h1
2 files changed, 10 insertions, 4 deletions
diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamPVRBase.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamPVRBase.cpp
index 1f1622318d..7b8be41763 100644
--- a/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamPVRBase.cpp
+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamPVRBase.cpp
@@ -40,8 +40,9 @@ bool CInputStreamPVRBase::IsEOF()
bool CInputStreamPVRBase::Open()
{
- if (CDVDInputStream::Open() && OpenPVRStream())
+ if (!m_isOpen && CDVDInputStream::Open() && OpenPVRStream())
{
+ m_isOpen = true;
m_eof = false;
m_StreamProps->iStreamCount = 0;
return true;
@@ -54,9 +55,13 @@ bool CInputStreamPVRBase::Open()
void CInputStreamPVRBase::Close()
{
- ClosePVRStream();
- CDVDInputStream::Close();
- m_eof = true;
+ if (m_isOpen)
+ {
+ ClosePVRStream();
+ CDVDInputStream::Close();
+ m_eof = true;
+ m_isOpen = false;
+ }
}
int CInputStreamPVRBase::Read(uint8_t* buf, int buf_size)
diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamPVRBase.h b/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamPVRBase.h
index 67b5d32d1c..7a2d336512 100644
--- a/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamPVRBase.h
+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamPVRBase.h
@@ -80,4 +80,5 @@ protected:
std::shared_ptr<PVR_STREAM_PROPERTIES> m_StreamProps;
std::map<int, std::shared_ptr<CDemuxStream>> m_streamMap;
std::shared_ptr<PVR::CPVRClient> m_client;
+ bool m_isOpen{false};
};