From c3b28700d94b30f3ea06d799fcc55396aaf72cb5 Mon Sep 17 00:00:00 2001 From: Sreerenj Balachandran Date: Mon, 9 Nov 2015 17:45:29 +0200 Subject: [PATCH] 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 --- gst/ivfparse/gstivfparse.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/gst/ivfparse/gstivfparse.c b/gst/ivfparse/gstivfparse.c index 4e3ea8bd43..bea1e1905a 100644 --- a/gst/ivfparse/gstivfparse.c +++ b/gst/ivfparse/gstivfparse.c @@ -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); }