diff mbox

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

Message ID 1511100029-7447-1-git-send-email-tiejun.peng@foxmail.com
State Superseded
Headers show

Commit Message

tiejun.peng Nov. 19, 2017, 2 p.m. UTC
if return eof, will cause to play the whole mp4 file fail.
For example, currently the whole file will play fail
when a few bytes missed in the "stco" box
and the "stco" box is the last box of MP4 file,
Actually the almost media frames can play success at most time.
A few words missed in "stco" box and the other box data is full
will not cause the whole mp4 file fail.

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

Comments

Michael Niedermayer Nov. 20, 2017, 1:15 a.m. UTC | #1
On Sun, Nov 19, 2017 at 10:00:29PM +0800, tiejun.peng wrote:
> if return eof, will cause to play the whole mp4 file fail.
> For example, currently the whole file will play fail
> when a few bytes missed in the "stco" box
> and the "stco" box is the last box of MP4 file,
> Actually the almost media frames can play success at most time.
> A few words missed in "stco" box and the other box data is full
> will not cause the whole mp4 file fail.
> 
> Signed-off-by: tiejun.peng <tiejun.peng@foxmail.com>
> ---
>  libavformat/mov.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 5c9f926..78b7bf7 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -1989,9 +1989,6 @@ static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>  
>      sc->chunk_count = i;
>  
> -    if (pb->eof_reached)
> -        return AVERROR_EOF;

The code should not silently accept a truncated stco as undamaged.
That way the user would have no way to know that the file is truncated

[...]
diff mbox

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 5c9f926..78b7bf7 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1989,9 +1989,6 @@  static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
     sc->chunk_count = i;
 
-    if (pb->eof_reached)
-        return AVERROR_EOF;
-
     return 0;
 }