StreamPack icon indicating copy to clipboard operation
StreamPack copied to clipboard

[Bug]: Possible bug in ByteBufferExtensions

Open tukez opened this issue 1 year ago • 3 comments

Version

2.6.1

Environment that reproduces the issue

No devices.

RTMP/SRT/... Server

No server.

Audio configuration

No response

Video configuration

No response

Is it reproducible in the demos application?

Yes

Reproduction steps

byteBuffer.toByteArray()

Expected result

ByteBuffer.toByteArray() has two implementations, one for array backed buffers and one for others. The array backed implementation does not move the ByteBuffer position whereas the other implementation does.

Noticed this while reading the source code, a possible source of bugs.

Actual result

Implementation works the same for all ByteBuffers.

Additional context

No response

Relevant logs output

No response

tukez avatar Aug 12 '24 11:08 tukez

Indeed. Just moving the position to the limit would do it.

StreamPack does not use the ByteBuffer once they have been read by toByteArray()

ThibaultBee avatar Aug 27 '24 18:08 ThibaultBee

Could you have a look at https://github.com/ThibaultBee/StreamPack/pull/162?

ThibaultBee avatar Aug 30 '24 08:08 ThibaultBee

Looks correct.

tukez avatar Aug 30 '24 10:08 tukez

Released in 3.0.0-RC

ThibaultBee avatar Apr 10 '25 07:04 ThibaultBee