diff mbox

[FFmpeg-devel] libavformat/mov:the "stco" box parse no need return eof.

Message ID 1512026327-21890-1-git-send-email-tiejun.peng@foxmail.com
State New
Headers show

Commit Message

tiejun.peng Nov. 30, 2017, 7:18 a.m. UTC
discard corrupted track and good track have chance to play.

Signed-off-by: tiejun.peng <tiejun.peng@foxmail.com>
---
 libavformat/mov.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer Nov. 30, 2017, 5:22 p.m. UTC | #1
On Thu, Nov 30, 2017 at 03:18:47PM +0800, tiejun.peng wrote:
> discard corrupted track and good track have chance to play.
> 
> Signed-off-by: tiejun.peng <tiejun.peng@foxmail.com>
> ---
>  libavformat/mov.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index c901859..5c2ce39 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -1991,8 +1991,10 @@ static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>  
>      sc->chunk_count = i;
>  
> -    if (pb->eof_reached)
> -        return AVERROR_EOF;
> +    if (i < entries) {
> +        av_log(c->fc, AV_LOG_WARNING, "stream id[0x%x]: corrupted STCO atom\n", st->id);
> +        st->discard = AVDISCARD_ALL;

why do you need AVDISCARD_ALL ?
st->discard is set by the user so the user can change this


[...]
diff mbox

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index c901859..5c2ce39 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1991,8 +1991,10 @@  static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
     sc->chunk_count = i;
 
-    if (pb->eof_reached)
-        return AVERROR_EOF;
+    if (i < entries) {
+        av_log(c->fc, AV_LOG_WARNING, "stream id[0x%x]: corrupted STCO atom\n", st->id);
+        st->discard = AVDISCARD_ALL;
+    }
 
     return 0;
 }