Update to version 2
This commit is contained in:
@@ -249,10 +249,12 @@ DataRecord::ReadStatus RawDataRecord::getData(streambuf &buf, int size,
|
||||
_startTime = timestampToTime(_header.samplingTime);
|
||||
|
||||
if ( _header.samplingFrequencyDenominator > 0 &&
|
||||
_header.samplingFrequencyNumerator > 0 )
|
||||
_header.samplingFrequencyNumerator > 0 ) {
|
||||
_endTime = _startTime + samplesToTimeSpan(_header, sampleCount);
|
||||
else
|
||||
}
|
||||
else {
|
||||
_endTime = Time();
|
||||
}
|
||||
|
||||
if ( (start.valid() || end.valid()) && _endTime.valid() ) {
|
||||
// Out of bounds?
|
||||
@@ -265,15 +267,16 @@ DataRecord::ReadStatus RawDataRecord::getData(streambuf &buf, int size,
|
||||
// Trim packet front
|
||||
if ( _startTime < start ) {
|
||||
TimeSpan ofs = start - _startTime;
|
||||
sampleOfs = timeSpanToSamplesCeil(_header, ofs);
|
||||
sampleOfs = timeSpanToSamplesFloor(_header, ofs);
|
||||
sampleCount -= sampleOfs;
|
||||
CAPS_DEBUG("Triming packet start: added offset of %d samples", sampleOfs);
|
||||
_startTime += samplesToTimeSpan(_header, sampleOfs);
|
||||
// Update header timespan
|
||||
timeToTimestamp(_header.samplingTime, _startTime);
|
||||
}
|
||||
else
|
||||
else {
|
||||
sampleOfs = 0;
|
||||
}
|
||||
|
||||
if ( maxBytes > 0 ) {
|
||||
int maxSamples = maxBytes / dataTypeSize;
|
||||
@@ -296,10 +299,13 @@ DataRecord::ReadStatus RawDataRecord::getData(streambuf &buf, int size,
|
||||
CAPS_DEBUG("Triming packet end: added offset of %d samples", trimEnd);
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
sampleOfs = 0;
|
||||
}
|
||||
|
||||
if ( sampleCount == 0 ) return RS_Error;
|
||||
if ( sampleCount == 0 ) {
|
||||
return RS_Error;
|
||||
}
|
||||
|
||||
_currentHeader = _header;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user