subparse: Check the time is valid when calculating the duration 52/201452/2
authorGilbok Lee <gilbok.lee@samsung.com>
Thu, 14 Mar 2019 07:37:52 +0000 (16:37 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Thu, 14 Mar 2019 08:36:04 +0000 (17:36 +0900)
  - In the case of sami subtitles, the duration for the last subtitle data is wrong.
  - The time value used to calculate the duraion is invalid,
    So the calculated duration is also wrong.
  - If the time is GST_CLOCK_TIME_NONE, the duration also be GST_CLOCK_TIME_NONE

Change-Id: Ic3eff678430229879880dcbc8c13743ca6260252

gst/subparse/samiparse.c

index 0ed207e..88df038 100644 (file)
@@ -1264,7 +1264,14 @@ parse_sami (ParserState * state, const gchar * line)
         ret = g_string_free (context->resultbuf, FALSE);
         context->resultbuf = g_string_new ("");
         state->start_time = context->time1;
+#ifdef TIZEN_FEATURE_SUBPARSE_MODIFICATION
+        if (!GST_CLOCK_TIME_IS_VALID(context->time2))
+          state->duration = GST_CLOCK_TIME_NONE;
+        else
+          state->duration = context->time2 - context->time1;
+#else
         state->duration = context->time2 - context->time1;
+#endif
         context->has_result = FALSE;
       }
 #ifdef TIZEN_FEATURE_SUBPARSE_MODIFICATION