diff mbox

[FFmpeg-devel] libavformat/mov: Replace duplicate stream_nb check by assert

Message ID 20171122120434.14250-1-michael@niedermayer.cc
State Accepted
Commit 883de7e8b4fee252464b15e0351c6e5733e36e54
Headers show

Commit Message

Michael Niedermayer Nov. 22, 2017, 12:04 p.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/mov.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Derek Buitenhuis Nov. 22, 2017, 2:09 p.m. UTC | #1
On 11/22/2017 12:04 PM, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/mov.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

If it's a duplicate check, is there even a gain from using an assert?

- Derek
Michael Niedermayer Nov. 22, 2017, 8:09 p.m. UTC | #2
On Wed, Nov 22, 2017 at 02:09:46PM +0000, Derek Buitenhuis wrote:
> On 11/22/2017 12:04 PM, Michael Niedermayer wrote:
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavformat/mov.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> If it's a duplicate check, is there even a gain from using an assert?

not much, no
its a non static function tough
i can remove the check completely if thats preferred ?
Derek Buitenhuis Nov. 22, 2017, 8:19 p.m. UTC | #3
On 11/22/2017 8:09 PM, Michael Niedermayer wrote:
> not much, no
> its a non static function tough
> i can remove the check completely if thats preferred ?

I guess leave it since it's non-static.

LGTM.

- Derek
Michael Niedermayer Nov. 26, 2017, 11:51 p.m. UTC | #4
On Wed, Nov 22, 2017 at 08:19:45PM +0000, Derek Buitenhuis wrote:
> On 11/22/2017 8:09 PM, Michael Niedermayer wrote:
> > not much, no
> > its a non static function tough
> > i can remove the check completely if thats preferred ?
> 
> I guess leave it since it's non-static.
> 
> LGTM.

ok, will apply

thx

[...]
diff mbox

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 9e876efc8c..6940dfc7d5 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2437,8 +2437,7 @@  int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
     MOVStreamContext *sc;
     int pseudo_stream_id;
 
-    if (c->fc->nb_streams < 1)
-        return 0;
+    av_assert0 (c->fc->nb_streams >= 1);
     st = c->fc->streams[c->fc->nb_streams-1];
     sc = st->priv_data;