ivfparse: Fix the wrong width & height parsing of vp9 bitstream

The current implementation for detecting the resolution changes
on key frames is based on vp8 bitstream alignment. Avoid this
width and height parsing for vp9 bitstream, which requires proper
frame header parsing inorder to detect the resolution change (Fixme).

https://bugzilla.gnome.org/show_bug.cgi?id=757825
This commit is contained in:
Sreerenj Balachandran 2015-11-09 17:45:29 +02:00 committed by Sebastian Dröge
parent 788ff2f98e
commit c3b28700d9

View file

@ -331,15 +331,20 @@ gst_ivf_parse_handle_frame_data (GstIvfParse * ivf, GstBaseParseFrame * frame,
/* Detect resolution changes on key frames */
if (gst_buffer_map (frame->out_buffer, &map, GST_MAP_READ)) {
guint32 frame_tag, width, height;
guint32 width, height;
frame_tag = GST_READ_UINT24_LE (map.data);
if (!(frame_tag & 0x01) && map.size >= 10) { /* key frame */
GST_DEBUG_OBJECT (ivf, "key frame detected");
if (ivf->fourcc == GST_MAKE_FOURCC ('V', 'P', '8', '0')) {
guint32 frame_tag;
frame_tag = GST_READ_UINT24_LE (map.data);
if (!(frame_tag & 0x01) && map.size >= 10) { /* key frame */
GST_DEBUG_OBJECT (ivf, "key frame detected");
width = GST_READ_UINT16_LE (map.data + 6) & 0x3fff;
height = GST_READ_UINT16_LE (map.data + 8) & 0x3fff;
gst_ivf_parse_set_size (ivf, width, height);
width = GST_READ_UINT16_LE (map.data + 6) & 0x3fff;
height = GST_READ_UINT16_LE (map.data + 8) & 0x3fff;
gst_ivf_parse_set_size (ivf, width, height);
}
} else {
/* Fixme: Add vp9 frame header parsing? */
}
gst_buffer_unmap (frame->out_buffer, &map);
}