ffmpeg: Fix crash on some media files

Return code EAGAIN expects the user to feed more packets into the decoder
This commit is contained in:
Stephan Vedder 2022-07-04 11:41:45 +02:00
parent b0766a62ec
commit 1c8bddf3ca

View File

@ -292,9 +292,15 @@ gtk_ff_media_file_decode_frame (GtkFfMediaFile *video,
if (errnum >= 0)
{
errnum = avcodec_receive_frame (video->codec_ctx, frame);
if (errnum == AVERROR (EAGAIN))
{
// Just retry with the next packet
errnum = 0;
continue;
}
if (errnum < 0)
G_BREAKPOINT();
if (errnum >= 0)
else
{
av_packet_unref (&packet);
break;