In zm_ffmpeg_camera.cpp at line 215, we know we have a problem. "Unable to read packet from stream". The Capture function returns a -1.
At this point, I think the zmc should terminate and reconnect the failed stream. But it doesn't. It just repeats the error until the log drive fills up.
So, zmc is calling FfmpegCamera from where? Is it zm_monitor.cpp (2344) instantiating "Camera *camera = new FfmpegCamera"? Where is this referenced in zmc.cpp?
At some point, the failure return-code is getting lost on it's way to the zmc. I think this is the heart of the problem.
If zmc would signal -1 and restart, the stream would come back up. I manually did this from the command line and it worked.
Point is, I'm new to this code. Could someone give me some hints here to get moving? I'm going cross-eyed from spending so many hours trying to learn the code structure.
I see this in zmc.cpp (265) that looks like it should dump here, but it never happens.
if ( monitors->Capture() < 0 )
{
Error( "Failed to capture image from monitor %d (%d/%d)", monitors->Id(), i, n_monitors );
zm_terminate = true;
result = -1;
break;
Request code structure help, re: red image problem
Re: Request code structure help, re: red image problem
Hold on ...
You said: "return code of -1 getting lost"
The code said: "if blah < 0"
Our survey said: What was that I recently read right here in this very forum about going around tidying up SIGNED integers and making them UNSIGNED (which broke something else, select() returning -1 followed by a crash) ...
Is this connected? Take a close look at the return type of everything from your -1 being "known", up to that point. Or, do this sort of thing :-
Then look to see if you get a "255" or a "65535" as a return. That's -1, when you can't minus-anything.
You said: "return code of -1 getting lost"
The code said: "if blah < 0"
Our survey said: What was that I recently read right here in this very forum about going around tidying up SIGNED integers and making them UNSIGNED (which broke something else, select() returning -1 followed by a crash) ...
Is this connected? Take a close look at the return type of everything from your -1 being "known", up to that point. Or, do this sort of thing :-
Code: Select all
tmpvar = monitors[i]->Capture();
// (here, print out tmpvar to anywhere you can, logging, screen, file, anything! -- format it as %d) maybe
Error("MyDebugging: It's %d",tmpvar);
if ( tmpvar < 0 )
{
Error( "Failed to capture image from monitor %d (%d/%d)", monitors[i]->Id(), i, n_monitors );
Re: Request code structure help, re: red image problem
Basildane wrote:In zm_ffmpeg_camera.cpp at line 215, we know we have a problem. "Unable to read packet from stream". The Capture function returns a -1.
At this point, I think the zmc should terminate and reconnect the failed stream. But it doesn't. It just repeats the error until the log drive fills up.
So, zmc is calling FfmpegCamera from where? Is it zm_monitor.cpp (2344) instantiating "Camera *camera = new FfmpegCamera"? Where is this referenced in zmc.cpp?
At some point, the failure return-code is getting lost on it's way to the zmc. I think this is the heart of the problem.
If zmc would signal -1 and restart, the stream would come back up. I manually did this from the command line and it worked.
Point is, I'm new to this code. Could someone give me some hints here to get moving? I'm going cross-eyed from spending so many hours trying to learn the code structure.
I see this in zmc.cpp (265) that looks like it should dump here, but it never happens.
if ( monitors->Capture() < 0 )
{
Error( "Failed to capture image from monitor %d (%d/%d)", monitors->Id(), i, n_monitors );
zm_terminate = true;
result = -1;
break;
I wonder the problem is inside the zm_monitor.cpp Monitor::Capture()
int Monitor::Capture()
{
static int FirstCapture = 1;
int captureResult;
int index = image_count%image_buffer_count;
Image* capture_image = image_buffer[index].image;
if ( (deinterlacing & 0xff) == 4) {
if ( FirstCapture != 1 ) {
/* Copy the next image into the shared memory */
capture_image->CopyBuffer(*(next_buffer.image));
}
/* Capture a new next image */
captureResult = camera->Capture(*(next_buffer.image));
if ( FirstCapture ) {
FirstCapture = 0;
return 0;
}
} else {
/* Capture directly into image buffer, avoiding the need to memcpy() */
captureResult = camera->Capture(*capture_image);
}
if ( captureResult != 0 )
{
// Unable to capture image for temporary reason
// Fake a signal loss image
capture_image->Fill( signal_check_colour );
captureResult = 0;
} else {
captureResult = 1;
}
The captureResult is override here and never signal back to zmc.