Closed MarsRover75 closed 2 years ago
Interesting. RTP RFC 3550 defines time as an unsigned value, e.g. the appendix says:
u_int32 ts; /* timestamp */
and RTSP RFC 2326 says the rtptime
parameter can't have a minus:
parameter = ";" "seq" "=" 1*DIGIT
| ";" "rtptime" "=" 1*DIGIT
Looks like ffmpeg just ignores the error and sets rtptime
to 0:
else if (!strcmp(key, "rtptime"))
rtptime = strtoul(value, NULL, 10);
We could similarly pretend rtptime
isn't there. Or, I guess, when there's a -
, parse it as an i32
then cast it (essentially adding 232 to the value).
I'm aware that RFC defines it as uint32. No idea why this type of cameras set it to negative, the purpose of doing this is totally beyond my control and my understanding, but I think the safest and sanest way to handle this behavior would be to try parse it as signed int (or even float) and then set it to 0 if it violates the RFC in any way: negative, fractional (maybe round it if it's positive), unparsable, you name it.
I believe 0.7.5 will address this by ignoring the bad value. Please try it and let me know—it's certainly possible that there's something else wrong when talking with this camera.
Thanks for that Scott! I've rebooted those cameras and so far they behave normally, I guess I'll have to wait for this bug to reappear.
Sounds good. H.264 streams use 90 kHz clocks, so when stored as a 32-bit signed integer, they should flip between positive and negative every ~6.6 hours.
wow, thanks for clarifying!
Describe the bug Unable to test or start the stream (sometimes). Error message:
To Reproduce Unfortunately there's no way to reproduce it without the camera (OMNY M5S2A 2812). For some reason this type of cameras sometimes (actually >50% of times) return negative value for
rtptime
.Expected behavior Handle negative values for rtptime some other way than it's done now. In retina
client/parse.rs
lines 645-646:Other RTSP recording/capturing/viewing software works just fine in this situation (e.g. ZoneMinder, VLC Player)
Server:
Camera: OMNY M5S2A 2812
Desktop