AM62A7: can not display blue screen while the camera is loss

Part Number: AM62A7

Tool/software:

I have the problem to display while the camera in abnormal mode.

I need to send the blue screen while the camera frame is lost. and need to reset the camera while the camera is reconnect agian.

but the problem is that i can not set the blue screen. and check the reconnect status. can you help me with the problem. thanks very much

 

void InferencePipe::inferenceThread()
{
const uint8_t *frame;
GstWrapperBuffer inputBuff;
GstWrapperBuffer cameraBuff;
TimePoint start;
TimePoint end;
TimePoint prev_frame;
TimePoint curr_frame;
bool first_frame = true;
float diff;
int32_t status;


LOG_INFO("Starting inference thread.\n");

while (m_running)
{
/* Get a new frame. This function blocks until a new frame
* is available from the sensor.
*/
status = m_gstPipe->getBuffer(m_srcElemNames[1], inputBuff,m_config.loop, true);

if (status != 0)
{

if (status != EOS)
{
COMM_PRT("Could not get 'input' buffer from Gstreamer \n");
GstWrapperBuffer ErrorBuff;
m_gstPipe->allocBuffer(ErrorBuff, m_config.inDataWidth, m_config.inDataHeight, "RGB");

uint8_t* blueData = ErrorBuff.getAddr();
for (int i = 0; i < m_config.inDataWidth * m_config.inDataHeight; i++) {
blueData[i * 3] = 0; // R
blueData[i * 3 + 1] = 0; // G
blueData[i * 3 + 2] = 255; // B
}
/* Send the buffer to the output pipeline. */
status = m_gstPipe->putBuffer(m_sinkElemName, ErrorBuff);
if (status != 0)
{
printf("Could not put 'post-processed' buffer to Gstreamer");
}

/* Free the buffer. */
m_gstPipe->freeBuffer(ErrorBuff);
}
}
  • Hi Meng,

    Step 1: Listen for Errors

    Instead of using a blocking getBuffer() call, you should:

    1. Configure the v4l2src element to send a specific error message if it loses the stream. Many drivers will do this automatically.

    2. Add a bus to your pipeline and set up a callback function to listen for messages.

    3. In the callback function, check for Gst.MessageType.ERROR. This message indicates a stream failure.

    Step 2: Switch to the Blue Screen Pipeline

    When an error message is received:

    Method 1:-

    1. Stop the current pipeline by setting its state to GST_STATE_NULL.

    2. Build a new pipeline that uses videotestsrc to generate a blue pattern.

    3. Start the new pipeline by setting its state to GST_STATE_PLAYING. This will immediately display a blue screen on the output.

    Method 2:-

           1. switch between bluescreen and camerafeed whenever the stream fails.

           2. For this use gstreamer element input selector to switch between bluescreen and camerafeed 

    Regards,

    Dilna K