Skip to content

Commit

Permalink
Release the buffer after encoding the message
Browse files Browse the repository at this point in the history
  • Loading branch information
fgwt202412 committed Dec 15, 2024
1 parent db35b43 commit 4eb2e80
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion website/src/components/McapRecordingDemo/Recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,15 @@ export class Recorder extends EventEmitter<RecorderEvents> {
sample_rate: data.sampleRate,
number_of_channels: data.numberOfChannels,
};
const encodedMsg = rootType.encode(msg).finish();
data.release();
const now = this.#time();
await this.#writer.addMessage({
sequence,
channelId: id,
logTime: now,
publishTime: now,
data: rootType.encode(msg).finish(),
data: encodedMsg,
});
this.messageCount++;
this.#emit();
Expand Down

0 comments on commit 4eb2e80

Please sign in to comment.