svtav1enc: Fix segfault when flushing

gst_video_encoder_get_oldest_frame() is nullable, and will signal that
all frames are handled by returning NULL.

Fixes #3650

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7249>
This commit is contained in:
Nirbheek Chauhan 2024-07-27 02:18:45 +05:30 committed by Tim-Philipp Müller
parent f04f6f43c3
commit 0bb336f34c

View file

@ -888,8 +888,13 @@ gst_svtav1enc_dequeue_encoded_frames (GstSvtAv1Enc * svtav1enc,
return GST_FLOW_ERROR;
} else if (res != EB_NoErrorEmptyQueue && output_frames && output_buf) {
// AV1 has no frame re-ordering so always get the oldest frame
frame =
gst_video_encoder_get_oldest_frame (GST_VIDEO_ENCODER (svtav1enc));
if (!(frame =
gst_video_encoder_get_oldest_frame (GST_VIDEO_ENCODER
(svtav1enc)))) {
svt_av1_enc_release_out_buffer (&output_buf);
break;
}
if (output_buf->pic_type == EB_AV1_KEY_PICTURE
|| output_buf->pic_type == EB_AV1_INTRA_ONLY_PICTURE) {
GST_VIDEO_CODEC_FRAME_SET_SYNC_POINT (frame);