gortsplib
gortsplib copied to clipboard
fix: prioritize MD5 digest over SHA256 for better camera compatibility
- Change algorithm selection to prefer MD5 digest over SHA256
- Improves compatibility with cameras that don't support QOP
- Aligns with FFmpeg behavior and VDK library approach
- Fixes 401 authentication errors with multi-algorithm cameras
Problem
gortsplib prioritizes SHA256 digest authentication over MD5, but doesn't support QOP (Quality of Protection) parameters required by SHA256. This causes 401 authentication failures with cameras offering multiple digest algorithms.
Root Cause
Current algorithm selection logic always chooses SHA256 when available, regardless of QOP support:
(auth.Algorithm != nil && *auth.Algorithm == headers.AuthAlgorithmSHA256)
Hello, prioritizing MD5 over SHA256 would create a security issue.
Can you write the manufacturer and model of the camera you're having trouble with?
Can you post a network dump or example of RTSP communications between the camera and a server?