gst-launch-1.0 crash on second camera, first works

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

gst-launch-1.0 crash on second camera, first works

1,037 Views
patsandt
Contributor III

I am running on an i.MX6 quad core with kernel = 4.1.18-i.MX6-PD15.3.1. For test purposes, I am kicking off my gst-launch-1.0 script in a slow loop. I've turned debugging on in gst-launch, so I now have additional information:

---- snip ----- This is the tail end of the last loop that worked...

Got EOS from element "pipeline0".

Execution ended after 0:00:01.116792667

Setting pipeline to PAUSED ...

Setting pipeline to READY ...

Setting pipeline to NULL ...

Freeing pipeline ...

i2c close

[ 3564.206865] cam0jpg.sh (11978): drop_caches: 3

             total         used         free       shared      buffers

Mem:       2058504       208148      1850356        16816          856

-/+ buffers:             207292      1851212

Swap:            0            0            0

Setting pipeline to PAUSED ...

i2c open /dev/v4l-subdev7

Pipeline is live and does not need PREROLL ...

Setting pipeline to PLAYING ...

New clock: GstSystemClock

Got EOS from element "pipeline0".

Execution ended after 0:00:00.975751333

Setting pipeline to PAUSED ...

Setting pipeline to READY ...

Setting pipeline to NULL ...

Freeing pipeline ...

i2c close

[ 3568.047934] cam1jpg.sh (11998): drop_caches: 3

------------------------------------- Completed loop 290 ---- Note that free memory is stable at 1.85 GB up to here

Finished

                total              used           free                shared        buffers

Mem:       2058504       208036      1850468        16816          584

-/+ buffers:             207452      1851052

Swap:            0            0            0

Setting pipeline to PAUSED ...

i2c open /dev/v4l-subdev3

Pipeline is live and does not need PREROLL ...

Setting pipeline to PLAYING ...

New clock: GstSystemClock

Got EOS from element "pipeline0".

Execution ended after 0:00:01.142167334

Setting pipeline to PAUSED ...

Setting pipeline to READY ...

Setting pipeline to NULL ...

Freeing pipeline ...

i2c close

[ 3576.338335] cam0jpg.sh (12018): drop_caches: 3

                total              used           free               shared         buffers

Mem:       2058504       207540      1850964        16816          700

-/+ buffers:             206840      1851664

Swap:            0            0            0

Setting pipeline to PAUSED ...

i2c open /dev/v4l-subdev7

Pipeline is live and does not need PREROLL ...

Setting pipeline to PLAYING ...

New clock: GstSystemClock

Caught SIGSEGV                                   --------------- ooops, what happened here? ------------------ see trace:

#0  0x76c726f0 in poll () at ../sysdeps/unix/syscall-template.S:81

#1  0x76d4c7d4 in g_main_context_iterate (priority=<optimized out>, n_fds=2, fds=0x14baae0, timeout=-1, context=0x14a00d0)

#2  0x76d4c7d4 in g_main_context_iterate (context=0x14a00d0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>)

#3  0x76d4cb8c in g_main_loop_run (loop=0x14b7fd0)

#4  0x76ea969c in gst_bus_poll (bus=bus@entry=0x1495c28 [GstBus], events=events@entry=GST_MESSAGE_ANY, timeout=<optimized out>)

#5  0x0000bd98 in event_loop (pipeline=0x14b60a0 [GstPipeline], blocking=blocking@entry=1, do_progress=2127591764,

#6  0x0000ad00 in main (argc=1993405448, argv=0x46d)

Spinning.  Please run 'gdb gst-launch-1.0 12051' to continue debugging, Ctrl-C to quit, or Ctrl-\ to dump core.

------------------------------------- Completed loop 291 ---------------------- Free memory has dropped. first camera still works.

Finished

             total         used         free       shared      buffers

Mem:       2058504       266308      1792196        16820         3244

-/+ buffers:             263064      1795440

Swap:            0            0            0

Setting pipeline to PAUSED ...

i2c open /dev/v4l-subdev3

Pipeline is live and does not need PREROLL ...

Setting pipeline to PLAYING ...

New clock: GstSystemClock

Got EOS from element "pipeline0".

Execution ended after 0:00:01.110108667

Setting pipeline to PAUSED ...

Setting pipeline to READY ...

Setting pipeline to NULL ...

Freeing pipeline ...

------------------ Next try on second camera fails with "v4l2src0: failed to allocate required memory. this continues forever.

Labels (3)
0 Kudos
2 Replies

564 Views
patsandt
Contributor III

Note, not all of the lines in the script are used in the gst-launch command: that is because there are several scripts provided by a contractor and other scripts do use the lines.

cam0jpg.sh:

#!/bin/sh

free
rm /home/root/cam_5d.jpg
########### Configure camera to be used here
CAM_DRIVER="mt9p031"
CAM_I2C_ADRESS='5d'
CAM_I2C_BUS='0'
IPU_VIDEO_NAME="ipu0-csi0-video"
IPU_SD_NAME="ipu0-csi0-sd"
########### End configuration

CAM_ENTITY_NUMBER=`media-ctl -p | grep " $CAM_DRIVER $CAM_I2C_BUS-00$CAM_I2C_ADRESS" | awk '{print $3}'`
CAM_DEVICE=$(media-ctl -e "$CAM_DRIVER $CAM_I2C_BUS-00$CAM_I2C_ADRESS")
IPU_CSI_DEVICE=$(media-ctl -e "$IPU_VIDEO_NAME")

if [ "$CAM_ENTITY_NUMBER" = "" ]; then
    echo "camera not found"
    exit 1
fi
    
COL_FORMAT="bayer,format=grbg,depth=8"
BAYER_CONVERT=" bayer2rgb !"
NUMBER_OF_PIC="1"
NORM=""
FRAME_SIZE=",width=2592,height=1944"
FRAME_SIZE_LIVE_DEMO=",width=640,height=480"
REG_SET_FILE="/usr/bin/register-settings-mt9p031-cam0.txt"
SENSOR_RES="2592x1944"
SENSOR_RES_LIVE_DEMO="2560x1920"
GRAB_RES="640x480"
OFFSET_SENSOR="16,54"
CAM_BW_FMT="Y8"
CAM_COL_FMT="SGRBG8"    

media-ctl -r
media-ctl -V ''$CAM_ENTITY_NUMBER'0[fmt:'$CAM_COL_FMT'/'$SENSOR_RES'('$OFFSET_SENSOR')/'$SENSOR_RES']'
media-ctl -V '"'$IPU_SD_NAME'":0[fmt:'$CAM_COL_FMT'/'$SENSOR_RES']'
media-ctl -V '"'$IPU_SD_NAME'":1[fmt:'$CAM_COL_FMT'/'$SENSOR_RES']'

gst-launch-1.0 \
    v4l2src num-buffers=$NUMBER_OF_PIC device=$IPU_CSI_DEVICE $NORM ! \
    i2c file=$REG_SET_FILE show=0 dev=$CAM_DEVICE ! \
    video/x-$COL_FORMAT$FRAME_SIZE !$BAYER_CONVERT \
    videoflip method=rotate-180 ! \
    jpegenc ! filesink location=/home/root/cam_$CAM_I2C_ADRESS.jpg

echo 3 > /proc/sys/vm/drop_caches

---------------------------------------------------

cam1jpg.sh:

#!/bin/sh

free
rm /home/root/cam_48.jpg
########### Configure camera to be used here
CAM_DRIVER="mt9p031"
CAM_I2C_ADRESS='48'
CAM_I2C_BUS='0'
IPU_VIDEO_NAME="ipu1-csi1-video"
IPU_SD_NAME="ipu1-csi1-sd"
########### End configuration

CAM_ENTITY_NUMBER=`media-ctl -p | grep " $CAM_DRIVER $CAM_I2C_BUS-00$CAM_I2C_ADRESS" | awk '{print $3}'`
CAM_DEVICE=$(media-ctl -e "$CAM_DRIVER $CAM_I2C_BUS-00$CAM_I2C_ADRESS")
IPU_CSI_DEVICE=$(media-ctl -e "$IPU_VIDEO_NAME")

if [ "$CAM_ENTITY_NUMBER" = "" ]; then
    echo "camera not found"
    exit 1
fi
    
COL_FORMAT="bayer,format=grbg,depth=8"
BAYER_CONVERT=" bayer2rgb !"
NUMBER_OF_PIC="1"
NORM=""
FRAME_SIZE=",width=2592,height=1944"
FRAME_SIZE_LIVE_DEMO=",width=640,height=480"
REG_SET_FILE="/usr/bin/register-settings-mt9p031-cam1.txt"
SENSOR_RES="2592x1944"
SENSOR_RES_LIVE_DEMO="2560x1920"
GRAB_RES="640x480"
OFFSET_SENSOR="16,54"
CAM_BW_FMT="Y8"
CAM_COL_FMT="SGRBG8"    

media-ctl -r
media-ctl -V ''$CAM_ENTITY_NUMBER'0[fmt:'$CAM_COL_FMT'/'$SENSOR_RES'('$OFFSET_SENSOR')/'$SENSOR_RES']'
media-ctl -V '"'$IPU_SD_NAME'":0[fmt:'$CAM_COL_FMT'/'$SENSOR_RES']'
media-ctl -V '"'$IPU_SD_NAME'":1[fmt:'$CAM_COL_FMT'/'$SENSOR_RES']'

gst-launch-1.0 \
    v4l2src num-buffers=$NUMBER_OF_PIC device=$IPU_CSI_DEVICE $NORM ! \
    i2c file=$REG_SET_FILE show=0 dev=$CAM_DEVICE ! \
    video/x-$COL_FORMAT$FRAME_SIZE !$BAYER_CONVERT \
    jpegenc ! filesink location=/home/root/cam_$CAM_I2C_ADRESS.jpg

echo 3 > /proc/sys/vm/drop_caches

0 Kudos

564 Views
joanxie
NXP TechSupport
NXP TechSupport

pls share with your gstreamer command to check.

0 Kudos