mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 00:14:11 +09:00
[codec,h264] ignore EAGAIN for FFMPEG
This commit is contained in:
@@ -398,10 +398,9 @@ static BOOL tsmf_ffmpeg_decode_video(ITSMFDecoder* decoder, const BYTE* data, UI
|
||||
len = avcodec_send_packet(mdecoder->codec_context, &pkt);
|
||||
if (len > 0)
|
||||
{
|
||||
do
|
||||
{
|
||||
len = avcodec_receive_frame(mdecoder->codec_context, mdecoder->frame);
|
||||
} while (len == AVERROR(EAGAIN));
|
||||
len = avcodec_receive_frame(mdecoder->codec_context, mdecoder->frame);
|
||||
if (len == AVERROR(EAGAIN))
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -541,10 +540,9 @@ static BOOL tsmf_ffmpeg_decode_audio(ITSMFDecoder* decoder, const BYTE* data, UI
|
||||
len = avcodec_send_packet(mdecoder->codec_context, &pkt);
|
||||
if (len > 0)
|
||||
{
|
||||
do
|
||||
{
|
||||
len = avcodec_receive_frame(mdecoder->codec_context, decoded_frame);
|
||||
} while (len == AVERROR(EAGAIN));
|
||||
len = avcodec_receive_frame(mdecoder->codec_context, decoded_frame);
|
||||
if (len == AVERROR(EAGAIN))
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -677,11 +675,17 @@ static void tsmf_ffmpeg_free(ITSMFDecoder* decoder)
|
||||
|
||||
if (mdecoder->codec_context)
|
||||
{
|
||||
free(mdecoder->codec_context->extradata);
|
||||
mdecoder->codec_context->extradata = NULL;
|
||||
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 69, 100)
|
||||
avcodec_free_context(&mdecoder->codec_context);
|
||||
#else
|
||||
if (mdecoder->prepared)
|
||||
avcodec_close(mdecoder->codec_context);
|
||||
|
||||
free(mdecoder->codec_context->extradata);
|
||||
av_free(mdecoder->codec_context);
|
||||
#endif
|
||||
}
|
||||
|
||||
free(decoder);
|
||||
|
||||
@@ -102,10 +102,10 @@ static void libavcodec_destroy_encoder_context(H264_CONTEXT* WINPR_RESTRICT h264
|
||||
|
||||
if (sys->codecEncoderContext)
|
||||
{
|
||||
avcodec_close(sys->codecEncoderContext);
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 69, 100)
|
||||
avcodec_free_context(&sys->codecEncoderContext);
|
||||
#else
|
||||
avcodec_close(sys->codecEncoderContext);
|
||||
av_free(sys->codecEncoderContext);
|
||||
#endif
|
||||
}
|
||||
@@ -293,15 +293,17 @@ static int libavcodec_decompress(H264_CONTEXT* WINPR_RESTRICT h264,
|
||||
|
||||
sys->videoFrame->format = AV_PIX_FMT_YUV420P;
|
||||
|
||||
do
|
||||
{
|
||||
#ifdef WITH_VAAPI
|
||||
status = avcodec_receive_frame(sys->codecDecoderContext,
|
||||
sys->hwctx ? sys->hwVideoFrame : sys->videoFrame);
|
||||
#else
|
||||
status = avcodec_receive_frame(sys->codecDecoderContext, sys->videoFrame);
|
||||
#endif
|
||||
} while (status == AVERROR(EAGAIN));
|
||||
if (status == AVERROR(EAGAIN))
|
||||
{
|
||||
rc = 0;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
gotFrame = (status == 0);
|
||||
#else
|
||||
@@ -594,10 +596,10 @@ static void libavcodec_uninit(H264_CONTEXT* h264)
|
||||
|
||||
if (sys->codecDecoderContext)
|
||||
{
|
||||
avcodec_close(sys->codecDecoderContext);
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 69, 100)
|
||||
avcodec_free_context(&sys->codecDecoderContext);
|
||||
#else
|
||||
avcodec_close(sys->codecDecoderContext);
|
||||
av_free(sys->codecDecoderContext);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user