[FFmpeg-cvslog] avformat/utils: Remove redundant save+restore
Andreas Rheinhardt
git at videolan.org
Thu Jan 9 00:53:26 EET 2020
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Tue Oct 8 07:41:15 2019 +0200| [94cdf82d53fe9be260dc6106634a9f9b218211bd] | committer: Michael Niedermayer
avformat/utils: Remove redundant save+restore
If the size of the input packet is zero, av_grow_packet() used to call
av_new_packet() which would initialize the packet and (in particular)
reset the pos field. This behaviour (which was never documented and
arguably always contradicted the documented behaviour) was changed in
2fe04630. This means that it is unnecessary to save and restore the
packet's position in append_packet_chunked().
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=94cdf82d53fe9be260dc6106634a9f9b218211bd
---
libavformat/utils.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 2470a6ac0e..f3d71642c3 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -268,7 +268,6 @@ int ffio_limit(AVIOContext *s, int size)
* Return the number of bytes read or an error. */
static int append_packet_chunked(AVIOContext *s, AVPacket *pkt, int size)
{
- int64_t orig_pos = pkt->pos; // av_grow_packet might reset pos
int orig_size = pkt->size;
int ret;
@@ -301,7 +300,6 @@ static int append_packet_chunked(AVIOContext *s, AVPacket *pkt, int size)
if (size > 0)
pkt->flags |= AV_PKT_FLAG_CORRUPT;
- pkt->pos = orig_pos;
if (!pkt->size)
av_packet_unref(pkt);
return pkt->size > orig_size ? pkt->size - orig_size : ret;
More information about the ffmpeg-cvslog
mailing list