What is wrong in memory allocation?

Forum for questions and support relating to the 1.27.x releases only.
Locked
sipi
Posts: 132
Joined: Wed Feb 14, 2007 5:18 pm

What is wrong in memory allocation?

Post by sipi »

I use some analogue cameras 768x576 and 704x576 resolution and gray scale or color.

When I use Axis 240Q video server to connect my analogue cameras to ZM 1.27 and I try run EyeZM on my iPhone to view these cameras (768x576 color) live stream I get an error message in log:

2014-07-31 16:53:20.218785 zms 20230 ERR Attempt to directly assign buffer from an undersized buffer of size: 222312 /usr/src/packages/BUILD/ZoneMinder-1.27.0/src/zm_image.cpp 340

This message is recorded continuously in the log while EyeZM shows live stream. It isn't EyeZNM problem because EyeZM uses ZM 1.27 memory allocation (mmap), doesn't use its own memory allocation. The log shows the problem in zm source code.

When I try to view other analog camera live pictures (704x576 gray scale) then live stream doesn't loading and I have an same error message in the log.

What happened? I know that someone rewrote the memory management but has nobody tried it on analogue camera?

Please help me, how can I fix it? Thanks.
linuxsense
Posts: 374
Joined: Wed Nov 07, 2007 1:59 am
Location: Huntington Beach, California
Contact:

Re: What is wrong in memory allocation?

Post by linuxsense »

What are the details of the cameras configs on the zoneminder side?
sipi
Posts: 132
Joined: Wed Feb 14, 2007 5:18 pm

Re: What is wrong in memory allocation?

Post by sipi »

Thank you for your interest I hope that you can help me.

I use cams with two mode. First is 704x576 px resolution and grey scale color space. I can't view this cam's live stream in EyeZM because there is an memory allocation problem. This is the error message:

2014-08-02 15:58:21.855645 zms 14710 ERR Got signal 6 (Aborted), crashing /usr/src/packages/BUILD/ZoneMinder-1.27.0/src/zm_signal.cpp 54
2014-08-02 15:58:21.819797 zms 14710 ERR Attempt to directly assign buffer from an undersized buffer of size: 74104 /usr/src/packages/BUILD/ZoneMinder-1.27.0/src/zm_image.cpp 340

General
Source Type Remote
Function Modect
Enabled Yes
Maximum FPS 5
Alarm Maximum FPS 5

Source
Remote Protocol HTTP
Remote Method Simple
Remote Host Name user:pwd@192.168.1.41
Remote Host Port 80
Remote Host Path /axis-cgi/jpg/image.cgi?camera=1
Target Colorspace 8 bit greyscale
Capture Width (pixels) 704
Capture Height (pixels) 576
Preserve Aspect Ratio
Orientation Normal
Deinterlacing Disable

Buffers
Image Buffer Size (frames) 50
Warmup Frames 25
Pre Event Image Count 25
Post Event Image Count 25
Stream Replay Image Buffer 1000
Alarm Frame Count 1

Second is 768x576 px resolution and 24 color space. I can view this cam's live stream but zm continuously writes error message to the log. This is the message:

2014-07-31 16:53:20.218785 zms 20230 ERR Attempt to directly assign buffer from an undersized buffer of size: 222312 /usr/src/packages/BUILD/ZoneMinder-1.27.0/src/zm_image.cpp 340


General
Source Type Remote
Function Modect
Enabled Yes
Maximum FPS 5
Alarm Maximum FPS 5

Source
Remote Protocol HTTP
Remote Method Simple
Remote Host Name user:pwd@192.168.1.41
Remote Host Port 80
Remote Host Path /axis-cgi/jpg/image.cgi?camera=2
Target Colorspace 24 bit color
Capture Width (pixels) 768
Capture Height (pixels) 576
Preserve Aspect Ratio
Orientation Normal
Deinterlacing Disable

Buffers
Image Buffer Size (frames) 50
Warmup Frames 25
Pre Event Image Count 25
Post Event Image Count 25
Stream Replay Image Buffer 1000
Alarm Frame Count 1

But I think it isn't depend from resolution because I changed color space to greyscale and I can't view neither cam's live stream... I tried to change Remote Host Path to /axis-cgi/mjpg/video.cgi?camera=1 and /axis-cgi/mjpg/video.cgi?camera=2 but nothing changed.

This Axis 240Q only uses jpeg and mjpeg images, can't stream h264 and its resolution are 352x288, 704x576 and 768x576 px can't use 640x480 px.


I use it on any resolution if Colorspace is grayscale then I won't view the live stream and I have error message in the log. But if Colorspace is 24 bit color then I can view live stream but I have error message in the log. I'm sure that there is an bug in the memory management when user has analogue cam resolution (non-VGA and same) with grayscale or 24 bit colour Colorspace.

Thanks.
linuxsense
Posts: 374
Joined: Wed Nov 07, 2007 1:59 am
Location: Huntington Beach, California
Contact:

Re: What is wrong in memory allocation?

Post by linuxsense »

I am not sure if I am looking at the doc for the same device that you have but it states the maximum resolution to be 704x576 so that might be an issue on the 2nd camera. Have you tried removing the min/max FPS settings on the ZM side? Those settings are for locally connected analog cameras and shouldn't be used for network cams.
linuxsense
Posts: 374
Joined: Wed Nov 07, 2007 1:59 am
Location: Huntington Beach, California
Contact:

Re: What is wrong in memory allocation?

Post by linuxsense »

One more thought: Are you using the latest firmware on the Axis?
sipi
Posts: 132
Joined: Wed Feb 14, 2007 5:18 pm

Re: What is wrong in memory allocation?

Post by sipi »

Of course, I use latest firmware but Axis didn't release new firmware to 240Q video server for a long time ago.

But I think that the problem is memory allocation in zm. ZM checks the memory allocation depend resolution and picture size and compare it to octal numbering and if it isn't equal it send an error message. This video server can't use a fitting picture size to octal numbering because it can use only analogue resolution max. D1 (704x576) picture size, but it can modify the picture size to 4/3 aspect (768x576).

I think the problem is this check or memory allocation for analogue cams (resolution).

Sorry my English but I hope you can understand me.
linuxsense
Posts: 374
Joined: Wed Nov 07, 2007 1:59 am
Location: Huntington Beach, California
Contact:

Re: What is wrong in memory allocation?

Post by linuxsense »

As a testing option it might be interesting to run my virtual machine (use virtualbox) and see if it has the same issues. It would let you know if the issue is with your setup or version of zoneminder.

You can get it here: http://linuxtracker.org/index.php?page= ... ccd9e80fb2
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: What is wrong in memory allocation?

Post by knight-of-ni »

I have four cameras attached to an Axis 241Q and have never had any problems. Your resolution seems weird, but maybe that is because you are using PAL instead of NTSC?

Anyhow, here is what I use for the remote host path:
/axis-cgi/mjpg/video.cgi?fps=5&camera=4&resolution=704x480
Notice how I am setting the resolution and frame rate in the url. Set yours accordingly.

Make sure and leave the Max fps and Alarm Max fps fields blank in zoneminder as they do not work correctly for IP cameras (which is what you have since you are using a video encoder).
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
sipi
Posts: 132
Joined: Wed Feb 14, 2007 5:18 pm

Re: What is wrong in memory allocation?

Post by sipi »

Hi!
Your resolution seems weird, but maybe that is because you are using PAL instead of NTSC?
Yes, I use PAL tv standard.

I tested /jpg/image.cgi and /mjpeg/video.cgi streams but each of which there is a memory allocation failure. If I change Max. FPS and/or Alarm Max FPS nothing won't change.

Can you view live stream of one of cameras of Axis 241Q on EyeZM?
sipi
Posts: 132
Joined: Wed Feb 14, 2007 5:18 pm

Re: What is wrong in memory allocation?

Post by sipi »

I installed centos 6.5 x86_64 and zm 1.27 on an "unused" PC that I can test the memory allocation trouble on other OS. I tested it an analog ProVideo PV149 card and an Axis 240Q video server.

I have a bad news: zm and EyeZM can't work properly on centos too if I use analog cam resolution (704x576, 352x288, 176x144). The trouble same as on OpenSuSE (memory allocation)...

Is there an developer who knows zm_image.cpp and other source file?

Thanks.
Locked