Browse files

dvdplayer: make sure we lock a mutex around CDVDPlayerSubtitle

Appliation thread call into this to get current subtitle
  • Loading branch information...
1 parent 748bd2a commit 7452460c714f105470f837b0aa1449684bb4eaeb @elupus elupus committed Dec 15, 2012
Showing with 11 additions and 0 deletions.
  1. +8 −0 xbmc/cores/dvdplayer/DVDPlayerSubtitle.cpp
  2. +3 −0 xbmc/cores/dvdplayer/DVDPlayerSubtitle.h
View
8 xbmc/cores/dvdplayer/DVDPlayerSubtitle.cpp
@@ -63,6 +63,8 @@ void CDVDPlayerSubtitle::Flush()
void CDVDPlayerSubtitle::SendMessage(CDVDMsg* pMsg)
{
+ CSingleLock lock(m_section);
+
if (pMsg->IsType(CDVDMsg::DEMUXER_PACKET))
{
CDVDMsgDemuxerPacket* pMsgDemuxerPacket = (CDVDMsgDemuxerPacket*)pMsg;
@@ -137,6 +139,8 @@ void CDVDPlayerSubtitle::SendMessage(CDVDMsg* pMsg)
bool CDVDPlayerSubtitle::OpenStream(CDVDStreamInfo &hints, string &filename)
{
+ CSingleLock lock(m_section);
+
CloseStream(false);
m_streaminfo = hints;
@@ -175,6 +179,8 @@ bool CDVDPlayerSubtitle::OpenStream(CDVDStreamInfo &hints, string &filename)
void CDVDPlayerSubtitle::CloseStream(bool flush)
{
+ CSingleLock lock(m_section);
+
if(m_pSubtitleStream)
SAFE_DELETE(m_pSubtitleStream);
if(m_pSubtitleFileParser)
@@ -190,6 +196,8 @@ void CDVDPlayerSubtitle::CloseStream(bool flush)
void CDVDPlayerSubtitle::Process(double pts)
{
+ CSingleLock lock(m_section);
+
if (m_pSubtitleFileParser)
{
if(pts == DVD_NOPTS_VALUE)
View
3 xbmc/cores/dvdplayer/DVDPlayerSubtitle.h
@@ -62,6 +62,9 @@ class CDVDPlayerSubtitle
CDVDStreamInfo m_streaminfo;
double m_lastPts;
+
+
+ CCriticalSection m_section;
};

0 comments on commit 7452460

Please sign in to comment.