This commit is contained in:
Osenberg-Y 2018-09-02 14:50:49 +08:00
commit 4addab5cc0
3 changed files with 25 additions and 12 deletions

View File

@ -252,7 +252,7 @@ MotionIntrinsics Device::GetMotionIntrinsics(bool *ok) const {
return *motion_intrinsics_;
} else {
*ok = false;
LOG(WARNING) << "Motion intrinsics not found";
VLOG(2) << "Motion intrinsics not found";
return {};
}
}
@ -263,7 +263,7 @@ Extrinsics Device::GetMotionExtrinsics(const Stream &from, bool *ok) const {
return motion_from_extrinsics_.at(from);
} catch (const std::out_of_range &e) {
*ok = false;
LOG(WARNING) << "Motion extrinsics from " << from << " not found";
VLOG(2) << "Motion extrinsics from " << from << " not found";
return {};
}
}
@ -580,7 +580,7 @@ void Device::ReadAllInfos() {
VLOG(2) << "Motion extrinsics left to imu: {"
<< GetMotionExtrinsics(Stream::LEFT) << "}";
} else {
LOG(WARNING) << "Motion intrinsics & extrinsics not exist";
VLOG(2) << "Motion intrinsics & extrinsics not exist";
}
}

View File

@ -50,9 +50,9 @@ bool unpack_stereo_img_data(
// << ", checksum=0x" << std::hex << static_cast<int>(img_packet.checksum);
if (img_packet.header != 0x3B) {
LOG(WARNING) << "Image packet header must be 0x3B, but 0x" << std::hex
<< std::uppercase << std::setw(2) << std::setfill('0')
<< static_cast<int>(img_packet.header) << " now";
VLOG(2) << "Image packet header must be 0x3B, but 0x" << std::hex
<< std::uppercase << std::setw(2) << std::setfill('0')
<< static_cast<int>(img_packet.header) << " now";
return false;
}
@ -61,11 +61,11 @@ bool unpack_stereo_img_data(
checksum = (checksum ^ packet[i]);
}
if (img_packet.checksum != checksum) {
LOG(WARNING) << "Image packet checksum should be 0x" << std::hex
<< std::uppercase << std::setw(2) << std::setfill('0')
<< static_cast<int>(img_packet.checksum) << ", but 0x"
<< std::setw(2) << std::setfill('0')
<< static_cast<int>(checksum) << " now";
VLOG(2) << "Image packet checksum should be 0x" << std::hex
<< std::uppercase << std::setw(2) << std::setfill('0')
<< static_cast<int>(img_packet.checksum) << ", but 0x"
<< std::setw(2) << std::setfill('0') << static_cast<int>(checksum)
<< " now";
return false;
}
@ -160,7 +160,7 @@ bool Streams::PushStream(const Capabilities &capability, const void *data) {
} else {
// discard left
DiscardStreamData(Stream::LEFT);
LOG(WARNING) << "Image packet is unaccepted, frame dropped";
VLOG(2) << "Image packet is unaccepted, frame dropped";
pushed = false;
}
} break;

View File

@ -41,6 +41,10 @@ namespace uvc {
LOG(severity) << str << " error " << errno << ", " << strerror(errno); \
} while (0)
#define NO_DATA_MAX_COUNT 200
int no_data_count = 0;
/*
class device_error : public std::exception {
public:
@ -194,6 +198,7 @@ struct device {
~device() {
VLOG(2) << __func__;
stop_streaming();
no_data_count = 0;
if (fd != -1 && close(fd) < 0) {
LOG_ERROR(WARNING, "close");
}
@ -386,6 +391,14 @@ struct device {
throw_error("VIDIOC_QBUF");
});
}
no_data_count = 0;
} else {
no_data_count++;
}
if (no_data_count > NO_DATA_MAX_COUNT) {
throw_error("v4l2 get stream time out!");
}
}