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?