aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Marshall <jmarshall@xbmc.org>2014-05-06 19:40:17 +1200
committerJonathan Marshall <jmarshall@never.you.mind>2014-05-07 10:43:49 +1200
commita58bcbb0a35ac8e26a880be477705d833330ecc5 (patch)
tree19290f2f2cc7ab50fe8a495db57ba923c1cbb17a
parent15eb338bf2e5bd652669575194b1f9c96b9e7c47 (diff)
[rtmp] check m_rtmp for non-NULL - fixes crashes with missing librtmp
-rw-r--r--xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp
index b02792a87b..93fc6f0afa 100644
--- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp
+++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp
@@ -104,7 +104,8 @@ CDVDInputStreamRTMP::~CDVDInputStreamRTMP()
m_sStreamPlaying = NULL;
Close();
- m_libRTMP.Free(m_rtmp);
+ if (m_rtmp)
+ m_libRTMP.Free(m_rtmp);
m_rtmp = NULL;
m_bPaused = false;
}
@@ -139,7 +140,7 @@ bool CDVDInputStreamRTMP::Open(const char* strFile, const std::string& content)
m_sStreamPlaying = NULL;
}
- if (!CDVDInputStream::Open(strFile, "video/x-flv"))
+ if (!m_rtmp || !CDVDInputStream::Open(strFile, "video/x-flv"))
return false;
CSingleLock lock(m_RTMPSection);
@@ -181,7 +182,8 @@ void CDVDInputStreamRTMP::Close()
CSingleLock lock(m_RTMPSection);
CDVDInputStream::Close();
- m_libRTMP.Close(m_rtmp);
+ if (m_rtmp)
+ m_libRTMP.Close(m_rtmp);
m_optionvalues.clear();
m_eof = true;
@@ -190,6 +192,9 @@ void CDVDInputStreamRTMP::Close()
int CDVDInputStreamRTMP::Read(uint8_t* buf, int buf_size)
{
+ if (!m_rtmp)
+ return -1;
+
int i = m_libRTMP.Read(m_rtmp, (char *)buf, buf_size);
if (i < 0)
m_eof = true;
@@ -210,7 +215,7 @@ bool CDVDInputStreamRTMP::SeekTime(int iTimeInMsec)
CLog::Log(LOGNOTICE, "RTMP Seek to %i requested", iTimeInMsec);
CSingleLock lock(m_RTMPSection);
- if (m_libRTMP.SendSeek(m_rtmp, iTimeInMsec))
+ if (m_rtmp && m_libRTMP.SendSeek(m_rtmp, iTimeInMsec))
return true;
return false;
@@ -229,7 +234,8 @@ bool CDVDInputStreamRTMP::Pause(double dTime)
CLog::Log(LOGNOTICE, "RTMP Pause %s requested", m_bPaused ? "TRUE" : "FALSE");
- m_libRTMP.Pause(m_rtmp, m_bPaused);
+ if (m_rtmp)
+ m_libRTMP.Pause(m_rtmp, m_bPaused);
return true;
}