ffmpegdec: Fix system freeze at end of playback with ffmpeg 4.0+

Origin commit data
------------------
Branch: ni/coolstream
Commit: a114d80f21
Author: Hendi <hendi48@freenet.de>
Date: 2023-01-06 (Fri, 06 Jan 2023)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Hendi
2023-01-06 22:26:46 +01:00
committed by vanhofen
parent db32afcd17
commit 230ca29ecc

View File

@@ -104,7 +104,15 @@ int CFfmpegDec::Read(void *buf, size_t buf_size)
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
{
#if LIBAVFORMAT_VERSION_MAJOR < 58
return ((CFfmpegDec *) opaque)->Read(buf, (size_t) buf_size);
#else
// ffmpeg 4.0+: read_packet MUST return a valid AVERROR code instead of 0.
int len = ((CFfmpegDec *) opaque)->Read(buf, (size_t) buf_size);
if (len == 0)
return AVERROR_EOF;
return len;
#endif
}
int64_t CFfmpegDec::Seek(int64_t offset, int whence)