-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
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
Remove check for monotonic dts #39844
Remove check for monotonic dts #39844
Conversation
@hunterjm I didn't find a problem with non-monotonic packets on my end - do you remember if it was an issue previously? |
Yes, the muxer will not write them and will throw an error if it is passed non-monotonic packets. The issue here is with WiFi cameras or UDP only connections on an unstable network with packet loss. This check was added after initial release because it’s better to miss packets than crash the muxer entirely. Have you actually run into an overflow issue? I’ve had feeds running for weeks without incident. |
I've seen the failure on the muxer side when adjusting packet dts such as when creating audio and generating the DTS values manually - sometimes you might round two packets to the same dts and the muxer will crash. I just haven't seen it on the input, and looking at the libav RTP code it looks like out of order packets are taken care of (I didn't see it in the RDT code, but I don't think any cameras use RDT). |
We can also treat it like the missing dts and auto-restart the stream by exiting the process? |
fdd3904
to
dd68834
Compare
Yes, that sounds about right. See the latest commit (I haven't tested it yet). |
dd68834
to
ef2ed7a
Compare
Dumb question...what is the line length to use for black with HA? Default is 88 and PEP8 says 79, but neither work. I keep getting CI errors |
ef2ed7a
to
efc4bd8
Compare
Black config is part of the repo and should be picked up automatically. We use black defaults btw. |
efc4bd8
to
5baedcf
Compare
I must have messed something up in my dev container. I cloned the repo again and it's fine now. |
I checked. We recently updated Black and it changed certain formatting. You must have had an old Black. |
Latest commit looks good... not sure how to test unless we can force an overflow or out of order packets. Pretty sure I wasn't personally able to test the skip logic anyway. For reference, here is the PR hotfix that added it in the first place. Unfortunately there is not a linked issue. Likely because it was reported in Discord. |
@uvjustin - Can we leave this one open to merge as a part of 0.116 or is this fixing a known bug in the current beta? If it can wait, I'd prefer to leave this PR open to make cherry picking bugfix commits into 0.115 easier. |
No major bug fix, but it's a small PR that won't break anything. I also slipped a line in there that remembers to close the input container before exiting if there is no video stream. |
321f290
to
eccd998
Compare
@hunterjm The errors here https://community.home-assistant.io/t/cannot-stream-onvif-cameras-to-google-home-post-upgrade-to-0-115-or-0-115-1/228050 are interesting. Note how close they are to 2^32. Not sure exactly why they are happening. The ffmpeg source of the error is here https://ffmpeg.org/doxygen/trunk/movenc_8c_source.html#l05431 . |
eccd998
to
d04191d
Compare
Hi, i raised this issue (#41891) and i then came across this here. Are they one and the same? can i close 41891? |
Proposed change
Long running RTSP feeds may encounter overflows of pts/dts values (see PyAV-Org/PyAV#591). The current check of whether the dts is monotonic would then discard all new incoming packets.
The monotonicity check seems to be unnecessary - libav discards out of order packets in the RTP decoder here: https://github.com/libav/libav/blob/master/libavformat/rtpdec.c#L798
Type of change
Example entry for
configuration.yaml
:# Example configuration.yaml
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: