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
This commit is contained in:
Jimmy Ohn 2016-03-22 13:15:20 +09:00 committed by Sebastian Dröge
parent 0ef9e6d139
commit c633f2aab7

View file

@ -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;
}