Hi,
starting a gstreamer pipeline which encodes h.264 to a file prints out the following lines to terminal:
Framerate set to : 60 at NvxVideoEncoderSetParameterNvMMLiteOpen : Block : BlockType = 4
===== MSENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
===== MSENC blits (mode: 1) into tiled surfaces =====
Once in a while I do not get the last line, that Is I’m getting only:
Framerate set to : 60 at NvxVideoEncoderSetParameterNvMMLiteOpen : Block : BlockType = 4
===== MSENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
as a result I get no file.
what might be the reason, or how can I debug it?
Thanks.
DaneLLL
November 25, 2019, 2:42am
#2
Hi,
You may add prints in gst_omx_video_enc_handle_output_frame() in gst-omx source, to check if encoder outputs h264 stream.
DaneLLL, hi,
I have a callback function that is invoked upon frame recceival down the pipeline and I see that I don’t get any frames.
This phenomenon happens rarely, thus this makes it impossible to catch if I print anything to terminal while encoding multiple channels.
Any suggestions?
DaneLLL
December 6, 2019, 5:00am
#4
Hi,
Please try the following patch for gst-omx:
diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c
index 5d614f3..6af360a 100644
--- a/omx/gstomxvideoenc.c
+++ b/omx/gstomxvideoenc.c
@@ -28,6 +28,7 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
#include "gstomxvideoenc.h"
#include "gstnvivameta_api.h"
@@ -1096,6 +1097,8 @@ gst_omx_video_enc_handle_output_frame (GstOMXVideoEnc * self, GstOMXPort * port,
return flow_ret;
}
+static gint firstAcquire = 0;
+static gint acquireRetry = 0;
static void
gst_omx_video_enc_loop (GstOMXVideoEnc * self)
{
@@ -1109,14 +1112,25 @@ gst_omx_video_enc_loop (GstOMXVideoEnc * self)
klass = GST_OMX_VIDEO_ENC_GET_CLASS (self);
+acquire:
acq_return = gst_omx_port_acquire_buffer (port, &buf);
if (acq_return == GST_OMX_ACQUIRE_BUFFER_ERROR) {
+ g_print("GST_OMX_ACQUIRE_BUFFER_ERROR \n");
goto component_error;
} else if (acq_return == GST_OMX_ACQUIRE_BUFFER_FLUSHING) {
- goto flushing;
+ g_print("GST_OMX_ACQUIRE_BUFFER_FLUSHING \n");
+ if (firstAcquire == 0 && acquireRetry < 5) {
+ acquireRetry++;
+ g_print("Acquire buffer retry - %d \n", acquireRetry);
+ usleep(8000);
+ goto acquire;
+ } else
+ goto flushing;
} else if (acq_return == GST_OMX_ACQUIRE_BUFFER_EOS) {
+ g_print("GST_OMX_ACQUIRE_BUFFER_EOS \n");
goto eos;
}
+ firstAcquire = 1;
if (!gst_pad_has_current_caps (GST_VIDEO_ENCODER_SRC_PAD (self))
|| acq_return == GST_OMX_ACQUIRE_BUFFER_RECONFIGURE) {
We hit a race condition that encoding does not start on r24 releases. Although you use r28.2, it is still worth a try. Please apply it and see if it helps.
DaneLLL, hi,
thanks for the patch, I have added the patch and we’ll start the test to verify that there are no more failures.