Skip to content

Commit

Permalink
Do not decode subtitles too much in advanced.
Browse files Browse the repository at this point in the history
It avoids loosing subtitles with the messages
"main subpicture error: subpicture heap full".
  • Loading branch information
Laurent Aimar committed Jul 27, 2009
1 parent 8712993 commit 34f2541
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
8 changes: 8 additions & 0 deletions include/vlc_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*****************************************************************************/
Expand Down
6 changes: 6 additions & 0 deletions src/input/decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/video_output/vout_subpictures.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 34f2541

Please sign in to comment.