libs: codecs: h264decoder: Assert output_picture virtual method.
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Fri, 7 May 2021 14:02:04 +0000 (16:02 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 7 May 2021 20:20:59 +0000 (20:20 +0000)
For new code it's nice to assert if the derived class implemented the
output_picture virtual method. Otherwise a segmentation fault
occurs. All other decoders assert this method.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2228>

gst-libs/gst/codecs/gsth264decoder.c

index 1ee6f54..554ab1e 100644 (file)
@@ -1525,6 +1525,8 @@ gst_h264_decoder_drain_output_queue (GstH264Decoder * self, guint num)
   GstH264DecoderPrivate *priv = self->priv;
   GstH264DecoderClass *klass = GST_H264_DECODER_GET_CLASS (self);
 
+  g_assert (klass->output_picture);
+
   while (gst_queue_array_get_length (priv->output_queue) > num) {
     GstH264DecoderOutputFrame *output_frame = (GstH264DecoderOutputFrame *)
         gst_queue_array_pop_head_struct (priv->output_queue);