Skip to content
Snippets Groups Projects
Commit 1a29daee authored by Alejandro Lopez Gestoso's avatar Alejandro Lopez Gestoso
Browse files

Added a piece of code to handle smaller than expected image frames. The frame...

Added a piece of code to handle smaller than expected image frames. The frame is lost, but at least the node does not crash.
parent ca856a7a
No related branches found
No related tags found
No related merge requests found
...@@ -167,6 +167,12 @@ void CameraDriver::ImageCallback(uvc_frame_t *frame) { ...@@ -167,6 +167,12 @@ void CameraDriver::ImageCallback(uvc_frame_t *frame) {
timestamp = ros::Time::now(); timestamp = ros::Time::now();
} }
if(frame->data_bytes<frame->step*frame->height)
{
std::cout << "short frame" << std::endl;
return;
}
boost::recursive_mutex::scoped_lock lock(mutex_); boost::recursive_mutex::scoped_lock lock(mutex_);
assert(state_ == kRunning); assert(state_ == kRunning);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment