h264ccextractor,h265ccextractor: Do not resend caps per output buffer
Send caps event only when it's required Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/4281 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8596>
This commit is contained in:
parent
2f2a6e76bc
commit
dba3bdd0cf
@ -96,6 +96,7 @@ struct _GstH264CCExtractor
|
|||||||
gboolean on_eos;
|
gboolean on_eos;
|
||||||
gint fps_n;
|
gint fps_n;
|
||||||
gint fps_d;
|
gint fps_d;
|
||||||
|
gboolean need_negotiate;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define gst_h264_cc_extractor_parent_class parent_class
|
#define gst_h264_cc_extractor_parent_class parent_class
|
||||||
@ -199,6 +200,8 @@ gst_h264_cc_extractor_set_format (GstVideoDecoder * decoder,
|
|||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
|
self->need_negotiate = TRUE;
|
||||||
|
|
||||||
/* Assume caption type is cea708 raw which is common cc type
|
/* Assume caption type is cea708 raw which is common cc type
|
||||||
* embedded in SEI */
|
* embedded in SEI */
|
||||||
if (self->caption_type == GST_VIDEO_CAPTION_TYPE_UNKNOWN)
|
if (self->caption_type == GST_VIDEO_CAPTION_TYPE_UNKNOWN)
|
||||||
@ -225,7 +228,12 @@ static gboolean
|
|||||||
gst_h264_cc_extractor_negotiate (GstVideoDecoder * decoder)
|
gst_h264_cc_extractor_negotiate (GstVideoDecoder * decoder)
|
||||||
{
|
{
|
||||||
GstH264CCExtractor *self = GST_H264_CC_EXTRACTOR (decoder);
|
GstH264CCExtractor *self = GST_H264_CC_EXTRACTOR (decoder);
|
||||||
GstCaps *caps = gst_video_caption_type_to_caps (self->caption_type);
|
GstCaps *caps;
|
||||||
|
|
||||||
|
if (!self->need_negotiate)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
caps = gst_video_caption_type_to_caps (self->caption_type);
|
||||||
|
|
||||||
gst_caps_set_simple (caps,
|
gst_caps_set_simple (caps,
|
||||||
"framerate", GST_TYPE_FRACTION, self->fps_n, self->fps_d, NULL);
|
"framerate", GST_TYPE_FRACTION, self->fps_n, self->fps_d, NULL);
|
||||||
@ -233,6 +241,8 @@ gst_h264_cc_extractor_negotiate (GstVideoDecoder * decoder)
|
|||||||
gst_pad_set_caps (decoder->srcpad, caps);
|
gst_pad_set_caps (decoder->srcpad, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
|
self->need_negotiate = FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,8 +435,10 @@ gst_h264_cc_extractor_output_picture (GstH264Decoder * decoder,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updated)
|
if (updated) {
|
||||||
|
self->need_negotiate = TRUE;
|
||||||
gst_video_decoder_negotiate (videodec);
|
gst_video_decoder_negotiate (videodec);
|
||||||
|
}
|
||||||
|
|
||||||
gst_h264_picture_unref (picture);
|
gst_h264_picture_unref (picture);
|
||||||
|
|
||||||
|
@ -93,6 +93,7 @@ struct _GstH265CCExtractor
|
|||||||
gboolean on_eos;
|
gboolean on_eos;
|
||||||
gint fps_n;
|
gint fps_n;
|
||||||
gint fps_d;
|
gint fps_d;
|
||||||
|
gboolean need_negotiate;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define gst_h265_cc_extractor_parent_class parent_class
|
#define gst_h265_cc_extractor_parent_class parent_class
|
||||||
@ -194,6 +195,8 @@ gst_h265_cc_extractor_set_format (GstVideoDecoder * decoder,
|
|||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
|
self->need_negotiate = TRUE;
|
||||||
|
|
||||||
/* Assume caption type is cea708 raw which is common cc type
|
/* Assume caption type is cea708 raw which is common cc type
|
||||||
* embedded in SEI */
|
* embedded in SEI */
|
||||||
if (self->caption_type == GST_VIDEO_CAPTION_TYPE_UNKNOWN)
|
if (self->caption_type == GST_VIDEO_CAPTION_TYPE_UNKNOWN)
|
||||||
@ -220,7 +223,12 @@ static gboolean
|
|||||||
gst_h265_cc_extractor_negotiate (GstVideoDecoder * decoder)
|
gst_h265_cc_extractor_negotiate (GstVideoDecoder * decoder)
|
||||||
{
|
{
|
||||||
GstH265CCExtractor *self = GST_H265_CC_EXTRACTOR (decoder);
|
GstH265CCExtractor *self = GST_H265_CC_EXTRACTOR (decoder);
|
||||||
GstCaps *caps = gst_video_caption_type_to_caps (self->caption_type);
|
GstCaps *caps;
|
||||||
|
|
||||||
|
if (!self->need_negotiate)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
caps = gst_video_caption_type_to_caps (self->caption_type);
|
||||||
|
|
||||||
gst_caps_set_simple (caps,
|
gst_caps_set_simple (caps,
|
||||||
"framerate", GST_TYPE_FRACTION, self->fps_n, self->fps_d, NULL);
|
"framerate", GST_TYPE_FRACTION, self->fps_n, self->fps_d, NULL);
|
||||||
@ -228,6 +236,8 @@ gst_h265_cc_extractor_negotiate (GstVideoDecoder * decoder)
|
|||||||
gst_pad_set_caps (decoder->srcpad, caps);
|
gst_pad_set_caps (decoder->srcpad, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
|
self->need_negotiate = FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,8 +409,10 @@ gst_h265_cc_extractor_output_picture (GstH265Decoder * decoder,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updated)
|
if (updated) {
|
||||||
|
self->need_negotiate = TRUE;
|
||||||
gst_video_decoder_negotiate (videodec);
|
gst_video_decoder_negotiate (videodec);
|
||||||
|
}
|
||||||
|
|
||||||
gst_h265_picture_unref (picture);
|
gst_h265_picture_unref (picture);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user