mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-10-30 12:06:40 +08:00
fftools/ffmpeg_mux: return errors from of_output_packet() instead of aborting
This commit is contained in:
@@ -330,7 +330,7 @@ static int submit_packet(Muxer *mux, AVPacket *pkt, OutputStream *ost)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void of_output_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt)
|
||||
int of_output_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt)
|
||||
{
|
||||
Muxer *mux = mux_from_of(of);
|
||||
MuxStream *ms = ms_from_ost(ost);
|
||||
@@ -359,7 +359,7 @@ void of_output_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt)
|
||||
while (!bsf_eof) {
|
||||
ret = av_bsf_receive_packet(ms->bsf_ctx, ms->bsf_pkt);
|
||||
if (ret == AVERROR(EAGAIN))
|
||||
return;
|
||||
return 0;
|
||||
else if (ret == AVERROR_EOF)
|
||||
bsf_eof = 1;
|
||||
else if (ret < 0) {
|
||||
@@ -377,16 +377,14 @@ void of_output_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt)
|
||||
goto mux_fail;
|
||||
}
|
||||
|
||||
return;
|
||||
return 0;
|
||||
|
||||
mux_fail:
|
||||
err_msg = "submitting a packet to the muxer";
|
||||
|
||||
fail:
|
||||
av_log(ost, AV_LOG_ERROR, "Error %s\n", err_msg);
|
||||
if (exit_on_error)
|
||||
exit_program(1);
|
||||
|
||||
return exit_on_error ? ret : 0;
|
||||
}
|
||||
|
||||
int of_streamcopy(OutputStream *ost, const AVPacket *pkt, int64_t dts)
|
||||
@@ -405,10 +403,8 @@ int of_streamcopy(OutputStream *ost, const AVPacket *pkt, int64_t dts)
|
||||
pkt = NULL;
|
||||
|
||||
// EOF: flush output bitstream filters.
|
||||
if (!pkt) {
|
||||
of_output_packet(of, ost, NULL);
|
||||
return 0;
|
||||
}
|
||||
if (!pkt)
|
||||
return of_output_packet(of, ost, NULL);
|
||||
|
||||
if (!ms->streamcopy_started && !(pkt->flags & AV_PKT_FLAG_KEY) &&
|
||||
!ms->copy_initial_nonkeyframes)
|
||||
@@ -461,7 +457,9 @@ int of_streamcopy(OutputStream *ost, const AVPacket *pkt, int64_t dts)
|
||||
}
|
||||
}
|
||||
|
||||
of_output_packet(of, ost, opkt);
|
||||
ret = of_output_packet(of, ost, opkt);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ms->streamcopy_started = 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user