[vlc-devel] commit: Do not decode subtitles too much in advanced. (Laurent Aimar )
git version control
git at videolan.org
Wed Jul 29 22:48:00 CEST 2009
vlc | branch: 1.0-bugfix | Laurent Aimar <fenrir at videolan.org> | Mon Jul 27 22:07:53 2009 +0200| [c1f9f0784e15b421e8db88e5309334d87953bbe0] | committer: 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 34f2541694d7ffeb622012b5719e9ba621861510)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c1f9f0784e15b421e8db88e5309334d87953bbe0
---
include/vlc_config.h | 8 ++++++++
src/input/decoder.c | 6 ++++++
src/video_output/vout_subpictures.c | 3 ++-
3 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/include/vlc_config.h b/include/vlc_config.h
index 77709e7..838e502 100644
--- a/include/vlc_config.h
+++ b/include/vlc_config.h
@@ -132,6 +132,14 @@
#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
*****************************************************************************/
diff --git a/src/input/decoder.c b/src/input/decoder.c
index e36f759..e3dc200 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -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
diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index 393b4bb..a4fd7a9 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -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')
More information about the vlc-devel
mailing list