input/binary: align sr_session_send() chunks to unit size

The input/binary module chops raw input data into chunks and sends these
to the session feed. The total size of input chunks got aligned to the
unit size, the session feed output didn't. Make sure to align session
packets with the input data's unit size, too.

This fixes bug #1582.
This commit is contained in:
Gerhard Sittig 2020-07-23 21:55:30 +02:00
parent 339d12df97
commit cb0fedd942
1 changed files with 2 additions and 0 deletions

View File

@ -103,6 +103,8 @@ static int process_buffer(struct sr_input *in)
for (i = 0; i < chunk_size; i += chunk) {
logic.data = in->buf->str + i;
chunk = MIN(CHUNK_SIZE, chunk_size - i);
chunk /= logic.unitsize;
chunk *= logic.unitsize;
logic.length = chunk;
sr_session_send(in->sdi, &packet);
}