Skip to content

Commit

Permalink
Merge pull request #7620 from Jalle19/dvdplayer-race
Browse files Browse the repository at this point in the history
do not access m_pVideoCodec from dvdplayer thread
  • Loading branch information
Jalle19 committed Jul 27, 2015
2 parents d648cd6 + 17f5565 commit 60bfc58
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 48 deletions.
4 changes: 1 addition & 3 deletions xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1867,9 +1867,7 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts)
if (m_old_pictcnt == m_cur_pictcnt)
m_ready_event.WaitMSec(25);

// we must return VC_BUFFER or VC_PICTURE,
// default to VC_BUFFER.
int rtn = VC_BUFFER;
int rtn = 0;
if (m_old_pictcnt != m_cur_pictcnt)
{
m_old_pictcnt++;
Expand Down
16 changes: 0 additions & 16 deletions xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,22 +244,6 @@ class CDVDVideoCodec
*/
virtual void SetSpeed(int iSpeed) {};

/*
* returns the number of demuxer bytes in any internal buffers
*/
virtual int GetDataSize(void)
{
return 0;
}

/*
* returns the time in seconds for demuxer bytes in any internal buffers
*/
virtual double GetTimeSize(void)
{
return 0;
}

enum EFilterFlags {
FILTER_NONE = 0x0,
FILTER_DEINTERLACE_YADIF = 0x1, /* use first deinterlace mode */
Expand Down
28 changes: 0 additions & 28 deletions xbmc/cores/dvdplayer/DVDPlayerVideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -809,34 +809,6 @@ void CDVDPlayerVideo::Flush()
m_messageQueue.Put(new CDVDMsg(CDVDMsg::GENERAL_FLUSH), 1);
}

int CDVDPlayerVideo::GetLevel() const
{
int level = m_messageQueue.GetLevel();

// fast exit, if the message queue is full, we do not care about the codec queue.
if (level == 100)
return level;

// Now for the harder choices, the message queue could be time or size based.
// In order to return the proper summed level, we need to know which.
if (m_messageQueue.IsDataBased())
{
int datasize = m_messageQueue.GetDataSize();
if (m_pVideoCodec)
datasize += m_pVideoCodec->GetDataSize();
return min(100, MathUtils::round_int((100.0 * datasize) / m_messageQueue.GetMaxDataSize()));
}
else
{
double timesize = m_messageQueue.GetTimeSize();
if (m_pVideoCodec)
timesize += m_pVideoCodec->GetTimeSize();
return min(100, MathUtils::round_int(100.0 * m_messageQueue.GetMaxTimeSize() * timesize));
}

return level;
}

#ifdef HAS_VIDEO_PLAYBACK
void CDVDPlayerVideo::ProcessOverlays(DVDVideoPicture* pSource, double pts)
{
Expand Down
2 changes: 1 addition & 1 deletion xbmc/cores/dvdplayer/DVDPlayerVideo.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class CDVDPlayerVideo : public CThread, public IDVDStreamPlayerVideo
void WaitForBuffers() { m_messageQueue.WaitUntilEmpty(); }
bool AcceptsData() const { return !m_messageQueue.IsFull(); }
bool HasData() const { return m_messageQueue.GetDataSize() > 0; }
int GetLevel() const;
int GetLevel() const { return m_messageQueue.GetLevel(); }
bool IsInited() const { return m_messageQueue.IsInited(); }
void SendMessage(CDVDMsg* pMsg, int priority = 0) { m_messageQueue.Put(pMsg, priority); }
void FlushMessages() { m_messageQueue.Flush(); }
Expand Down

0 comments on commit 60bfc58

Please sign in to comment.