]> git.sesse.net Git - vlc/commitdiff
Do not decode subtitles too much in advanced.
authorLaurent Aimar <fenrir@videolan.org>
Mon, 27 Jul 2009 20:07:53 +0000 (22:07 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Mon, 27 Jul 2009 20:32:24 +0000 (22:32 +0200)
It avoids loosing subtitles with the messages
"main subpicture error: subpicture heap full".

include/vlc_config.h
src/input/decoder.c
src/video_output/vout_subpictures.c

index 3998482c4eba3761f5a76786b69af18317b6f32e..ae6e7a19aa1b5d24b1097dd1f5e3a3031146ba76 100644 (file)
 /* Max acceptable resampling (in %) */
 #define AOUT_MAX_RESAMPLING             10
 
+/*****************************************************************************
+ * SPU configuration
+ *****************************************************************************/
+
+/* Buffer must avoid arriving more than SPU_MAX_PREPARE_TIME in advanced to
+ * the SPU */
+#define SPU_MAX_PREPARE_TIME ((mtime_t)(0.5*CLOCK_FREQ))
+
 /*****************************************************************************
  * Video configuration
  *****************************************************************************/
index 7069388d21cab5a44ec24e9c1c691ad327e1d8e6..1209b53d618101d3feb5ff76898c8f212d41c9ea 100644 (file)
@@ -1564,6 +1564,12 @@ static void DecoderPlaySpu( decoder_t *p_dec, subpicture_t *p_subpic,
 
         vlc_mutex_unlock( &p_owner->lock );
 
+        if( p_subpic->i_start <= VLC_TS_INVALID )
+            b_reject = true;
+
+        DecoderWaitDate( p_dec, &b_reject,
+                         p_subpic->i_start - SPU_MAX_PREPARE_TIME );
+
         if( !b_reject )
             spu_DisplaySubpicture( vout_GetSpu( p_vout ), p_subpic );
         else
index 5ee652f44353fee0221d829f22c92457a7336f5f..d844ef1cc6a154321ad7405fc4a9e7c781e8caa4 100644 (file)
@@ -45,8 +45,9 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
+
 /* Number of simultaneous subpictures */
-#define VOUT_MAX_SUBPICTURES (VOUT_MAX_PICTURES)
+#define VOUT_MAX_SUBPICTURES (__MAX(VOUT_MAX_PICTURES, SPU_MAX_PREPARE_TIME/5000))
 
 /* */
 typedef struct