]> git.sesse.net Git - vlc/commitdiff
npt's are double in live555 lib. We were loosing precision, and it avoids double...
authorSébastien Escudier <sebastien-devel@celeos.eu>
Tue, 13 Mar 2012 08:07:09 +0000 (09:07 +0100)
committerSébastien Escudier <sebastien-devel@celeos.eu>
Wed, 14 Mar 2012 14:43:25 +0000 (15:43 +0100)
modules/demux/live555.cpp

index deca8bbbfa8cbb289880c41a922f847c81598cd3..2fb2c8687f8b997e0f328d67b90bad2fa98a733c 100644 (file)
@@ -163,7 +163,7 @@ typedef struct
     bool            b_rtcp_sync;
     char            waiting;
     int64_t         i_pts;
-    float           f_npt;
+    double          f_npt;
 
     bool            b_selected;
 
@@ -200,9 +200,9 @@ struct demux_sys_t
 
     /* */
     int64_t          i_pcr; /* The clock */
-    float            f_npt;
-    float            f_npt_length;
-    float            f_npt_start;
+    double           f_npt;
+    double           f_npt_length;
+    double           f_npt_start;
 
     /* timeout thread information */
     int              i_timeout;     /* session timeout value in seconds */
@@ -1350,7 +1350,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             pi64 = (int64_t*)va_arg( args, int64_t * );
             if( p_sys->f_npt_length > 0 )
             {
-                *pi64 = (int64_t)((double)p_sys->f_npt_length * 1000000.0);
+                *pi64 = (int64_t)(p_sys->f_npt_length * 1000000.0);
                 return VLC_SUCCESS;
             }
             return VLC_EGENERIC;
@@ -1359,7 +1359,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             pf = (double*)va_arg( args, double* );
             if( (p_sys->f_npt_length > 0) && (p_sys->f_npt > 0) )
             {
-                *pf = ( (double)p_sys->f_npt / (double)p_sys->f_npt_length );
+                *pf = p_sys->f_npt / p_sys->f_npt_length;
                 return VLC_SUCCESS;
             }
             return VLC_EGENERIC;
@@ -1374,14 +1374,14 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
                 if( (i_query == DEMUX_SET_TIME) && (p_sys->f_npt > 0) )
                 {
                     i64 = (int64_t)va_arg( args, int64_t );
-                    time = (float)((double)i64 / (double)1000000.0); /* in second */
+                    time = (float)(i64 / 1000000.0); /* in second */
                 }
                 else if( i_query == DEMUX_SET_TIME )
                     return VLC_EGENERIC;
                 else
                 {
                     f = (double)va_arg( args, double );
-                    time = f * (double)p_sys->f_npt_length;   /* in second */
+                    time = f * p_sys->f_npt_length;   /* in second */
                 }
 
                 if( p_sys->b_paused )