h264decoder: fail early if no input caps have been provided

The h264decoder class does not implement the ->parse() virtual function,
and we always need to add the h264parse element before it. So we should
set_needs_format of the decoder to TRUE, then if no parse before it, it
can fail with a "not-negotiated" error early, rather than go on and
generate unexpected error.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4064>
This commit is contained in:
He Junyan 2023-02-24 21:09:31 +08:00
parent b92a0a3e84
commit 13b36cd4e3

View file

@ -340,6 +340,7 @@ gst_h264_decoder_init (GstH264Decoder * self)
GstH264DecoderPrivate *priv; GstH264DecoderPrivate *priv;
gst_video_decoder_set_packetized (GST_VIDEO_DECODER (self), TRUE); gst_video_decoder_set_packetized (GST_VIDEO_DECODER (self), TRUE);
gst_video_decoder_set_needs_format (GST_VIDEO_DECODER (self), TRUE);
self->priv = priv = gst_h264_decoder_get_instance_private (self); self->priv = priv = gst_h264_decoder_get_instance_private (self);