mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-23 07:38:16 +00:00
qtdemux: Gracefully handle mov files misusing the WAVE atoms
Check that the WAVEHEADER node is present instead of blindly using it. If not present we won't be able to provide a more refined caps, but at least we won't crash. https://bugzilla.gnome.org/show_bug.cgi?id=640028
This commit is contained in:
parent
9acda034f8
commit
6d545e29ad
1 changed files with 22 additions and 19 deletions
|
@ -7004,31 +7004,34 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
|
|||
guint32 headerlen;
|
||||
|
||||
waveheadernode = qtdemux_tree_get_child_by_type (wavenode, fourcc);
|
||||
waveheader = (const guint8 *) waveheadernode->data;
|
||||
headerlen = QT_UINT32 (waveheader);
|
||||
if (waveheadernode) {
|
||||
waveheader = (const guint8 *) waveheadernode->data;
|
||||
headerlen = QT_UINT32 (waveheader);
|
||||
|
||||
if (headerlen > 8) {
|
||||
gst_riff_strf_auds *header = NULL;
|
||||
GstBuffer *headerbuf;
|
||||
GstBuffer *extra;
|
||||
if (headerlen > 8) {
|
||||
gst_riff_strf_auds *header = NULL;
|
||||
GstBuffer *headerbuf;
|
||||
GstBuffer *extra;
|
||||
|
||||
waveheader += 8;
|
||||
headerlen -= 8;
|
||||
waveheader += 8;
|
||||
headerlen -= 8;
|
||||
|
||||
headerbuf = gst_buffer_new ();
|
||||
GST_BUFFER_DATA (headerbuf) = (guint8 *) waveheader;
|
||||
GST_BUFFER_SIZE (headerbuf) = headerlen;
|
||||
headerbuf = gst_buffer_new ();
|
||||
GST_BUFFER_DATA (headerbuf) = (guint8 *) waveheader;
|
||||
GST_BUFFER_SIZE (headerbuf) = headerlen;
|
||||
|
||||
if (gst_riff_parse_strf_auds (GST_ELEMENT_CAST (qtdemux),
|
||||
headerbuf, &header, &extra)) {
|
||||
gst_caps_unref (stream->caps);
|
||||
stream->caps = gst_riff_create_audio_caps (header->format, NULL,
|
||||
header, extra, NULL, NULL);
|
||||
if (gst_riff_parse_strf_auds (GST_ELEMENT_CAST (qtdemux),
|
||||
headerbuf, &header, &extra)) {
|
||||
gst_caps_unref (stream->caps);
|
||||
stream->caps = gst_riff_create_audio_caps (header->format, NULL,
|
||||
header, extra, NULL, NULL);
|
||||
|
||||
if (extra)
|
||||
gst_buffer_unref (extra);
|
||||
if (extra)
|
||||
gst_buffer_unref (extra);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
GST_DEBUG ("Didn't find waveheadernode for this codec");
|
||||
}
|
||||
g_node_destroy (wavenode);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue