Skip to content

Commit

Permalink
ffmpegdec: Fix system freeze at end of playback with ffmpeg
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendi48 authored and BPanther committed Oct 4, 2023
1 parent 6d53df8 commit 7e9cca7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/driver/audiodec/ffmpegdec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,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)
Expand Down

0 comments on commit 7e9cca7

Please sign in to comment.