mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-28 20:53:54 +02:00
fftools/ffmpeg_mux: return errors from of_streamcopy() instead of aborting
This commit is contained in:
parent
464a5e8e76
commit
2e742a2c3c
@ -839,7 +839,9 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo
|
||||
continue;
|
||||
}
|
||||
|
||||
of_streamcopy(ost, pkt, dts_est);
|
||||
ret = of_streamcopy(ost, pkt, dts_est);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return !eof_reached;
|
||||
|
@ -826,7 +826,7 @@ void of_output_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt);
|
||||
/**
|
||||
* @param dts predicted packet dts in AV_TIME_BASE_Q
|
||||
*/
|
||||
void of_streamcopy(OutputStream *ost, const AVPacket *pkt, int64_t dts);
|
||||
int of_streamcopy(OutputStream *ost, const AVPacket *pkt, int64_t dts);
|
||||
|
||||
int64_t of_filesize(OutputFile *of);
|
||||
|
||||
|
@ -389,13 +389,14 @@ fail:
|
||||
|
||||
}
|
||||
|
||||
void of_streamcopy(OutputStream *ost, const AVPacket *pkt, int64_t dts)
|
||||
int of_streamcopy(OutputStream *ost, const AVPacket *pkt, int64_t dts)
|
||||
{
|
||||
OutputFile *of = output_files[ost->file_index];
|
||||
MuxStream *ms = ms_from_ost(ost);
|
||||
int64_t start_time = (of->start_time == AV_NOPTS_VALUE) ? 0 : of->start_time;
|
||||
int64_t ost_tb_start_time = av_rescale_q(start_time, AV_TIME_BASE_Q, ost->mux_timebase);
|
||||
AVPacket *opkt = ms->pkt;
|
||||
int ret;
|
||||
|
||||
av_packet_unref(opkt);
|
||||
|
||||
@ -406,26 +407,27 @@ void of_streamcopy(OutputStream *ost, const AVPacket *pkt, int64_t dts)
|
||||
// EOF: flush output bitstream filters.
|
||||
if (!pkt) {
|
||||
of_output_packet(of, ost, NULL);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!ms->streamcopy_started && !(pkt->flags & AV_PKT_FLAG_KEY) &&
|
||||
!ms->copy_initial_nonkeyframes)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
if (!ms->streamcopy_started) {
|
||||
if (!ms->copy_prior_start &&
|
||||
(pkt->pts == AV_NOPTS_VALUE ?
|
||||
dts < ms->ts_copy_start :
|
||||
pkt->pts < av_rescale_q(ms->ts_copy_start, AV_TIME_BASE_Q, pkt->time_base)))
|
||||
return;
|
||||
return 0;
|
||||
|
||||
if (of->start_time != AV_NOPTS_VALUE && dts < of->start_time)
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (av_packet_ref(opkt, pkt) < 0)
|
||||
exit_program(1);
|
||||
ret = av_packet_ref(opkt, pkt);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
opkt->time_base = ost->mux_timebase;
|
||||
|
||||
@ -455,13 +457,15 @@ void of_streamcopy(OutputStream *ost, const AVPacket *pkt, int64_t dts)
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Subtitle heartbeat logic failed in %s! (%s)\n",
|
||||
__func__, av_err2str(ret));
|
||||
exit_program(1);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
of_output_packet(of, ost, opkt);
|
||||
|
||||
ms->streamcopy_started = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int thread_stop(Muxer *mux)
|
||||
|
Loading…
Reference in New Issue
Block a user