]> git.sesse.net Git - vlc/commitdiff
backport of [13220] [13191] [13192]
authorMarian Durkovic <md@videolan.org>
Sun, 13 Nov 2005 11:57:13 +0000 (11:57 +0000)
committerMarian Durkovic <md@videolan.org>
Sun, 13 Nov 2005 11:57:13 +0000 (11:57 +0000)
modules/demux/mpeg/mpga.c
src/input/clock.c
src/input/input_internal.h

index fefc4299a77d2a8018e96a6812f8e661305eaf83..f7bcbf91277e7b4a924140634bcb25535de62c1c 100644 (file)
@@ -32,7 +32,7 @@
 #include "vlc_codec.h"
 #include "vlc_meta.h"
 
-#define MPGA_PACKET_SIZE 4096
+#define MPGA_PACKET_SIZE 1024
 
 /*****************************************************************************
  * Module descriptor
index 6afca87a61307c24013e64af7ef3894dde41abc4..017a1810799199ac1723ef74f0b8e6a369e4d65a 100644 (file)
@@ -133,6 +133,7 @@ void input_ClockInit( input_clock_t *cl, vlc_bool_t b_master, int i_cr_average )
 
     cl->last_cr = 0;
     cl->last_pts = 0;
+    cl->last_sysdate = 0;
     cl->cr_ref = 0;
     cl->sysdate_ref = 0;
     cl->delta_cr = 0;
@@ -264,15 +265,17 @@ void input_ClockSetPCR( input_thread_t *p_input,
         else
         {
             cl->last_cr = 0;
+            cl->last_sysdate = 0;
             cl->delta_cr = 0;
             cl->i_delta_cr_residue = 0;
         }
     }
     else
     {
+        mtime_t clock_max_gap = CR_MAX_GAP * 90 / p_input->i_rate;
         if ( cl->last_cr != 0 &&
-               (    (cl->last_cr - i_clock) > CR_MAX_GAP
-                 || (cl->last_cr - i_clock) < - CR_MAX_GAP ) )
+               (    (cl->last_cr - i_clock) > clock_max_gap
+                 || (cl->last_cr - i_clock) < - clock_max_gap ) )
         {
             /* Stream discontinuity, for which we haven't received a
              * warning from the stream control facilities (dd-edited
@@ -308,7 +311,7 @@ void input_ClockSetPCR( input_thread_t *p_input,
             input_ClockManageControl( p_input, cl, i_clock );
 #endif
         }
-        else
+        else if ( mdate() - cl->last_sysdate > 200000 )
         {
             /* Smooth clock reference variations. */
             mtime_t i_extrapoled_clock = ClockCurrent( p_input, cl );
@@ -324,6 +327,7 @@ void input_ClockSetPCR( input_thread_t *p_input,
                                        + cl->i_delta_cr_residue )
                                     % cl->i_cr_average;
             cl->delta_cr = delta_cr;
+            cl->last_sysdate = mdate();
         }
     }
 }
index a9a0b3fe783422731ecdc0e7cac84591421cbbb6..c0daa4d8d5345087c672930ac98134d8f88a722c 100644 (file)
@@ -133,6 +133,7 @@ typedef struct
     /* Synchronization information */
     mtime_t                 delta_cr;
     mtime_t                 cr_ref, sysdate_ref;
+    mtime_t                 last_sysdate;
     mtime_t                 last_cr; /* reference to detect unexpected stream
                                       * discontinuities                      */
     mtime_t                 last_pts;