Commit 59bb107d by yiannis

Extended the lookahead distance for channel resyncing.

When resyncing channels, the code advances a byte at a time, versus 4 bytes, which
caused problems when the frame marker was skipped.
parent ab708285
...@@ -376,7 +376,7 @@ CDaqLowLevelIo::ResyncChannel( ...@@ -376,7 +376,7 @@ CDaqLowLevelIo::ResyncChannel(
int startingOffset = ftell(m_pFile); int startingOffset = ftell(m_pFile);
skip = 0; skip = 0;
while ( !feof(m_pFile) && tries++ < 30) { while ( !feof(m_pFile) && tries++ < cMaxChannResyncLookahead) {
int mostRecentGoodOfs; int mostRecentGoodOfs;
mostRecentGoodOfs = ftell(m_pFile); mostRecentGoodOfs = ftell(m_pFile);
...@@ -422,7 +422,8 @@ CDaqLowLevelIo::ResyncChannel( ...@@ -422,7 +422,8 @@ CDaqLowLevelIo::ResyncChannel(
fseek(m_pFile, 4, SEEK_CUR); fseek(m_pFile, 4, SEEK_CUR);
} }
else { else {
// can't do much, next iteration of the loop will read the next integer fseek(m_pFile, -3, SEEK_CUR);
skip++;
} }
} }
...@@ -1623,7 +1624,7 @@ CDaqLowLevelIo::GetFullData( ...@@ -1623,7 +1624,7 @@ CDaqLowLevelIo::GetFullData(
frm2 = GetLastFrame(); frm2 = GetLastFrame();
} }
else { else {
frm2 += GetLastFrame(); frm2 += GetFirstFrame();
int triesLeft = 32; int triesLeft = 32;
while ( m_Toc.find(frm2) == m_Toc.end() && triesLeft-- > 0 ) frm2--; while ( m_Toc.find(frm2) == m_Toc.end() && triesLeft-- > 0 ) frm2--;
} }
......
...@@ -25,6 +25,7 @@ typedef vector<CDaqChannelInfo> TChanInfoVec; ...@@ -25,6 +25,7 @@ typedef vector<CDaqChannelInfo> TChanInfoVec;
const int cMaxDaqRec = 128*1024; ///< maximum size of data per DAQ record const int cMaxDaqRec = 128*1024; ///< maximum size of data per DAQ record
const int cMaxChannels = 500; ///< maximum number of channels we can handle const int cMaxChannels = 500; ///< maximum number of channels we can handle
const int cMaxChannResyncLookahead = 2*1024;
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
/// ///
......
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