aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorksooo <3226626+ksooo@users.noreply.github.com>2024-10-19 09:15:18 +0200
committerksooo <3226626+ksooo@users.noreply.github.com>2024-10-19 09:31:41 +0200
commit0883d7de4991ee3498a903baadb2a8d79f20d706 (patch)
treed3db1cbb5690ef5614143d023490351faef18dac
parentad51569897c335f0183e7567457e8824047bb22e (diff)
[cores] CInputStreamPVRBase: Optimize: Only close the stream if it is open. Only open the stream if it is not open.
-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};
};