mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-29 19:50:40 +00:00
codecs: vp9decoder: Allow decoding start with intra-only frame
As per spec "7.2 Uncompressed header semantics" and "8.2 Frame order constraints", decoding can start with intra-only frame. This commit is for fixing vp90-2-16-intra-only.webm bitstream test failure. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2112>
This commit is contained in:
parent
6eb9856f59
commit
50e116c4a7
1 changed files with 22 additions and 4 deletions
|
@ -270,6 +270,8 @@ gst_vp9_decoder_handle_frame (GstVideoDecoder * decoder,
|
|||
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);
|
||||
|
||||
|
@ -286,8 +288,25 @@ gst_vp9_decoder_handle_frame (GstVideoDecoder * decoder,
|
|||
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);
|
||||
|
||||
|
@ -296,8 +315,7 @@ gst_vp9_decoder_handle_frame (GstVideoDecoder * decoder,
|
|||
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;
|
||||
|
|
Loading…
Reference in a new issue