GitLab will be upgraded on June 23th evening. During the upgrade the service will be unavailable, sorry for the inconvenience.

Commit a937de9e authored by Alejandro Homs Puron's avatar Alejandro Homs Puron

[WIP]

parent a529ddae
Pipeline #46277 failed with stages
in 10 minutes and 57 seconds
......@@ -249,7 +249,7 @@ private:
void removeSharedMem();
void createReceivers();
void assemblePackets(DetFrameImagePackets&& det_frame_packets);
void assemblePackets(DetFrameImagePackets det_frame_packets);
bool checkLostPackets();
FrameType getLastReceivedFrame();
......
......@@ -85,7 +85,7 @@ public:
void setCPUAffinity(const RecvCPUAffinity& recv_affinity);
ImagePackets *readImagePackets();
AutoPtr<ImagePackets> readImagePackets();
void fillBadFrame(char *buf);
......
......@@ -73,7 +73,7 @@ public:
virtual void prepare();
void addFramePackets(DetFrameImagePackets&& det_frame_packets);
void addFramePackets(DetFrameImagePackets det_frame_packets);
Data getRawData(Data& data);
......
......@@ -262,17 +262,19 @@ DetFrameImagePackets Camera::AcqThread::readRecvPackets(FrameType frame)
DetImagePackets& det_packets = det_frame_packets.second;
FramePacketMap::iterator it = m_frame_packet_map.find(frame);
if (it != m_frame_packet_map.end()) {
det_packets = std::move(det_packets);
det_packets = std::move(it->second);
m_frame_packet_map.erase(it);
}
auto stopped = [&]() { return (m_cam->getAcqState() == StopReq); };
const int marge = 10;
int nb_recvs = m_cam->getNbRecvs();
for (int i = 0; i < nb_recvs; ++i) {
while ((det_packets.find(i) == det_packets.end()) &&
!stopped()) {
Receiver::ImagePackets *image_packets;
AutoPtr<Receiver::ImagePackets> image_packets;
Receiver *recv = m_cam->m_recv_list[i];
image_packets = recv->readImagePackets();
if (!image_packets)
......@@ -281,10 +283,13 @@ DetFrameImagePackets Camera::AcqThread::readRecvPackets(FrameType frame)
FrameType f = image_packets->frame;
if (f == frame) {
det_packets.emplace(MapEntry(i, image_packets));
break;
} else if (f < frame) {
continue;
} else {
DetImagePackets& other = m_frame_packet_map[f];
other.emplace(MapEntry(i, image_packets));
if (f > frame + marge)
break;
}
}
}
......@@ -996,7 +1001,7 @@ Camera::DetStatus Camera::getDetTrigStatus()
return trig_status;
}
void Camera::assemblePackets(DetFrameImagePackets&& det_frame_packets)
void Camera::assemblePackets(DetFrameImagePackets det_frame_packets)
{
DEB_MEMBER_FUNCT();
......@@ -1011,10 +1016,8 @@ void Camera::assemblePackets(DetFrameImagePackets&& det_frame_packets)
int nb_recvs = getNbRecvs();
for (int i = 0; i < nb_recvs; ++i) {
bool ok = false;
if (det_packets[i]) {
if (det_packets[i])
ok = det_packets[i]->assemble(bptr);
det_packets[i].free();
}
if (!ok)
m_recv_list[i]->fillBadFrame(bptr);
}
......
......@@ -34,6 +34,14 @@ struct RecvImagePackets : public Receiver::ImagePackets {
friend class Receiver;
using Receiver::ImagePackets::ImagePackets;
AnyPacketBlockList blocks;
~RecvImagePackets() {
int remaining = 0;
for (auto &b : blocks)
std::visit([&](auto &b) { if (b) ++remaining; }, b);
if (remaining)
std::cout << "~RecvImagePackets: remaining "
<< remaining << " packet blocks" << std::endl;
}
};
inline
......@@ -153,7 +161,7 @@ AutoPtr<Receiver::ImagePackets> Receiver::readSkippableImagePackets()
return image_data;
}
Receiver::ImagePackets *Receiver::readImagePackets()
AutoPtr<Receiver::ImagePackets> Receiver::readImagePackets()
{
DEB_MEMBER_FUNCT();
......@@ -216,7 +224,7 @@ Receiver::ImagePackets *Receiver::readImagePackets()
m_stats.stats.cb_exec.add(t1 - t0);
m_stats.last_t1 = t1;
return image_data.forget();
return image_data;
}
bool Receiver::asmImagePackets(ImagePackets *image_data, char *buffer)
......
......@@ -157,7 +157,7 @@ void Reconstruction::cleanUp()
m_frame_packet_map.clear();
}
void Reconstruction::addFramePackets(DetFrameImagePackets&& det_frame_packets)
void Reconstruction::addFramePackets(DetFrameImagePackets det_frame_packets)
{
DEB_MEMBER_FUNCT();
AutoMutex l(m_mutex);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment