mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-08 23:42:28 +00:00
flvdemux: Skip unknown tags in push-mode
We add a new mode (SKIP) in push-mode to skip tags that we don't known about Partially fixes https://bugzilla.gnome.org/show_bug.cgi?id=670712
This commit is contained in:
parent
f5b2b6e696
commit
c09b14c931
2 changed files with 22 additions and 10 deletions
|
@ -1683,6 +1683,16 @@ gst_flv_demux_parse_tag_type (GstFlvDemux * demux, GstBuffer * buffer)
|
||||||
|
|
||||||
tag_type = map.data[0];
|
tag_type = map.data[0];
|
||||||
|
|
||||||
|
/* Tag size is 1 byte of type + 3 bytes of size + 7 bytes + tag data size +
|
||||||
|
* 4 bytes of previous tag size */
|
||||||
|
demux->tag_data_size = GST_READ_UINT24_BE (map.data + 1);
|
||||||
|
demux->tag_size = demux->tag_data_size + 11;
|
||||||
|
|
||||||
|
GST_LOG_OBJECT (demux, "tag data size is %" G_GUINT64_FORMAT,
|
||||||
|
demux->tag_data_size);
|
||||||
|
|
||||||
|
gst_buffer_unmap (buffer, &map);
|
||||||
|
|
||||||
switch (tag_type) {
|
switch (tag_type) {
|
||||||
case 9:
|
case 9:
|
||||||
demux->state = FLV_STATE_TAG_VIDEO;
|
demux->state = FLV_STATE_TAG_VIDEO;
|
||||||
|
@ -1697,18 +1707,9 @@ gst_flv_demux_parse_tag_type (GstFlvDemux * demux, GstBuffer * buffer)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
GST_WARNING_OBJECT (demux, "unsupported tag type %u", tag_type);
|
GST_WARNING_OBJECT (demux, "unsupported tag type %u", tag_type);
|
||||||
|
demux->state = FLV_STATE_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tag size is 1 byte of type + 3 bytes of size + 7 bytes + tag data size +
|
|
||||||
* 4 bytes of previous tag size */
|
|
||||||
demux->tag_data_size = GST_READ_UINT24_BE (map.data + 1);
|
|
||||||
demux->tag_size = demux->tag_data_size + 11;
|
|
||||||
|
|
||||||
GST_LOG_OBJECT (demux, "tag data size is %" G_GUINT64_FORMAT,
|
|
||||||
demux->tag_data_size);
|
|
||||||
|
|
||||||
gst_buffer_unmap (buffer, &map);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2111,6 +2112,16 @@ parse:
|
||||||
demux->state = FLV_STATE_TAG_TYPE;
|
demux->state = FLV_STATE_TAG_TYPE;
|
||||||
goto beach;
|
goto beach;
|
||||||
}
|
}
|
||||||
|
case FLV_STATE_SKIP:
|
||||||
|
/* Skip unknown tags (set in _parse_tag_type()) */
|
||||||
|
if (gst_adapter_available (demux->adapter) >= demux->tag_size) {
|
||||||
|
gst_adapter_flush (demux->adapter, demux->tag_size);
|
||||||
|
demux->offset += demux->tag_size;
|
||||||
|
demux->state = FLV_STATE_TAG_TYPE;
|
||||||
|
goto parse;
|
||||||
|
} else {
|
||||||
|
goto beach;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
GST_DEBUG_OBJECT (demux, "unexpected demuxer state");
|
GST_DEBUG_OBJECT (demux, "unexpected demuxer state");
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ typedef enum
|
||||||
FLV_STATE_TAG_SCRIPT,
|
FLV_STATE_TAG_SCRIPT,
|
||||||
FLV_STATE_SEEK,
|
FLV_STATE_SEEK,
|
||||||
FLV_STATE_DONE,
|
FLV_STATE_DONE,
|
||||||
|
FLV_STATE_SKIP,
|
||||||
FLV_STATE_NONE
|
FLV_STATE_NONE
|
||||||
} GstFlvDemuxState;
|
} GstFlvDemuxState;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue