mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-19 20:46:22 +00:00
svtav1enc: Don't segfault on not-negotiated
Don't drain on finish if we didn't configure the encoder. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5517>
This commit is contained in:
parent
d0b587eb15
commit
0a29654d7b
1 changed files with 10 additions and 2 deletions
|
@ -838,6 +838,8 @@ gst_svtav1enc_send_eos (GstSvtAv1Enc * svtav1enc)
|
||||||
input_buffer.p_buffer = NULL;
|
input_buffer.p_buffer = NULL;
|
||||||
input_buffer.metadata = NULL;
|
input_buffer.metadata = NULL;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (svtav1enc, "send eos");
|
||||||
|
|
||||||
ret = svt_av1_enc_send_picture (svtav1enc->svt_encoder, &input_buffer);
|
ret = svt_av1_enc_send_picture (svtav1enc->svt_encoder, &input_buffer);
|
||||||
|
|
||||||
if (ret != EB_ErrorNone) {
|
if (ret != EB_ErrorNone) {
|
||||||
|
@ -867,6 +869,8 @@ gst_svtav1enc_dequeue_encoded_frames (GstSvtAv1Enc * svtav1enc,
|
||||||
EbErrorType res = EB_ErrorNone;
|
EbErrorType res = EB_ErrorNone;
|
||||||
gboolean encode_at_eos = FALSE;
|
gboolean encode_at_eos = FALSE;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (svtav1enc, "dequeue encoded frames");
|
||||||
|
|
||||||
do {
|
do {
|
||||||
GstVideoCodecFrame *frame = NULL;
|
GstVideoCodecFrame *frame = NULL;
|
||||||
EbBufferHeaderType *output_buf = NULL;
|
EbBufferHeaderType *output_buf = NULL;
|
||||||
|
@ -1049,13 +1053,17 @@ gst_svtav1enc_handle_frame (GstVideoEncoder * encoder,
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_svtav1enc_finish (GstVideoEncoder * encoder)
|
gst_svtav1enc_finish (GstVideoEncoder * encoder)
|
||||||
{
|
{
|
||||||
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
GstSvtAv1Enc *svtav1enc = GST_SVTAV1ENC (encoder);
|
GstSvtAv1Enc *svtav1enc = GST_SVTAV1ENC (encoder);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (svtav1enc, "finish");
|
GST_DEBUG_OBJECT (svtav1enc, "finish");
|
||||||
|
|
||||||
gst_svtav1enc_send_eos (svtav1enc);
|
if (svtav1enc->state) {
|
||||||
|
gst_svtav1enc_send_eos (svtav1enc);
|
||||||
|
ret = gst_svtav1enc_dequeue_encoded_frames (svtav1enc, TRUE, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
return gst_svtav1enc_dequeue_encoded_frames (svtav1enc, TRUE, TRUE);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
Loading…
Reference in a new issue