-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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 pts adjustments in stream #42399
Remove pts adjustments in stream #42399
Conversation
932aef6
to
e13ea3c
Compare
|
||
for segment in segments: | ||
# Open segment | ||
source = av.open(segment.segment, "r", format=container_format) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work? I believe the reason I had to add the seek in the first place is because after initial muxing the pointer in the BytesIO
was at the end, so when calling av.open
it didn't read the stream properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this seems to work on my end. Maybe you can test it out when you get a chance? That said, there does seem to be a fair amount of seemingly random stuff we have in the component that's actually there for good reason :-)
Edit: Given that you remember that we need it we should be extra careful about it. You told me the same thing about the monotonic dts check, and we ended up getting endless complaints about a few warning messages...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible it was added back when I wasn't closing the output container (which PyAV didn't allow you to do until a recent version bump). Now that we are, it's entirely possible that the act of closing the stream resets it automatically.
edit: I can try to test later tonight to make sure.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verified locally. Looks good.
* Remove unnecessary pts adjustments * Add comments * Use -inf for initial last_dts to be more clear * Use video first_pts as common adjuster in recorder * Remove seek(0) before av.open
* 'dev' of https://github.com/home-assistant/core: (77 commits) Fix kodi media_player unavailable at start (home-assistant#41714) Add an option to template delay_on/off in template binary sensor (home-assistant#43259) Bump hatasmota to 0.0.31 (home-assistant#43319) Update cloud integration to 0.38.0 (home-assistant#43314) Add progress translation key to hassfest (home-assistant#43311) Bump codecov/codecov-action from v1.0.14 to v1.0.15 (home-assistant#43304) Improvement to allow parsing of station ID in vasttrafik integration. Addresses home-assistant#34851 (home-assistant#43136) Abort vizio discovery flow without unique ID (home-assistant#43303) Update directv to 0.4.0 (home-assistant#43302) Add notification binary_sensor to Plugwise integration (home-assistant#41473) [ci skip] Translation update Bump bimmer_connected to 0.7.13 (home-assistant#43294) Bump aioguardian to 1.0.4 (home-assistant#43299) Refactor how entities are created for homekit_controller services (home-assistant#43242) Updated frontend to 20201111.1 (home-assistant#43298) Update pytradfri to 7.0.4 (home-assistant#43297) Remove pts adjustments in stream (home-assistant#42399) Fix Enigma2 available entity property (home-assistant#43292) Make MQTT climate return PRESET_NONE when no preset is set (home-assistant#43257) Bump env_canada to 0.2.4, fix config validation (home-assistant#43251) ...
Proposed change
Adjusting the incoming packet DTS/PTS of the audio and video streams to start from 0 based on the first packet of each stream received seems to be unnecessary for the hls segments and starting both from 0 may actually cause a slightly inaccurate A/V sync, as there might be a slight offset between the audio and video segments. Assuming the input audio and video streams are consistent, we can just use the original DTS/PTS values of the input streams. This PR removes the DTS/PTS adjustments in the stream worker and makes the peek_first_pts function slightly more readable.
In recorder, we still need to adjust the dts/pts to 0 for the video stream, but we should also use a common basis for adjustment for the audio stream to avoid the minor A/V sync issue.
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: