[vlc-commits] modules: clean check of date_Get() return value

Steve Lhomme git at videolan.org
Wed May 2 18:42:16 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed May  2 17:11:24 2018 +0200| [7be01abad195a678357ef9b183671872d857b6a5] | committer: Steve Lhomme

modules: clean check of date_Get() return value

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7be01abad195a678357ef9b183671872d857b6a5
---

 modules/codec/audiotoolbox_midi.c | 3 ++-
 modules/codec/avcodec/audio.c     | 3 ++-
 modules/codec/avcodec/video.c     | 4 ++--
 modules/codec/dmo/dmo.c           | 2 +-
 modules/codec/lpcm.c              | 2 +-
 modules/codec/mpg123.c            | 3 ++-
 modules/codec/omxil/mediacodec.c  | 2 +-
 modules/codec/omxil/omxil.c       | 2 +-
 modules/codec/opus.c              | 2 +-
 modules/codec/rawvideo.c          | 2 +-
 modules/codec/speex.c             | 4 ++--
 modules/codec/uleaddvaudio.c      | 2 +-
 modules/codec/vorbis.c            | 2 +-
 modules/codec/wmafixed/wma.c      | 2 +-
 modules/packetizer/dts.c          | 3 ++-
 modules/packetizer/mlp.c          | 3 ++-
 modules/packetizer/mpeg4audio.c   | 3 ++-
 modules/packetizer/mpegaudio.c    | 3 ++-
 18 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/modules/codec/audiotoolbox_midi.c b/modules/codec/audiotoolbox_midi.c
index 70b92955dc..da64a206d5 100644
--- a/modules/codec/audiotoolbox_midi.c
+++ b/modules/codec/audiotoolbox_midi.c
@@ -336,7 +336,8 @@ static int DecodeBlock (decoder_t *p_dec, block_t *p_block)
         }
     }
 
-    if (p_block->i_pts != VLC_TS_INVALID && !date_Get(&p_sys->end_date)) {
+    if ( p_block->i_pts != VLC_TS_INVALID &&
+         date_Get(&p_sys->end_date) == VLC_TS_INVALID ) {
         date_Set(&p_sys->end_date, p_block->i_pts);
     } else if (p_block->i_pts < date_Get(&p_sys->end_date)) {
         msg_Warn(p_dec, "MIDI message in the past?");
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index a8588fc0fe..6d04f85925 100644
--- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c
@@ -336,7 +336,8 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
         }
 
         /* We've just started the stream, wait for the first PTS. */
-        if( !date_Get( &p_sys->end_date ) && p_block->i_pts == VLC_TS_INVALID )
+        if( p_block->i_pts == VLC_TS_INVALID &&
+            date_Get( &p_sys->end_date ) == VLC_TS_INVALID )
             goto drop;
 
         if( p_block->i_buffer <= 0 )
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index c22162cf3b..4a06444387 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -744,8 +744,8 @@ static void interpolate_next_pts( decoder_t *p_dec, AVFrame *frame )
     decoder_sys_t *p_sys = p_dec->p_sys;
     AVCodecContext *p_context = p_sys->p_context;
 
-    if( date_Get( &p_sys->pts ) == VLC_TS_INVALID ||
-        p_sys->pts.i_divider_num == 0 )
+    if( p_sys->pts.i_divider_num == 0 ||
+        date_Get( &p_sys->pts ) == VLC_TS_INVALID )
         return;
 
     int i_tick = p_context->ticks_per_frame;
diff --git a/modules/codec/dmo/dmo.c b/modules/codec/dmo/dmo.c
index 5eff91b331..eee30a1ed8 100644
--- a/modules/codec/dmo/dmo.c
+++ b/modules/codec/dmo/dmo.c
@@ -848,7 +848,7 @@ static int DecBlock( decoder_t *p_dec, block_t **pp_block )
     }
 
 #if 0 /* Breaks the video decoding */
-    if( !date_Get( &p_sys->end_date ) )
+    if( date_Get( &p_sys->end_date ) == VLC_TS_INVALID )
     {
         /* We've just started the stream, wait for the first PTS. */
         if( p_block ) block_Release( p_block );
diff --git a/modules/codec/lpcm.c b/modules/codec/lpcm.c
index 6fb6e47ba7..f6b394a157 100644
--- a/modules/codec/lpcm.c
+++ b/modules/codec/lpcm.c
@@ -355,7 +355,7 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
         date_Set( &p_sys->end_date, p_block->i_pts );
     }
 
-    if( !date_Get( &p_sys->end_date ) )
+    if( date_Get( &p_sys->end_date ) == VLC_TS_INVALID )
     {
         /* We've just started the stream, wait for the first PTS. */
         block_Release( p_block );
diff --git a/modules/codec/mpg123.c b/modules/codec/mpg123.c
index 6a564eff06..d85098abb4 100644
--- a/modules/codec/mpg123.c
+++ b/modules/codec/mpg123.c
@@ -227,7 +227,8 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
             }
         }
 
-        if( !date_Get( &p_sys->end_date ) && i_pts == VLC_TS_INVALID )
+        if( i_pts == VLC_TS_INVALID &&
+            date_Get( &p_sys->end_date ) == VLC_TS_INVALID )
         {
             /* We've just started the stream, wait for the first PTS. */
             msg_Dbg( p_dec, "waiting for PTS" );
diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c
index b3a1648825..c6abedb665 100644
--- a/modules/codec/omxil/mediacodec.c
+++ b/modules/codec/omxil/mediacodec.c
@@ -1676,7 +1676,7 @@ static int Audio_OnNewBlock(decoder_t *p_dec, block_t **pp_block)
     block_t *p_block = *pp_block;
 
     /* We've just started the stream, wait for the first PTS. */
-    if (!date_Get(&p_sys->audio.i_end_date))
+    if (date_Get(&p_sys->audio.i_end_date) == VLC_TS_INVALID)
     {
         if (p_block->i_pts == VLC_TS_INVALID)
             return 0;
diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index 1658633888..d9d9f5a98b 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -1500,7 +1500,7 @@ int DecodeAudio ( decoder_t *p_dec, block_t *p_block )
         return VLCDEC_SUCCESS;
     }
 
-    if( !date_Get( &p_sys->end_date ) )
+    if( date_Get( &p_sys->end_date ) == VLC_TS_INVALID )
     {
         if( !p_block->i_pts )
         {
diff --git a/modules/codec/opus.c b/modules/codec/opus.c
index cee36f1a7f..ae55db5c73 100644
--- a/modules/codec/opus.c
+++ b/modules/codec/opus.c
@@ -414,7 +414,7 @@ static block_t *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
         date_Set( &p_sys->end_date, p_block->i_pts );
     }
 
-    if( !date_Get( &p_sys->end_date ) )
+    if( date_Get( &p_sys->end_date ) == VLC_TS_INVALID )
     {
         /* We've just started the stream, wait for the first PTS. */
         block_Release( p_block );
diff --git a/modules/codec/rawvideo.c b/modules/codec/rawvideo.c
index 41d8e2813b..fe77a20eee 100644
--- a/modules/codec/rawvideo.c
+++ b/modules/codec/rawvideo.c
@@ -160,7 +160,7 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t *p_block )
     }
 
     if( p_block->i_pts == VLC_TS_INVALID && p_block->i_dts == VLC_TS_INVALID &&
-        !date_Get( &p_sys->pts ) )
+        date_Get( &p_sys->pts ) == VLC_TS_INVALID )
     {
         /* We've just started the stream, wait for the first PTS. */
         block_Release( p_block );
diff --git a/modules/codec/speex.c b/modules/codec/speex.c
index 10620eec6b..893e878caf 100644
--- a/modules/codec/speex.c
+++ b/modules/codec/speex.c
@@ -584,7 +584,7 @@ static block_t *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
         date_Set( &p_sys->end_date, p_block->i_pts );
     }
 
-    if( !date_Get( &p_sys->end_date ) )
+    if( date_Get( &p_sys->end_date ) == VLC_TS_INVALID )
     {
         /* We've just started the stream, wait for the first PTS. */
         if( p_block ) block_Release( p_block );
@@ -745,7 +745,7 @@ static int DecodeRtpSpeexPacket( decoder_t *p_dec, block_t *p_speex_bit_block )
         return VLCDEC_SUCCESS;
     }
 
-    if ( !date_Get( &p_sys->end_date ) )
+    if ( date_Get( &p_sys->end_date ) == VLC_TS_INVALID )
         date_Set( &p_sys->end_date, p_speex_bit_block->i_dts );
 
     /*
diff --git a/modules/codec/uleaddvaudio.c b/modules/codec/uleaddvaudio.c
index e795fc1015..ac73ce3e31 100644
--- a/modules/codec/uleaddvaudio.c
+++ b/modules/codec/uleaddvaudio.c
@@ -82,7 +82,7 @@ static block_t *DecodeBlock(decoder_t *dec, block_t **block_ptr)
         block->i_pts != date_Get(&sys->end_date))
         date_Set(&sys->end_date, block->i_pts);
     block->i_pts = VLC_TS_INVALID;
-    if (!date_Get(&sys->end_date)) {
+    if (date_Get(&sys->end_date) == VLC_TS_INVALID) {
         /* We've just started the stream, wait for the first PTS. */
         block_Release(block);
         return NULL;
diff --git a/modules/codec/vorbis.c b/modules/codec/vorbis.c
index dc1e558254..06b97d0d6d 100644
--- a/modules/codec/vorbis.c
+++ b/modules/codec/vorbis.c
@@ -488,7 +488,7 @@ static block_t *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
         date_Set( &p_sys->end_date, p_block->i_pts );
     }
 
-    if( !date_Get( &p_sys->end_date ) )
+    if( date_Get( &p_sys->end_date ) == VLC_TS_INVALID )
     {
         /* We've just started the stream, wait for the first PTS. */
         if( p_block ) block_Release( p_block );
diff --git a/modules/codec/wmafixed/wma.c b/modules/codec/wmafixed/wma.c
index f37df72409..41a30e3fa1 100644
--- a/modules/codec/wmafixed/wma.c
+++ b/modules/codec/wmafixed/wma.c
@@ -229,7 +229,7 @@ static int DecodeFrame( decoder_t *p_dec, block_t *p_block )
         /* don't reuse the same pts */
         p_block->i_pts = VLC_TS_INVALID;
     }
-    else if( !date_Get( &p_sys->end_date ) )
+    else if( date_Get( &p_sys->end_date ) == VLC_TS_INVALID )
     {
         /* We've just started the stream, wait for the first PTS. */
         block_Release( p_block );
diff --git a/modules/packetizer/dts.c b/modules/packetizer/dts.c
index c9ea7e7be5..ddb0a0e919 100644
--- a/modules/packetizer/dts.c
+++ b/modules/packetizer/dts.c
@@ -144,7 +144,8 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
             }
         }
 
-        if ( !date_Get( &p_sys->end_date ) && p_block->i_pts == VLC_TS_INVALID ) {
+        if ( p_block->i_pts == VLC_TS_INVALID &&
+             date_Get( &p_sys->end_date ) == VLC_TS_INVALID ) {
             /* We've just started the stream, wait for the first PTS. */
             block_Release( p_block );
             return NULL;
diff --git a/modules/packetizer/mlp.c b/modules/packetizer/mlp.c
index da205decf9..00441636b5 100644
--- a/modules/packetizer/mlp.c
+++ b/modules/packetizer/mlp.c
@@ -289,7 +289,8 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
             }
         }
 
-        if( !date_Get( &p_sys->end_date ) && p_block->i_pts == VLC_TS_INVALID )
+        if( p_block->i_pts == VLC_TS_INVALID &&
+            date_Get( &p_sys->end_date ) == VLC_TS_INVALID )
         {
             /* We've just started the stream, wait for the first PTS. */
             msg_Dbg( p_dec, "waiting for PTS" );
diff --git a/modules/packetizer/mpeg4audio.c b/modules/packetizer/mpeg4audio.c
index 3c4cb92cf7..ca909333eb 100644
--- a/modules/packetizer/mpeg4audio.c
+++ b/modules/packetizer/mpeg4audio.c
@@ -1238,7 +1238,8 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
             }
         }
 
-        if (!date_Get(&p_sys->end_date) && p_block->i_pts == VLC_TS_INVALID)
+        if ( p_block->i_pts == VLC_TS_INVALID &&
+             date_Get(&p_sys->end_date) == VLC_TS_INVALID )
         {
             /* We've just started the stream, wait for the first PTS. */
             block_Release(p_block);
diff --git a/modules/packetizer/mpegaudio.c b/modules/packetizer/mpegaudio.c
index 34b6d9b42f..acbf674676 100644
--- a/modules/packetizer/mpegaudio.c
+++ b/modules/packetizer/mpegaudio.c
@@ -309,7 +309,8 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
             }
         }
 
-        if( !date_Get( &p_sys->end_date ) && p_block->i_pts == VLC_TS_INVALID )
+        if( p_block->i_pts == VLC_TS_INVALID &&
+            date_Get( &p_sys->end_date ) == VLC_TS_INVALID )
         {
             /* We've just started the stream, wait for the first PTS. */
             msg_Dbg( p_dec, "waiting for PTS" );



More information about the vlc-commits mailing list