Fix VideoPlayer from stop after just few frames
This commit is contained in:
@@ -59,6 +59,7 @@ CFilePlayer::CFilePlayer()
|
||||
, m_bSeek(0)
|
||||
, m_dSeekPos(0)
|
||||
, m_nNalLength(0)
|
||||
, m_bLooped(FALSE)
|
||||
, m_pFormatContext(NULL)
|
||||
, m_hReadThread(0)
|
||||
, m_hVideoThread(0)
|
||||
@@ -280,8 +281,9 @@ BOOL CFilePlayer::play()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
m_bPlaying = TRUE;
|
||||
m_bLooped = FALSE; // fresh playback — no wrap yet
|
||||
|
||||
if (m_nVideoIndex >= 0)
|
||||
{
|
||||
@@ -440,12 +442,17 @@ BOOL CFilePlayer::readFrame()
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// File wrapped — flag it so the consumer (ANSVideoPlayer) can detect
|
||||
// EOF without watching m_nCurPos, which is non-monotonic during normal
|
||||
// playback (decode-order packet PTS + audio thread also writes to it).
|
||||
m_bLooped = TRUE;
|
||||
|
||||
if (av_read_frame(m_pFormatContext, &pkt) != 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (0 != rret)
|
||||
{
|
||||
return FALSE;
|
||||
|
||||
Reference in New Issue
Block a user