namespace pv {
namespace data {
-const uint64_t Segment::MaxChunkSize = 10*1024*1024; /* 10MiB */
+const uint64_t Segment::MaxChunkSize = 10 * 1024 * 1024; /* 10MiB */
Segment::Segment(uint64_t samplerate, unsigned int unit_size) :
sample_count_(0),
// There will always be space for at least one sample in
// the current chunk, so we do not need to test for space
- memcpy(current_chunk_ + (used_samples_ * unit_size_),
- data, unit_size_);
+ memcpy(current_chunk_ + (used_samples_ * unit_size_), data, unit_size_);
used_samples_++;
unused_samples_--;
void Segment::continue_raw_sample_iteration(SegmentRawDataIterator* it, uint64_t increase)
{
- lock_guard<recursive_mutex> lock(mutex_);
-
+ // Fail gracefully if we are asked to deliver data we don't have
if (it->sample_index > sample_count_)
- {
- // Fail gracefully if we are asked to deliver data we don't have
return;
- } else {
- it->sample_index += increase;
- it->chunk_offs += (increase * unit_size_);
- }
+
+ it->sample_index += increase;
+ it->chunk_offs += (increase * unit_size_);
if (it->chunk_offs > (chunk_size_ - 1)) {
it->chunk_num++;
}
}
-
} // namespace data
} // namespace pv