Skip to content

Commit

Permalink
[dvdplayer] do not access m_pVideoCodec from dvdplayer thread
Browse files Browse the repository at this point in the history
This also aligns the CDVDPlayerVideo implementation with CDVDPlayerAudio
  • Loading branch information
Jalle19 committed Jul 25, 2015
1 parent 4c68497 commit caa7a29
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
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 caa7a29

Please sign in to comment.