fixes for vl_multi_buffer parsing when column is NULL

fix in debug output for local cameras causing a segfault
This commit is contained in:
Isaac Connor 2014-09-08 15:20:35 -04:00
parent 6aa1798293
commit 9a3b685016
2 changed files with 13 additions and 24 deletions

View File

@ -782,6 +782,7 @@ void LocalCamera::Initialise()
memset( &v4l2_data.reqbufs, 0, sizeof(v4l2_data.reqbufs) );
if ( channel_count > 1 ) {
Debug( 3, "Channel count is %d", channel_count );
if ( v4l_multi_buffer ){
v4l2_data.reqbufs.count = 2*channel_count;
} else {
@ -790,6 +791,7 @@ void LocalCamera::Initialise()
} else {
v4l2_data.reqbufs.count = 8;
}
Debug( 3, "Request buffers count is %d", v4l2_data.reqbufs.count );
v4l2_data.reqbufs.type = v4l2_data.fmt.type;
v4l2_data.reqbufs.memory = V4L2_MEMORY_MMAP;
@ -809,7 +811,7 @@ void LocalCamera::Initialise()
if ( v4l2_data.reqbufs.count < (v4l_multi_buffer?2:1) )
Fatal( "Insufficient buffer memory %d on video device", v4l2_data.reqbufs.count );
Debug( 3, "Setting up data buffers: Channels %d MultiBuffer %d Buffers: %s", channel_count, v4l_multi_buffer, v4l2_data.reqbufs.count );
Debug( 3, "Setting up data buffers: Channels %d MultiBuffer %d Buffers: %d", channel_count, v4l_multi_buffer, v4l2_data.reqbufs.count );
v4l2_data.buffers = new V4L2MappedBuffer[v4l2_data.reqbufs.count];
#if HAVE_LIBSWSCALE

View File

@ -1872,37 +1872,24 @@ int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose
int channel = atoi(dbrow[col]); col++;
int format = atoi(dbrow[col]); col++;
bool v4l_multi_buffer;
//Error( "Got %s for v4l_multi_vuffer", dbrow[col] );
if (*dbrow[col] == '0' ) {
//Error( "setting false for v4l_multi_vuffer" );
v4l_multi_buffer = false;
} else if ( *dbrow[col] == '1' ) {
//Error( "setting true for v4l_multi_vuffer" );
v4l_multi_buffer = true;
if ( dbrow[col] ) {
if (*dbrow[col] == '0' ) {
v4l_multi_buffer = false;
} else if ( *dbrow[col] == '1' ) {
v4l_multi_buffer = true;
}
} else {
//Error( "setting config for v4l_multi_vuffer" );
v4l_multi_buffer = config.v4l_multi_buffer;
}
if ( v4l_multi_buffer ) {
//Error( "Got true for v4l_multi_vuffer" );
} else {
//Error( "Got false for v4l_multi_vuffer" );
}
col++;
int v4l_captures_per_frame = 0;
//Error( "Got %s for v4l_captures", dbrow[col] );
if ( ! dbrow[col] ) {
//Error( "Got nothing for v4l_captures" );
} else if ( * dbrow[col] == '\0' ) {
//Error( "setting to config for v4l_captures " );
v4l_captures_per_frame = config.captures_per_frame;
} else {
//Error( "setting from MOnitor for v4l_captures " );
if ( dbrow[col] ) {
v4l_captures_per_frame = atoi(dbrow[col]);
} else {
v4l_captures_per_frame = config.captures_per_frame;
}
Error( "Got %d for v4l_captures", v4l_captures_per_frame );
Debug( 1, "Got %d for v4l_captures_per_frame", v4l_captures_per_frame );
col++;
const char *method = dbrow[col]; col++;