mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-23 04:24:35 +02:00
ffmpeg; check return code of avcodec_send_frame when flushing encoders
Fixes Coverity CID 1404841. Signed-off-by: Marton Balint <cus@passwd.hu> (cherry picked from commit c037f2f1ba3a2d3114575323550f456e66695edf)
This commit is contained in:
parent
1968a1eef1
commit
ed2ed4ac0f
14
ffmpeg.c
14
ffmpeg.c
@ -1904,8 +1904,6 @@ static void flush_encoders(void)
|
|||||||
if (enc->codec_type != AVMEDIA_TYPE_VIDEO && enc->codec_type != AVMEDIA_TYPE_AUDIO)
|
if (enc->codec_type != AVMEDIA_TYPE_VIDEO && enc->codec_type != AVMEDIA_TYPE_AUDIO)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
avcodec_send_frame(enc, NULL);
|
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
const char *desc = NULL;
|
const char *desc = NULL;
|
||||||
AVPacket pkt;
|
AVPacket pkt;
|
||||||
@ -1927,7 +1925,17 @@ static void flush_encoders(void)
|
|||||||
pkt.size = 0;
|
pkt.size = 0;
|
||||||
|
|
||||||
update_benchmark(NULL);
|
update_benchmark(NULL);
|
||||||
ret = avcodec_receive_packet(enc, &pkt);
|
|
||||||
|
while ((ret = avcodec_receive_packet(enc, &pkt)) == AVERROR(EAGAIN)) {
|
||||||
|
ret = avcodec_send_frame(enc, NULL);
|
||||||
|
if (ret < 0) {
|
||||||
|
av_log(NULL, AV_LOG_FATAL, "%s encoding failed: %s\n",
|
||||||
|
desc,
|
||||||
|
av_err2str(ret));
|
||||||
|
exit_program(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
update_benchmark("flush_%s %d.%d", desc, ost->file_index, ost->index);
|
update_benchmark("flush_%s %d.%d", desc, ost->file_index, ost->index);
|
||||||
if (ret < 0 && ret != AVERROR_EOF) {
|
if (ret < 0 && ret != AVERROR_EOF) {
|
||||||
av_log(NULL, AV_LOG_FATAL, "%s encoding failed: %s\n",
|
av_log(NULL, AV_LOG_FATAL, "%s encoding failed: %s\n",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user