alexeyvasilyev / rtsp-client-android

Lightweight low-latency RTSP client library for Android
Apache License 2.0
245 stars 67 forks source link

VideoDecodeThread queue frame to buffer offset applied twice #57

Open Fruchtzwerg94 opened 1 year ago

Fruchtzwerg94 commented 1 year ago

Hi @alexeyvasilyev ,

for me it seems like, passing data from the frame queue to the video decoder (VideoDecodeThread.kt#L81)

byteBuffer?.put(frame.data, frame.offset, frame.length)
decoder.queueInputBuffer(inIndex, frame.offset, frame.length, frame.timestamp, 0)

could cause problems if the offset is not 0. The offset is applied at putting data to the buffer, and applied a second time at queuing it. Is there something I am not aware of or should this be corrected to the following line?

decoder.queueInputBuffer(inIndex, 0, frame.length, frame.timestamp, 0)

Thansk for having a look at it.