* @brief Appends a captured chunk and tracks its timing metadata. */
| 145 | * @brief Appends a captured chunk and tracks its timing metadata. |
| 146 | */ |
| 147 | void IO::FrameReader::appendChunk(const CapturedDataPtr& data) |
| 148 | { |
| 149 | Q_ASSERT(data); |
| 150 | Q_ASSERT(!data->data.isEmpty()); |
| 151 | |
| 152 | // code-verify off |
| 153 | // CircularBuffer is pre-sized SPSC; append is memcpy |
| 154 | m_circularBuffer.append(data->data); |
| 155 | // code-verify on |
| 156 | |
| 157 | PendingChunk chunk; |
| 158 | chunk.chunk = data; |
| 159 | chunk.bytesRemaining = data->data.size(); |
| 160 | chunk.nextFrameTimestamp = data->timestamp; |
| 161 | chunk.frameStep = std::max(std::chrono::nanoseconds(1), data->frameStep); |
| 162 | // code-verify off |
| 163 | // per-chunk timing record; deque only grows by 1 per chunk |
| 164 | m_pendingChunks.push_back(std::move(chunk)); |
| 165 | // code-verify on |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * @brief Drops timing-bookkeeping bytes for data lost to buffer overflow. |