mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
matroskademux: handle bogus files storing ADTS AAC data
This commit is contained in:
parent
18f37ffc9a
commit
16b57b49c9
1 changed files with 39 additions and 0 deletions
|
@ -4343,6 +4343,40 @@ gst_matroska_demux_check_subtitle_buffer (GstElement * element,
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GstFlowReturn
|
||||||
|
gst_matroska_demux_check_aac (GstElement * element,
|
||||||
|
GstMatroskaTrackContext * stream, GstBuffer ** buf)
|
||||||
|
{
|
||||||
|
const guint8 *data;
|
||||||
|
guint size;
|
||||||
|
|
||||||
|
data = GST_BUFFER_DATA (*buf);
|
||||||
|
size = GST_BUFFER_SIZE (*buf);
|
||||||
|
|
||||||
|
if (size > 2 && data[0] == 0xff && (data[1] >> 4 == 0x0f)) {
|
||||||
|
GstCaps *new_caps;
|
||||||
|
GstStructure *s;
|
||||||
|
|
||||||
|
/* tss, ADTS data, remove codec_data
|
||||||
|
* still assume it is at least parsed */
|
||||||
|
new_caps = gst_caps_copy (stream->caps);
|
||||||
|
s = gst_caps_get_structure (new_caps, 0);
|
||||||
|
g_assert (s);
|
||||||
|
gst_structure_remove_field (s, "codec_data");
|
||||||
|
gst_caps_replace (&stream->caps, new_caps);
|
||||||
|
gst_pad_set_caps (stream->pad, new_caps);
|
||||||
|
gst_buffer_set_caps (*buf, new_caps);
|
||||||
|
GST_DEBUG_OBJECT (element, "ADTS AAC audio data; removing codec-data, "
|
||||||
|
"new caps: %" GST_PTR_FORMAT, new_caps);
|
||||||
|
gst_caps_unref (new_caps);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* disable subsequent checking */
|
||||||
|
stream->postprocess_frame = NULL;
|
||||||
|
|
||||||
|
return GST_FLOW_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux,
|
gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux,
|
||||||
GstEbmlRead * ebml, guint64 cluster_time, guint64 cluster_offset,
|
GstEbmlRead * ebml, guint64 cluster_time, guint64 cluster_offset,
|
||||||
|
@ -6462,8 +6496,13 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
GST_WARNING ("Opaque A_AAC codec ID, but no codec private data");
|
GST_WARNING ("Opaque A_AAC codec ID, but no codec private data");
|
||||||
|
/* this is pretty broken;
|
||||||
|
* maybe we need to make up some default private,
|
||||||
|
* or maybe ADTS data got dumped in.
|
||||||
|
* Let's set up some private data now, and check actual data later */
|
||||||
/* just try this and see what happens ... */
|
/* just try this and see what happens ... */
|
||||||
codec_id = GST_MATROSKA_CODEC_ID_AUDIO_AAC_MPEG4;
|
codec_id = GST_MATROSKA_CODEC_ID_AUDIO_AAC_MPEG4;
|
||||||
|
context->postprocess_frame = gst_matroska_demux_check_aac;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue