Commit c1f9f078 authored by Laurent Aimar's avatar Laurent Aimar

Do not decode subtitles too much in advanced.

It avoids loosing subtitles with the messages
"main subpicture error: subpicture heap full".
(cherry picked from commit 34f25416)
parent a75df43c
......@@ -131,6 +131,14 @@
/* 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
*****************************************************************************/
......
......@@ -1570,6 +1570,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( p_vout->p_spu, p_subpic );
else
......
......@@ -44,8 +44,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))
#define VLC_FOURCC_YUVP VLC_FOURCC('Y','U','V','P')
#define VLC_FOURCC_YUVA VLC_FOURCC('Y','U','V','A')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment