avformat/flacdec: Fix seeking close to EOF
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 22 Jun 2016 18:33:09 +0000 (20:33 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 22 Jun 2016 19:10:37 +0000 (21:10 +0200)
Fixes Ticket5428

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/flacdec.c

index 19f1062..3060dc4 100644 (file)
@@ -259,8 +259,10 @@ static av_unused int64_t flac_read_timestamp(AVFormatContext *s, int stream_inde
         if (ret < 0){
             if (ret == AVERROR(EAGAIN))
                 continue;
-            else
-                break;
+            else {
+                av_packet_unref(&pkt);
+                av_assert1(!pkt.size);
+            }
         }
         av_init_packet(&out_pkt);
         av_parser_parse2(parser, st->internal->avctx,
@@ -277,7 +279,8 @@ static av_unused int64_t flac_read_timestamp(AVFormatContext *s, int stream_inde
                 pts = parser->pts;
                 break;
             }
-        }
+        } else if (ret < 0)
+            break;
     }
     av_parser_close(parser);
     return pts;