omxvideoenc: drop late input frames if QoS is enabled

Make use of the new GstVideoEncoder QoS API to drop late input frames. This may
help a live pipeline to catch up if it's being late and all frames end up
being dropped at the sink.

https://bugzilla.gnome.org/show_bug.cgi?id=792783
This commit is contained in:
Guillaume Desmottes 2017-09-22 16:02:40 +02:00 committed by Tim-Philipp Müller
parent fdf3b39dd4
commit 0c5bbbb6ca

View file

@ -1716,6 +1716,7 @@ gst_omx_video_enc_handle_frame (GstVideoEncoder * encoder,
GstOMXPort *port;
GstOMXBuffer *buf;
OMX_ERRORTYPE err;
GstClockTimeDiff deadline;
self = GST_OMX_VIDEO_ENC (encoder);
@ -1726,6 +1727,16 @@ gst_omx_video_enc_handle_frame (GstVideoEncoder * encoder,
return self->downstream_flow_ret;
}
deadline = gst_video_encoder_get_max_encode_time (encoder, frame);
if (deadline < 0) {
GST_WARNING_OBJECT (self,
"Input frame is too late, dropping (deadline %" GST_TIME_FORMAT ")",
GST_TIME_ARGS (-deadline));
/* Calling finish_frame with frame->output_buffer == NULL will drop it */
return gst_video_encoder_finish_frame (GST_VIDEO_ENCODER (self), frame);
}
if (!self->started) {
if (gst_omx_port_is_flushing (self->enc_out_port)) {
if (!gst_omx_video_enc_enable (self, frame->input_buffer))