When the hdmi not be connected, nvdrmvideosink double free happen

Hi, everyone

I run the command bellow when the AGX Orin has no hdmi device connected, and the double free error happen.

sudo gst-launch-1.0 v4l2src device=/dev/video8 ! videoconvert !  nvvidconv ! nvdrmvideosink max-bitrate=16384000 set_mode=0 sync=false

Error outputed:

Setting pipeline to PAUSED ...

Invalid connector id

free(): double free detected in tcache 2

Aborted

In the product situation , I want to use opencv and gstreamer to display the usb camera stream to one hdmi device, but the hdmi device maybe not connected , so I must give consideration to the situation that the hdmi device maybe not connected or unpluged.
When useing opencv, the problem before also happpens. The codes as bellow.

import cv2

g_test = 1
print(cv2.__version__)
cap = cv2.VideoCapture('/dev/video8', cv2.CAP_V4L)

cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 360)
cap.set(cv2.CAP_PROP_FPS, 20)           

cnt = 0
gst_video_writer = " t. ! queue ! videoconvert ! video/x-raw,format=BGRx ! nvvidconv ! nvv4l2h264enc profile=4 bitrate=16384000 ! h264parse ! matroskamux ! filesink location=./test_"+str(cnt)+".avi"
gst_out_hdmi = " t. ! timeoverlay ! textoverlay name=txt0 shaded-background=false valignment=top halignment=right text="+str("Road") +" ! videoconvert ! nvvidconv ! nvdrmvideosink max-bitrate=16384000 set_mode=1 sync=false"
gst_str= "appsrc ! tee name=t "+gst_video_writer+gst_out_hdmi
print(gst_str)
stream = cv2.VideoWriter(gst_str, cv2.CAP_GSTREAMER, 0, 20, (640,360))
stream.set(cv2.VIDEOWRITER_PROP_QUALITY,100)

max_cnt_per_one_video = 20*60

while True:
    ret, frame_read = cap.read()
    cnt = cnt +1 
    print('get frame',frame_read.shape,cnt)
    stream.write(frame_read)
    print('writen frame',frame_read.shape,cnt)
    if (cnt % (max_cnt_per_one_video) ==0):
        stream.release()
        gst_str= "appsrc ! tee name=t "+gst_video_writer+gst_out_hdmi
        print("get new str",gst_str)
        stream = cv2.VideoWriter(gst_str, cv2.CAP_GSTREAMER, 0, 20, (640,360))

When I boot the machine with no hdmi device connected , the progrom goes to error, it shows “double free detected in tcache 2”.
If I boot the machine with one hdmi device, it will ok, even if I unplug the hdmi device.


Invalid connector id

double free or corruption (fasttop)

Aborted (core dumped)

Could anybody help to solve it?

Hi,
Do you use a custom board? On Orin developer kit, there is only DP port. Seems liek you use a custom board which has HDMI out.

What is DP port ?
Is not nvdrmvideosink designed for hdmi displayer?

I baught AGX from one local vendor of China, called TwoWin.

Hi,do you know how to solve the problem? If I don’t use hdmi, instead, I use DP port,will this problem not happen?

BTW,I read the data sheet of NVIDIA Jetson AGX Orin Series, and find it has 1x HDMI and DP port. So I think it is not the reason.

5.9 Display Interfaces
The NVIDIA Jetson AGX Orin SOM provides 1x HDMI and DP port. The HDMI™ and VESA
DisplayPort (DP) interfaces share the same set of interface pins.
HDMI provides a unified method of transferring both audio and video data. The HDMI block
receives video from either display controller and audio from a separate high-definition audio
(HDA) controller; it combines and transmits them as appropriate. 

Hi,
It seems to be an invalid use-case if you use nvdrmvideosink without HDMI or DP out. Please save to a file in cv2.VideoWriter(). May check this sample for saving to a file:
Displaying to the screen with OpenCV and GStreamer - #9 by DaneLLL

It has no problem to save the stream to local file, but I need to display the stream to the hdmi display device.

I use nvoverlaysink in Xavier NX currently (it has no problem), now my company decides to upgrade the edge host from Xavier NX to AGX Orin in our solutions for the higher computing capability, so I am doing python source adaptation for AGX Orin, because AGX Orin not support nvoverlaysink, then I change the nvoverlaysink to nvdrmvideosink.

I think use nvdrmvideosink when the hdmi display device has not been plugged is normal, because some end-users may forget to plug the hdmi screen or the hdmi may got broken before starting the programmer.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.