Skip to content

Commit

Permalink
ffmedia: Do not stop decoding when sending packets hits EOF.
Browse files Browse the repository at this point in the history
Only stop decoding when there are no more frames to be decoded, or a
real error.

Fixes #3927.
  • Loading branch information
renpytom committed Sep 2, 2022
1 parent c29e7a0 commit 75669c5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions module/ffmedia.c
Expand Up @@ -656,7 +656,7 @@ static void decode_audio(MediaState *ms) {

if (ret == 0) {
dequeue_packet(&ms->audio_packet_queue);
} else if (ret == AVERROR(EAGAIN)) {
} else if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
// pass
} else {
ms->audio_finished = 1;
Expand Down Expand Up @@ -777,9 +777,10 @@ static SurfaceQueueEntry *decode_video_frame(MediaState *ms) {
AVPacket *pkt = read_packet(ms, &ms->video_packet_queue);
ret = avcodec_send_packet(ms->video_context, pkt);


if (ret == 0) {
dequeue_packet(&ms->video_packet_queue);
} else if (ret == AVERROR(EAGAIN)) {
} else if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
// pass
} else {
ms->video_finished = 1;
Expand Down

0 comments on commit 75669c5

Please sign in to comment.