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

[0.x], [1.x] RTSP streaming fails to get DESCRIBE with 404 #2906

Closed
jp-bennett opened this issue Feb 28, 2022 · 6 comments
Closed

[0.x], [1.x] RTSP streaming fails to get DESCRIBE with 404 #2906

jp-bennett opened this issue Feb 28, 2022 · 6 comments
Labels
enhancement legacy Related to Janus 0.x multistream Related to Janus 1.x pr-exists

Comments

@jp-bennett
Copy link

Some IP cameras support RTSP, but have a quirk when it comes to their implementation. This has been directly observed with a Vivotek camera, and a possible problem on others. This particular bit of code hasn't changed between the 0.x and 1.x branches, though I've observed in on 0.x.

The quirk is that when the DESCRIBE request is formatted like DESCRIBE RTSP://192.168.1.89/live.sdp RTSP/1.0 it returns a 404 error. It appears that these cameras actually expect DESCRIBE live.sdp RTSP/1.0 instead. I think this could be accomplished by setting the CURLOPT_RTSP_STREAM_URI curl option to the needed value, instead of the full url. (https://github.com/meetecho/janus-gateway/blob/master/src/plugins/janus_streaming.c#L7183)

I see two approaches that could work. The first is an additional RTSP option, maybe rtsp_stream_uri, that when present sets the CURL option explicitly. This would allow a user that knows they have a quirky device to set the override.

The second option would be to catch a 404 response to the DESCRIBE request, and attempt it again with the CURLOPT set to just the path.

I plan to do some testing with this over the next few days, but I'm very curious whether a workaround for this quirk would be welcome in Janus, and which approach would be best.

@jp-bennett jp-bennett added the legacy Related to Janus 0.x label Feb 28, 2022
@lminiero
Copy link
Member

If you find a way to get that working without breaking the existing support, we'd definitely welcome the change! Unfortunately I never encountered such an RTSP server, so I can't replicate nor help myself.

@lminiero lminiero added enhancement multistream Related to Janus 1.x labels Feb 28, 2022
@lminiero
Copy link
Member

On your question about which of the two to pursue, I'm personally inclined towards the first approach: reacting to a 404 with the automated fallback would probably result in a needless second attempt the vast majority of times (where the server actually is unreachable). Considering as you said this seems limited to a few implementations, it's easier to address that explicitly. We can always worry about automated mechanisms later on, if needed.

@jp-bennett
Copy link
Author

@lminiero I have put together a quick demo to prove the concept. It was easiest to do the automatic fallback for PoC. jp-bennett@588397b

This does work with the quirky IP camera, but hasn't been exhaustively tested yet. For a final solution, what if we did a hybrid of the two approaches? One of the RTSP options could be a boolean rtsp_quirk, default to false. If true, then this code path is enabled. This would allow us (Zoneminder) to support these cameras with less work on the end-user.

@lminiero
Copy link
Member

lminiero commented Mar 1, 2022

I'm out of the office this morning so I can't check the code right now, but if you submit it as a pull request I'll have a look later today. I like the new name for the property 😄

@jp-bennett
Copy link
Author

It's not complete, for now the PR attempts a reconnect for any 404 response to a DESCRIBE. I'll add the flag later. #2909

@jp-bennett
Copy link
Author

@lminiero Fixed with #2909 . I've tested this with latest Zoneminder on the camera in question, and it's working now, Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement legacy Related to Janus 0.x multistream Related to Janus 1.x pr-exists
Projects
None yet
Development

No branches or pull requests

2 participants