Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip invalid bytes in connection read #653

Merged
merged 1 commit into from
Dec 10, 2024
Merged

Conversation

kevmo314
Copy link
Contributor

@kevmo314 kevmo314 commented Dec 9, 2024

Updates the connection reading to skip invalid bytes and probes for the interleaved frame/request/response magic bytes.

gortsplib currently dies when trying to play this whereas ffmpeg and VLC are both able to skip over invalid bytes and continue decoding. This change updates the logic so gortsplib mirrors the ffmpeg/VLC behavior.

Context: I am working with this camera https://www.axis.com/products/canon-vb-h47 which seems to throw this error on RTSP play:

buffer length exceeds 64

I traced it down to some weird packet behavior from the camera, specifically it seems to send:

[interleaved frame][random garbage bytes][another interleaved frame]

I suspect that the random garbage bytes are some corrupted interleaved frame that's missing the header. I do not know why.

Packet capture from gortsplib here if you are curious: axis.pcap.gz

The end of the interleaved frame has these garbage bytes:

image

after which gortsplib errors and a TEARDOWN is sent.

@aler9
Copy link
Member

aler9 commented Dec 10, 2024

Hello, although i'd like to dig further into the issue, this patch does not break anything and, as you wrote, it mimics the behavior of VLC and FFmpeg, therefore, there's no reason not to merge it. Thanks for providing it and for tracking down the issue.

@aler9 aler9 merged commit 51f00fa into bluenviron:main Dec 10, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants