avformat/mux: Call check_packet() more directly

Call it directly from write_packets_common() instead of indirectly
through prepare_input_packet().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2020-05-16 02:04:34 +02:00
parent 39195896f3
commit 718f05f5e5

View File

@ -759,16 +759,8 @@ static int check_packet(AVFormatContext *s, AVPacket *pkt)
return 0;
}
static int prepare_input_packet(AVFormatContext *s, AVPacket *pkt)
static int prepare_input_packet(AVFormatContext *s, AVStream *st, AVPacket *pkt)
{
AVStream *st;
int ret;
ret = check_packet(s, pkt);
if (ret < 0)
return ret;
st = s->streams[pkt->stream_index];
#if !FF_API_COMPUTE_PKT_FIELDS2 || !FF_API_LAVF_AVCTX
/* sanitize the timestamps */
if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
@ -1178,11 +1170,15 @@ static int write_packets_from_bsfs(AVFormatContext *s, AVStream *st, AVPacket *p
static int write_packets_common(AVFormatContext *s, AVPacket *pkt, int interleaved)
{
AVStream *st;
int ret = prepare_input_packet(s, pkt);
int ret = check_packet(s, pkt);
if (ret < 0)
return ret;
st = s->streams[pkt->stream_index];
ret = prepare_input_packet(s, st, pkt);
if (ret < 0)
return ret;
ret = check_bitstream(s, st, pkt);
if (ret < 0)
return ret;