matroskdemux: do not use MapInfo.data after unmapping

And minor gst-indenting
This commit is contained in:
Thibault Saunier 2018-10-03 17:34:49 +02:00
parent 0432826950
commit defae35035
2 changed files with 19 additions and 9 deletions

View file

@ -376,10 +376,12 @@ gst_matroska_decode_buffer (GstMatroskaTrackContext * context, GstBuffer * buf)
if (gst_matroska_decode_data (context->encodings, &data, &size,
GST_MATROSKA_TRACK_ENCODING_SCOPE_FRAME, FALSE)) {
gst_buffer_unmap (out_buf, &map);
if (data != map.data) {
gst_buffer_unmap (out_buf, &map);
gst_buffer_unref (out_buf);
out_buf = gst_buffer_new_wrapped (data, size);
} else {
gst_buffer_unmap (out_buf, &map);
}
} else {
GST_DEBUG ("decode data failed");
@ -399,11 +401,12 @@ gst_matroska_decode_buffer (GstMatroskaTrackContext * context, GstBuffer * buf)
if (gst_matroska_parse_protection_meta (&data, &size, info_protect,
&encrypted)) {
gst_buffer_unmap (out_buf, &map);
if (data != map.data) {
GstBuffer *tmp_buf = out_buf;
out_buf =
gst_buffer_copy_region (tmp_buf, GST_BUFFER_COPY_ALL,
GstBuffer *tmp_buf;
gst_buffer_unmap (out_buf, &map);
tmp_buf = out_buf;
out_buf = gst_buffer_copy_region (tmp_buf, GST_BUFFER_COPY_ALL,
gst_buffer_get_size (tmp_buf) - size, size);
gst_buffer_unref (tmp_buf);
if (encrypted)
@ -411,6 +414,7 @@ gst_matroska_decode_buffer (GstMatroskaTrackContext * context, GstBuffer * buf)
else
gst_structure_free (info_protect);
} else {
gst_buffer_unmap (out_buf, &map);
gst_structure_free (info_protect);
}
} else {
@ -2705,10 +2709,10 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux,
* would be determined again when parsing, but anyway ... */
seeksegment.duration = demux->common.segment.duration;
flush = ! !(flags & GST_SEEK_FLAG_FLUSH);
keyunit = ! !(flags & GST_SEEK_FLAG_KEY_UNIT);
after = ! !(flags & GST_SEEK_FLAG_SNAP_AFTER);
before = ! !(flags & GST_SEEK_FLAG_SNAP_BEFORE);
flush = !!(flags & GST_SEEK_FLAG_FLUSH);
keyunit = !!(flags & GST_SEEK_FLAG_KEY_UNIT);
after = !!(flags & GST_SEEK_FLAG_SNAP_AFTER);
before = !!(flags & GST_SEEK_FLAG_SNAP_BEFORE);
/* always do full update if flushing,
* otherwise problems might arise downstream with missing keyframes etc */

View file

@ -2043,6 +2043,8 @@ gst_matroska_read_common_parse_metadata_id_simple_tag (GstMatroskaReadCommon *
const gchar *matroska_tagname;
const gchar *gstreamer_tagname;
}
/* *INDENT-OFF* */
tag_conv[] = {
{
/* The following list has the _same_ order as the one in Matroska spec. Please, don't mess it up. */
@ -2177,11 +2179,14 @@ gst_matroska_read_common_parse_metadata_id_simple_tag (GstMatroskaReadCommon *
GST_MATROSKA_TAG_ID_LICENSE, GST_TAG_LICENSE}, { /* The license applied to the content (like Creative Commons variants). */
GST_MATROSKA_TAG_ID_TERMS_OF_USE, GST_TAG_LICENSE}
};
/* *INDENT-ON* */
static const struct
{
const gchar *matroska_tagname;
const gchar *gstreamer_tagname;
}
/* *INDENT-OFF* */
child_tag_conv[] = {
{
"TITLE/SORT_WITH=", GST_TAG_TITLE_SORTNAME}, {
@ -2198,6 +2203,7 @@ gst_matroska_read_common_parse_metadata_id_simple_tag (GstMatroskaReadCommon *
"LICENSE/URL=", GST_TAG_LICENSE_URI}, {
"LICENSE/URL=", GST_TAG_LICENSE_URI}
};
/* *INDENT-ON* */
GstFlowReturn ret;
guint32 id;
gchar *value = NULL;