GstVp9ParserResult pres;
GstMapInfo map;
GstFlowReturn ret = GST_FLOW_OK;
+ gboolean intra_only = FALSE;
+ gboolean check_codec_change = FALSE;
GST_LOG_OBJECT (self, "handle frame %" GST_PTR_FORMAT, in_buf);
goto unmap_and_error;
}
- if (priv->wait_keyframe && (frame_hdr.frame_type != GST_VP9_KEY_FRAME
- || frame_hdr.show_existing_frame)) {
+ if (frame_hdr.show_existing_frame) {
+ /* This is a non-intra, dummy frame */
+ intra_only = FALSE;
+ } else if (frame_hdr.frame_type == GST_VP9_KEY_FRAME || frame_hdr.intra_only) {
+ intra_only = TRUE;
+ }
+
+ if (intra_only) {
+ if (frame_hdr.frame_type == GST_VP9_KEY_FRAME) {
+ /* Always check codec change per keyframe */
+ check_codec_change = TRUE;
+ } else if (priv->wait_keyframe) {
+ /* Or, if we are waiting for leading keyframe, but this is intra-only,
+ * try decoding this frame, it's allowed as per spec */
+ check_codec_change = TRUE;
+ }
+ }
+
+ if (priv->wait_keyframe && !intra_only) {
GST_DEBUG_OBJECT (self, "Drop frame before initial keyframe");
gst_buffer_unmap (in_buf, &map);
return GST_FLOW_OK;
}
- if (frame_hdr.frame_type == GST_VP9_KEY_FRAME &&
- !frame_hdr.show_existing_frame &&
+ if (check_codec_change &&
!gst_vp9_decoder_check_codec_change (self, &frame_hdr)) {
GST_ERROR_OBJECT (self, "codec change error");
goto unmap_and_error;