[libbluray-devel] graphics_processor_decode_pes(): check dts<-> stc diff is less than 30 seconds

hpi1 git at videolan.org
Thu Apr 11 14:43:45 CEST 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Apr 11 09:50:52 2013 +0300| [3cfcdb1ae126270456a97faebdca26b5dbcf2c9c] | committer: hpi1

graphics_processor_decode_pes(): check dts<->stc diff is less than 30 seconds
Fixes subtitle freezes at some clip boundaries

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=3cfcdb1ae126270456a97faebdca26b5dbcf2c9c
---

 src/libbluray/decoders/graphics_processor.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/libbluray/decoders/graphics_processor.c b/src/libbluray/decoders/graphics_processor.c
index c251e58..8db6c93 100644
--- a/src/libbluray/decoders/graphics_processor.c
+++ b/src/libbluray/decoders/graphics_processor.c
@@ -356,7 +356,7 @@ static int _decode_segment(PG_DISPLAY_SET *s, PES_BUFFER *p)
 /*
  * mpeg-pes interface
  */
-
+#define MAX_STC_DTS_DIFF (INT64_C(90000 * 30)) /* 30 seconds */
 static int graphics_processor_decode_pes(PG_DISPLAY_SET **s, PES_BUFFER **p, int64_t stc)
 {
     if (!s) {
@@ -371,9 +371,14 @@ static int graphics_processor_decode_pes(PG_DISPLAY_SET **s, PES_BUFFER **p, int
 
         /* time to decode next segment ? */
         if (stc >= 0 && (*p)->dts > stc) {
-            GP_TRACE("Segment dts > stc (%"PRId64" > %"PRId64" ; diff %"PRId64")\n",
-                     (*p)->dts, stc, (*p)->dts - stc);
-            return 0;
+
+            /* filter out values that seem to be incorrect (if stc is not updated) */
+            int64_t diff = (*p)->dts - stc;
+            if (diff < MAX_STC_DTS_DIFF) {
+                GP_TRACE("Segment dts > stc (%"PRId64" > %"PRId64" ; diff %"PRId64")\n",
+                         (*p)->dts, stc, diff);
+                return 0;
+            }
         }
 
         /* all fragments present ? */



More information about the libbluray-devel mailing list