[vlc-commits] opus: fix duration signedness

Francois Cartegnie git at videolan.org
Thu Mar 19 18:37:20 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Mar 18 17:51:01 2015 +0100| [91b66e27391a81116552120362f03712b4cac220] | committer: Francois Cartegnie

opus: fix duration signedness

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

 modules/demux/ogg.c  |    8 ++++----
 modules/demux/opus.h |   12 ++++++------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index 8326b4e..f23bfdd 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -123,7 +123,7 @@ static int  Control( demux_t *, int, va_list );
 static int  Ogg_ReadPage     ( demux_t *, ogg_page * );
 static void Ogg_UpdatePCR    ( demux_t *, logical_stream_t *, ogg_packet * );
 static void Ogg_DecodePacket ( demux_t *, logical_stream_t *, ogg_packet * );
-static int  Ogg_OpusPacketDuration( ogg_packet * );
+static unsigned Ogg_OpusPacketDuration( ogg_packet * );
 static void Ogg_SendOrQueueBlocks( demux_t *, logical_stream_t *, block_t * );
 
 static void Ogg_CreateES( demux_t *p_demux );
@@ -990,7 +990,7 @@ static void Ogg_UpdatePCR( demux_t *p_demux, logical_stream_t *p_stream,
 
             if( p_stream->fmt.i_codec == VLC_CODEC_OPUS && p_oggpacket->e_o_s )
             {
-                int duration = Ogg_OpusPacketDuration( p_oggpacket );
+                unsigned duration = Ogg_OpusPacketDuration( p_oggpacket );
                 if( duration > 0 )
                 {
                     ogg_int64_t end_sample = p_oggpacket->granulepos;
@@ -1011,7 +1011,7 @@ static void Ogg_UpdatePCR( demux_t *p_demux, logical_stream_t *p_stream,
     }
     else if ( p_oggpacket->granulepos == -1 )
     {
-        int i_duration;
+        unsigned i_duration;
         /* no granulepos available, try to interpolate the pcr.
          * If we can't then don't touch the old value. */
         if( p_stream->fmt.i_cat == VIDEO_ES && p_stream->i_pcr > VLC_TS_INVALID )
@@ -1460,7 +1460,7 @@ static void Ogg_DecodePacket( demux_t *p_demux,
     Ogg_SendOrQueueBlocks( p_demux, p_stream, p_block );
 }
 
-static int Ogg_OpusPacketDuration( ogg_packet *p_oggpacket )
+static unsigned Ogg_OpusPacketDuration( ogg_packet *p_oggpacket )
 {
     return opus_frame_duration(p_oggpacket->packet, p_oggpacket->bytes);
 }
diff --git a/modules/demux/opus.h b/modules/demux/opus.h
index 9721bc1..7365e2e 100644
--- a/modules/demux/opus.h
+++ b/modules/demux/opus.h
@@ -23,14 +23,14 @@
 
 /* Returns Opus frame duration in samples */
 
-static inline int opus_frame_duration(unsigned char *data, long len)
+static inline unsigned opus_frame_duration(unsigned char *data, long len)
 {
     static const int silk_fs_div[4] = { 6000, 3000, 1500, 1000 };
-    int toc;
-    int nframes;
-    int frame_size;
-    int nsamples;
-    int i_rate;
+    unsigned toc;
+    unsigned nframes;
+    unsigned frame_size;
+    unsigned nsamples;
+    unsigned i_rate;
     if( len < 1 )
         return 0;
     toc = data[0];



More information about the vlc-commits mailing list