[FFmpeg-devel] [PATCH] avformat/aviobuf: realloc memory in ffio_ensure_seekback()
Michael Niedermayer
michael at niedermayer.cc
Wed Sep 16 21:02:48 EEST 2020
On Tue, Sep 15, 2020 at 01:35:25PM +0200, Paul B Mahol wrote:
> This removes big CPU overhead for demuxing chained ogg streams.
>
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
> libavformat/aviobuf.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
> index a77517d712..6d01150f66 100644
> --- a/libavformat/aviobuf.c
> +++ b/libavformat/aviobuf.c
> @@ -1005,12 +1005,11 @@ int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
> return 0;
> av_assert0(!s->write_flag);
>
> - buffer = av_malloc(buf_size);
> + buffer = s->buffer;
> + buffer = av_realloc(buffer, buf_size);
> if (!buffer)
> return AVERROR(ENOMEM);
This would reduce the guranteed alignment.
If that is not an issue then this patch could be ok
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200916/37b0b3e5/attachment.sig>
More information about the ffmpeg-devel
mailing list