Fix VideoPlayer from stop after just few frames

This commit is contained in:
2026-05-07 18:17:33 +10:00
parent a526aa6cdb
commit 2e0fee5e3d
6 changed files with 55 additions and 32 deletions
+8 -1
View File
@@ -53,6 +53,12 @@ public:
BOOL seek(int pos);
int64 getElapse() {return m_nCurPos;};
int64 getDuration() {return m_nDuration;}
// Set inside readFrame() when av_read_frame returns AVERROR_EOF and the
// reader auto-loops via av_seek_frame. Caller (ANSVideoPlayer) polls this
// to detect EOF without relying on m_nCurPos, which is non-monotonic
// (decode-order packet PTS + audio thread also writes to it).
BOOL hasLooped() {return m_bLooped;}
void clearLooped() {m_bLooped = FALSE;}
int getVideoCodec();
int getAudioCodec();
BOOL onRecord();
@@ -79,7 +85,8 @@ private:
int m_bSeek; // seek request
double m_dSeekPos; // seek position, nit is millisecond
int m_nNalLength;
BOOL m_bLooped; // set by readFrame() when EOF triggered an av_seek_frame back to start
AVFormatContext * m_pFormatContext; // format context
pthread_t m_hReadThread; // read thread