[FFmpeg-devel,2/3] lavf/avidec: don't treat I/O errors as EOF

Submitted by Rodger Combs on Nov. 28, 2018, 7:19 a.m.

Details

Message ID 20181128071959.30447-2-rodger.combs@gmail.com
State New
Headers show

Commit Message

Rodger Combs Nov. 28, 2018, 7:19 a.m.
---
 libavformat/avidec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer Nov. 29, 2018, 5:12 p.m.
On Wed, Nov 28, 2018 at 01:19:58AM -0600, Rodger Combs wrote:
> ---
>  libavformat/avidec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/avidec.c b/libavformat/avidec.c
> index 3f074795a7..1d131b299c 100644
> --- a/libavformat/avidec.c
> +++ b/libavformat/avidec.c
> @@ -1383,8 +1383,8 @@ static int ni_prepare_read(AVFormatContext *s)
>      if (i >= 0) {
>          int64_t pos = best_st->index_entries[i].pos;
>          pos += best_ast->packet_size - best_ast->remaining;
> -        if (avio_seek(s->pb, pos + 8, SEEK_SET) < 0)
> -          return AVERROR_EOF;
> +        if ((pos = avio_seek(s->pb, pos + 8, SEEK_SET)) < 0)
> +          return pos;

should be ok if tested with a case that triggers this codepath

thanks

[...]

Patch hide | download patch | download mbox

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 3f074795a7..1d131b299c 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -1383,8 +1383,8 @@  static int ni_prepare_read(AVFormatContext *s)
     if (i >= 0) {
         int64_t pos = best_st->index_entries[i].pos;
         pos += best_ast->packet_size - best_ast->remaining;
-        if (avio_seek(s->pb, pos + 8, SEEK_SET) < 0)
-          return AVERROR_EOF;
+        if ((pos = avio_seek(s->pb, pos + 8, SEEK_SET)) < 0)
+          return pos;
 
         av_assert0(best_ast->remaining <= best_ast->packet_size);