Skip to content

Commit

Permalink
fixed mobu udp packet id issue
Browse files Browse the repository at this point in the history
  • Loading branch information
peeld committed Nov 7, 2022
1 parent 192105c commit 0f1f357
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion plugins/mobu/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ bool Open3D_Device::FBCreate()
mSamplingRate = lPeriod.GetFrame();

mFrameCounter = 0;
mIdSeq = 0;
return true;
}

Expand Down Expand Up @@ -416,7 +417,7 @@ void Open3D_Device::DeviceIONotify(kDeviceIOs pAction, FBDeviceNotifyInfo &pDev
UdpFragmenter frag(buf.data(), bucketSize, 512);
for (int i = 0; i < frag.mFrames; i++)
{
frag.makeFragment(0, i, fragData);
frag.makeFragment(mIdSeq++, i, fragData);
sentSz+= sendto(mNetworkSocket, fragData.data(), fragData.size(), 0,
(struct sockaddr*)&dest_addr,
(int)sizeof(struct sockaddr_in));
Expand Down
1 change: 1 addition & 0 deletions plugins/mobu/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class Open3D_Device : public FBDevice
int mNetworkPort;
bool mStreaming;
int mFrameCounter;
uint32_t mIdSeq;

};

Expand Down
6 changes: 4 additions & 2 deletions src/o3ds/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,14 +428,14 @@ namespace O3DS
return outbuf.size();
}

void SubjectList::Parse(const char *data, size_t len, TransformBuilder *builder)
bool SubjectList::Parse(const char *data, size_t len, TransformBuilder *builder)
{
std::uint32_t crc = CRC::Calculate(data+4, len-4, CRC::CRC_32());

std::uint32_t* check = (std::uint32_t*)data;

if (crc != *check)
return;
return false;

auto root = GetSubjectList(data + 4);

Expand Down Expand Up @@ -466,6 +466,8 @@ namespace O3DS

for (auto subject : this->mItems)
subject->CalcMatrices();

return true;
}

void SubjectList::ParseSubject(const O3DS::Data::Subject *inSubject, TransformBuilder *builder)
Expand Down
2 changes: 1 addition & 1 deletion src/o3ds/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ namespace O3DS
int SerializeUpdate(std::vector<char>& outbuf, double timestamp = 0.0);

//! Populate or update the subject list with the binary data provided (created by Serialize)
void Parse(const char *data, size_t len, TransformBuilder* = nullptr);
bool Parse(const char *data, size_t len, TransformBuilder* = nullptr);

void ParseSubject(const O3DS::Data::Subject*, TransformBuilder* = nullptr);

Expand Down
4 changes: 2 additions & 2 deletions src/o3ds/o3ds.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@


#define O3DS_VERSION_MAJOR 0
#define O3DS_VERSION_MINOR 19
#define O3DS_VERSION "0.19"
#define O3DS_VERSION_MINOR 20
#define O3DS_VERSION "0.20"

namespace O3DS
{
Expand Down

0 comments on commit 0f1f357

Please sign in to comment.