[FFmpeg-devel] [PATCH 28/36] avcodec/mjpega_dump_header_bsf: Miscellaneous improvements
Andreas Rheinhardt
andreas.rheinhardt at gmail.com
Sat May 30 19:05:33 EEST 2020
1. Instead of comparing two values read via AV_RL32 one can read both
via AV_RN32 and compare the values.
2. Errors like AVERROR(ENOMEM) from failed allocations are now always
forwarded.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
libavcodec/mjpega_dump_header_bsf.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libavcodec/mjpega_dump_header_bsf.c b/libavcodec/mjpega_dump_header_bsf.c
index 4ea55e88ba..98fd2f9250 100644
--- a/libavcodec/mjpega_dump_header_bsf.c
+++ b/libavcodec/mjpega_dump_header_bsf.c
@@ -77,7 +77,7 @@ static int mjpega_dump_header(AVBSFContext *ctx, AVPacket *pkt)
return 0;
}
case APP1:
- if (i + 12U <= pkt->size && AV_RL32(pkt->data + i + 8) == AV_RL32("mjpg")) {
+ if (i + 12U <= pkt->size && AV_RN32(pkt->data + i + 8) == AV_RN32("mjpg")) {
av_log(ctx, AV_LOG_ERROR, "bitstream already formatted\n");
return 0;
}
@@ -85,9 +85,10 @@ static int mjpega_dump_header(AVBSFContext *ctx, AVPacket *pkt)
}
}
av_log(ctx, AV_LOG_ERROR, "No valid SOS marker in bitstream\n");
+ ret = AVERROR_INVALIDDATA;
fail:
av_packet_unref(pkt);
- return AVERROR_INVALIDDATA;
+ return ret;
}
static const enum AVCodecID codec_ids[] = {
--
2.20.1
More information about the ffmpeg-devel
mailing list