decoder: vp9: Fix the context and surface pool reset for multi resolution video

Unlike other decoders, vp9 decoder doesn't need to reset the
whole context and surfaces for each resolution change. Context
reset only needed if resolution of any frame is greater than
what actullay configured. There are streams where a bigger
resolution set in ivf header or webm header but actual resolution
of all frames are less. Also it is possible to have inter-prediction
between these multi resolution frames.
This commit is contained in:
Sreerenj Balachandran 2015-11-13 19:23:05 +02:00
parent 4aa523f8b4
commit a48eebefd6

View file

@ -504,14 +504,28 @@ parse_frame_header (GstVaapiDecoderVp9 * decoder, const guchar * buf,
{ {
GstVaapiDecoderVp9Private *const priv = &decoder->priv; GstVaapiDecoderVp9Private *const priv = &decoder->priv;
GstVp9ParserResult result; GstVp9ParserResult result;
guint width, height;
result = gst_vp9_parser_parse_frame_header (priv->parser, frame_hdr, result = gst_vp9_parser_parse_frame_header (priv->parser, frame_hdr,
buf, buf_size); buf, buf_size);
if (result != GST_VP9_PARSER_OK) if (result != GST_VP9_PARSER_OK)
return get_status (result); return get_status (result);
if ((frame_hdr->frame_type == GST_VP9_KEY_FRAME) && /* Unlike other decoders, vp9 decoder doesn't need to reset the
(frame_hdr->width != priv->width || frame_hdr->height != priv->height)) { * whole context and surfaces for each resolution change. context
* reset only needed if resolution of any frame is greater than
* what actullay configured. There are streams where a bigger
* resolution set in ivf header or webm header but actual resolution
* of all frames are less. Also it is possible to have inter-prediction
* between these multi resolution frames */
width = GST_VAAPI_DECODER_WIDTH (decoder);
height = GST_VAAPI_DECODER_HEIGHT (decoder);
if (priv->width < width || priv->height < height) {
priv->width = GST_VAAPI_DECODER_WIDTH (decoder);
priv->height = GST_VAAPI_DECODER_HEIGHT (decoder);
priv->size_changed = TRUE;
}
if ((frame_hdr->width > priv->width || frame_hdr->height > priv->height)) {
priv->width = frame_hdr->width; priv->width = frame_hdr->width;
priv->height = frame_hdr->height; priv->height = frame_hdr->height;
priv->size_changed = TRUE; priv->size_changed = TRUE;