dashdemux: don't meddle with the class struct from an instance

Fix some very dubious code. The class methods should always
be set, and the instance-specific check should then be done
inside the method. For data_received that's there already, for
finish_fragment we need to add it.

https://bugzilla.gnome.org/show_bug.cgi?id=753937
This commit is contained in:
Tim-Philipp Müller 2015-08-21 16:13:43 +01:00
parent b392a6e3b9
commit ef7f5fc4c7

View file

@ -411,6 +411,10 @@ gst_dash_demux_class_init (GstDashDemuxClass * klass)
gst_dash_demux_get_live_seek_range;
gstadaptivedemux_class->get_presentation_offset =
gst_dash_demux_get_presentation_offset;
gstadaptivedemux_class->finish_fragment =
gst_dash_demux_stream_fragment_finished;
gstadaptivedemux_class->data_received = gst_dash_demux_data_received;
}
static void
@ -702,7 +706,6 @@ done:
static gboolean
gst_dash_demux_process_manifest (GstAdaptiveDemux * demux, GstBuffer * buf)
{
GstAdaptiveDemuxClass *klass;
GstDashDemux *dashdemux = GST_DASH_DEMUX_CAST (demux);
gboolean ret = FALSE;
gchar *manifest;
@ -722,13 +725,6 @@ gst_dash_demux_process_manifest (GstAdaptiveDemux * demux, GstBuffer * buf)
if (gst_buffer_map (buf, &mapinfo, GST_MAP_READ)) {
manifest = (gchar *) mapinfo.data;
if (gst_mpd_parse (dashdemux->client, manifest, mapinfo.size)) {
if (gst_mpd_client_has_isoff_ondemand_profile (dashdemux->client)) {
klass = GST_ADAPTIVE_DEMUX_GET_CLASS (dashdemux);
klass->data_received = gst_dash_demux_data_received;
klass->finish_fragment = gst_dash_demux_stream_fragment_finished;
}
if (gst_mpd_client_setup_media_presentation (dashdemux->client)) {
ret = TRUE;
} else {
@ -1434,6 +1430,7 @@ gst_dash_demux_stream_fragment_finished (GstAdaptiveDemux * demux,
dashstream->sidx_parser.status == GST_ISOFF_SIDX_PARSER_FINISHED)
/* fragment is advanced on data_received when byte limits are reached */
return GST_FLOW_OK;
if (G_UNLIKELY (stream->downloading_header || stream->downloading_index))
return GST_FLOW_OK;
@ -1446,10 +1443,15 @@ gst_dash_demux_data_received (GstAdaptiveDemux * demux,
GstAdaptiveDemuxStream * stream)
{
GstDashDemuxStream *dash_stream = (GstDashDemuxStream *) stream;
GstDashDemux *dashdemux = GST_DASH_DEMUX_CAST (demux);
GstFlowReturn ret = GST_FLOW_OK;
GstBuffer *buffer;
gsize available;
if (!gst_mpd_client_has_isoff_ondemand_profile (dashdemux->client))
return GST_ADAPTIVE_DEMUX_CLASS (parent_class)->data_received (demux,
stream);
if (stream->downloading_index) {
GstIsoffParserResult res;
guint consumed;