]> git.sesse.net Git - vlc/commitdiff
Am�lioration de la synchro.
authorStéphane Borel <stef@videolan.org>
Sun, 30 Jan 2000 23:31:26 +0000 (23:31 +0000)
committerStéphane Borel <stef@videolan.org>
Sun, 30 Jan 2000 23:31:26 +0000 (23:31 +0000)
--Meuuh

include/config.h
src/input/input.c
src/video_parser/vpar_headers.c
src/video_parser/vpar_synchro.c

index 8ecfb85dc02c9f9f3202e2d2dea06e131f6a6dca..18abd59cd7fcea0b0c5a3c9bad12f1324f95fa5b 100644 (file)
  * server */
 #define INPUT_VLAN_CHANGE_DELAY         5000000
 
+/* Duration between the time we receive the TS packet, and the time we will
+ * mark it to be presented */
+#define INPUT_PTS_DELAY                 2000000
+
 /*******************************************************************************
  * Audio configuration
  *******************************************************************************/
 #define VPAR_IDLE_SLEEP                 100000
 
 /* Time to sleep when waiting for a buffer (from vout or the video fifo). */
-#define VPAR_OUTMEM_SLEEP               10000
+#define VPAR_OUTMEM_SLEEP               100000
 
 /* Optimization level, from 0 to 2 - 1 is generally a good compromise. Remember
  * that raising this level dramatically lengthens the compilation time. */
index 8e872677dfcaf29b35a518d71d08c388b896273f..ada363bd44394f572ea3daf57ea196a999dab5de 100644 (file)
@@ -1000,7 +1000,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
 
                             case SYNCHRO_START:
                                 p_pes->i_pts += p_pcr->delta_pcr;
-                                p_pcr->delta_absolute = mdate() - p_pes->i_pts + 500000;
+                                p_pcr->delta_absolute = mdate() - p_pes->i_pts + INPUT_PTS_DELAY;
                                 p_pes->i_pts += p_pcr->delta_absolute;
                                 p_pcr->i_synchro_state = 0;
                                 break;
index b7eb6eb29bb0924aea8bb173f55436f0a10974e5..8853cff5200b5866d146bb0bbf740163dfbcac4d 100644 (file)
@@ -164,11 +164,17 @@ static void __inline__ ReferenceUpdate( vpar_thread_t * p_vpar,
         if( p_newref != NULL )
             vout_LinkPicture( p_vpar->p_vout, p_newref );
     }
+    else if( p_newref != NULL )
+    {
+        /* Put date immediately. */
+        vout_DatePicture( p_vpar->p_vout, p_newref,
+                          vpar_SynchroDate( p_vpar ) );
+    }
 }
 
 /*****************************************************************************
  * ReferenceReplace : Replace the last reference pointer when we destroy
- * a picture
+ *                    a picture
  *****************************************************************************/
 static void __inline__ ReferenceReplace( vpar_thread_t * p_vpar,
                                          int i_coding_type,
@@ -669,12 +675,6 @@ static void PictureHeader( vpar_thread_t * p_vpar )
 
         /* Initialize values. */
         vpar_SynchroDecode( p_vpar, p_vpar->picture.i_coding_type, i_structure );
-        if( p_vpar->picture.i_coding_type == B_CODING_TYPE )
-        {
-            /* Put date immediately. */
-            vout_DatePicture( p_vpar->p_vout, P_picture,
-                              vpar_SynchroDate( p_vpar ) );
-        }
         P_picture->i_aspect_ratio = p_vpar->sequence.i_aspect_ratio;
         P_picture->i_matrix_coefficients = p_vpar->sequence.i_matrix_coefficients;
         p_vpar->picture.i_l_stride = ( p_vpar->sequence.i_width
index 81e495154421a35844a3f44d9ae591d346e65037..bca1d29f5dc06dfc78d91c63568b5001a56c9ecc 100644 (file)
@@ -71,7 +71,9 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
     decoder_fifo_t * decoder_fifo = p_vpar->bit_stream.p_decoder_fifo;
 
     /* interpolate the current _decode_ PTS */
-    i_current_pts = decoder_fifo->buffer[decoder_fifo->i_start]->i_pts;
+    i_current_pts = decoder_fifo->buffer[decoder_fifo->i_start]->b_has_pts ?
+                    decoder_fifo->buffer[decoder_fifo->i_start]->i_pts :
+                    0;
     if( !i_current_pts )
     {
         i_current_pts = p_vpar->synchro.i_last_decode_pts
@@ -84,8 +86,10 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
            = i_current_pts;
 
     /* update display time */
-    i_displaydate = decoder_fifo->buffer[decoder_fifo->i_start]->i_pts;
-    if( !i_displaydate || i_coding_type != I_CODING_TYPE )
+    i_displaydate = decoder_fifo->buffer[decoder_fifo->i_start]->b_has_pts ?
+                    decoder_fifo->buffer[decoder_fifo->i_start]->i_pts :
+                    0;
+    if( !i_displaydate /* || i_coding_type != I_CODING_TYPE */ )
     {
         if (!p_vpar->synchro.i_images_since_pts )
             p_vpar->synchro.i_images_since_pts = 10;