[FFmpeg-devel] [PATCH 2/2] avformat/aviobuf: prefer to use avio_read_partial()

Marton Balint cus at passwd.hu
Fri Dec 3 11:47:00 EET 2021



On Fri, 3 Dec 2021, lance.lmwang at gmail.com wrote:

> From: Limin Wang <lance.lmwang at gmail.com>
>
> This is allowed to read fewer bytes than requested. The missing bytes can
> be read in the next call.

I don't think this is needed, after all we want to read all data, there is 
no point in reading it in smaller chunks, no?

Thanks,
Marton

>
> Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> ---
> libavformat/aviobuf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
> index 14688a2..ebb86e5 100644
> --- a/libavformat/aviobuf.c
> +++ b/libavformat/aviobuf.c
> @@ -1317,7 +1317,7 @@ int avio_read_to_bprint(AVIOContext *h, AVBPrint *pb, size_t max_size)
>     int ret;
>     char buf[1024];
>     while (max_size) {
> -        ret = avio_read(h, buf, FFMIN(max_size, sizeof(buf)));
> +        ret = avio_read_partial(h, buf, FFMIN(max_size, sizeof(buf)));
>         if (ret == AVERROR_EOF)
>             return 0;
>         if (ret <= 0)
> -- 
> 1.8.3.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-devel mailing list