[FFmpeg-devel] [PATCH 3/3] libavformat/aviobuf: don't treat 0 as EOF

Michael Niedermayer michael at niedermayer.cc
Sat Jun 10 04:58:10 EEST 2017


On Fri, Jun 09, 2017 at 03:49:03PM +0200, Daniel Kucera wrote:
> Signed-off-by: Daniel Kucera <daniel.kucera at gmail.com>
> ---
>  libavformat/aviobuf.c | 20 ++++++++++++--------
>  1 file changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
> index 1667e9f08b..3705e406d9 100644
> --- a/libavformat/aviobuf.c
> +++ b/libavformat/aviobuf.c
> @@ -556,13 +556,14 @@ static void fill_buffer(AVIOContext *s)
>      if (s->read_packet)
>          len = s->read_packet(s->opaque, dst, len);
>      else
> -        len = 0;
> -    if (len <= 0) {
> +        len = AVERROR_EOF;
> +    if (len == AVERROR_EOF) {
>          /* do not modify buffer if EOF reached so that a seek back can
>             be done without rereading data */
>          s->eof_reached = 1;
> -        if (len < 0)
> -            s->error = len;
> +    } else if (len < 0) {
> +        s->eof_reached = 1;
> +        s->error= len;
>      } else {
>          s->pos += len;
>          s->buf_ptr = dst;
> @@ -630,13 +631,16 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size)
>                  // bypass the buffer and read data directly into buf
>                  if(s->read_packet)
>                      len = s->read_packet(s->opaque, buf, size);
> -
> -                if (len <= 0) {
> +		else

tabs are forbidden in ffmpeg git
also either this or the next patch cause fate to infinite-loop
(that is without any other patches)
if theres a dependance on the other patches please add a note about
that.

and are any changes needed in libavdevice ?
if so the ABI between them may add some more headaches

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170610/4931c7eb/attachment.sig>


More information about the ffmpeg-devel mailing list