mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-09-19 21:06:42 +00:00
fftools/ffmpeg_mux: return errors from write_packet()
Do not call exit_program(), as that would conflict with moving this code into a separate thread.
This commit is contained in:
parent
279214dd51
commit
9fc64574e1
@ -116,7 +116,7 @@ static int queue_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void write_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt)
|
static int write_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt)
|
||||||
{
|
{
|
||||||
MuxStream *ms = &of->mux->streams[ost->index];
|
MuxStream *ms = &of->mux->streams[ost->index];
|
||||||
AVFormatContext *s = of->mux->fc;
|
AVFormatContext *s = of->mux->fc;
|
||||||
@ -161,10 +161,8 @@ static void write_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt)
|
|||||||
av_log(s, loglevel, "Non-monotonous DTS in output stream "
|
av_log(s, loglevel, "Non-monotonous DTS in output stream "
|
||||||
"%d:%d; previous: %"PRId64", current: %"PRId64"; ",
|
"%d:%d; previous: %"PRId64", current: %"PRId64"; ",
|
||||||
ost->file_index, ost->st->index, ms->last_mux_dts, pkt->dts);
|
ost->file_index, ost->st->index, ms->last_mux_dts, pkt->dts);
|
||||||
if (exit_on_error) {
|
if (exit_on_error)
|
||||||
av_log(NULL, AV_LOG_FATAL, "aborting.\n");
|
return AVERROR(EINVAL);
|
||||||
exit_program(1);
|
|
||||||
}
|
|
||||||
av_log(s, loglevel, "changing to %"PRId64". This may result "
|
av_log(s, loglevel, "changing to %"PRId64". This may result "
|
||||||
"in incorrect timestamps in the output file.\n",
|
"in incorrect timestamps in the output file.\n",
|
||||||
max);
|
max);
|
||||||
@ -197,7 +195,10 @@ static void write_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt)
|
|||||||
print_error("av_interleaved_write_frame()", ret);
|
print_error("av_interleaved_write_frame()", ret);
|
||||||
main_return_code = 1;
|
main_return_code = 1;
|
||||||
close_all_output_streams(ost, MUXER_FINISHED | ENCODER_FINISHED, ENCODER_FINISHED);
|
close_all_output_streams(ost, MUXER_FINISHED | ENCODER_FINISHED, ENCODER_FINISHED);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int submit_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt)
|
static int submit_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt)
|
||||||
@ -221,14 +222,16 @@ static int submit_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt)
|
|||||||
else if (ret < 0)
|
else if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
write_packet(of, output_streams[of->ost_index + ret],
|
ret = write_packet(of, output_streams[of->ost_index + ret],
|
||||||
of->mux->sq_pkt);
|
of->mux->sq_pkt);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (pkt)
|
if (pkt)
|
||||||
write_packet(of, ost, pkt);
|
return write_packet(of, ost, pkt);
|
||||||
else
|
|
||||||
ost->finished |= MUXER_FINISHED;
|
ost->finished |= MUXER_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user