flvdemux: un-break duration querying

Commit 2b9493b5 broke this in two ways: a) we should only
pass duration queries in TIME format upstream (or at least
not those in DEFAULT or BYTE format), and b) we mustn't
overwrite the default value of 'res' from TRUE to FALSE
and not set it again later. This led to bogus durations
being reported for FLV playback from file, because TIME
queries would fail (as 'res' had been set to FALSE) and
parsers then do a BYTE query as fallback and try to
guesstimate something in return, which of course goes
horribly wrong since the BYTE size returned is for the
muxed file.
This commit is contained in:
Tim-Philipp Müller 2014-08-13 11:54:26 +01:00
parent 0911307d7d
commit 9afeb9652b

View file

@ -3143,11 +3143,6 @@ gst_flv_demux_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
GstFormat format;
/* Try to push upstream first */
res = gst_pad_peer_query (demux->sinkpad, query);
if (res)
goto beach;
gst_query_parse_duration (query, &format, NULL);
/* duration is time only */
@ -3158,11 +3153,16 @@ gst_flv_demux_query (GstPad * pad, GstObject * parent, GstQuery * query)
goto beach;
}
/* Try to push upstream first */
res = gst_pad_peer_query (demux->sinkpad, query);
if (res)
goto beach;
GST_DEBUG_OBJECT (pad, "duration query, replying %" GST_TIME_FORMAT,
GST_TIME_ARGS (demux->duration));
gst_query_set_duration (query, GST_FORMAT_TIME, demux->duration);
res = TRUE;
break;
}
case GST_QUERY_POSITION: