From c633f2aab75a8f3e049708569b132a81879e00e3 Mon Sep 17 00:00:00 2001 From: Jimmy Ohn Date: Tue, 22 Mar 2016 13:15:20 +0900 Subject: [PATCH] qtdemux: Add check condition for fail case in get_duration function Currently, get_duration function always return the TRUE even though it can't be set duration correctly. So, we need to add the else condition about the fail case. Also, we already set the GST_CLOCK_TIME_NONE in this function. So I have modify it which is related code in some function. https://bugzilla.gnome.org/show_bug.cgi?id=763968 --- gst/isomp4/qtdemux.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index 0ac3b10a99..2f4db8bd9a 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -788,15 +788,18 @@ done: static gboolean gst_qtdemux_get_duration (GstQTDemux * qtdemux, GstClockTime * duration) { - gboolean res = TRUE; + gboolean res = FALSE; *duration = GST_CLOCK_TIME_NONE; - if (qtdemux->duration != 0) { - if (qtdemux->duration != G_MAXINT64 && qtdemux->timescale != 0) { - *duration = QTTIME_TO_GSTTIME (qtdemux, qtdemux->duration); - } + if (qtdemux->duration != 0 && + qtdemux->duration != G_MAXINT64 && qtdemux->timescale != 0) { + *duration = QTTIME_TO_GSTTIME (qtdemux, qtdemux->duration); + res = TRUE; + } else { + *duration = GST_CLOCK_TIME_NONE; } + return res; } @@ -867,7 +870,7 @@ gst_qtdemux_handle_src_query (GstPad * pad, GstObject * parent, if (!res) { gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL); if (fmt == GST_FORMAT_TIME) { - GstClockTime duration = GST_CLOCK_TIME_NONE; + GstClockTime duration; gst_qtdemux_get_duration (qtdemux, &duration); seekable = TRUE; @@ -10499,8 +10502,7 @@ gst_qtdemux_guess_bitrate (GstQTDemux * qtdemux) size = size - qtdemux->header_size; - if (!gst_qtdemux_get_duration (qtdemux, &duration) || - duration == GST_CLOCK_TIME_NONE) { + if (!gst_qtdemux_get_duration (qtdemux, &duration)) { GST_DEBUG_OBJECT (qtdemux, "Stream duration not known - bailing"); return; }