Skip to content

Adjust frag_duration setting in stream#59135

Merged
allenporter merged 1 commit intohome-assistant:devfrom
uvjustin:tweak-part-fragment
Nov 6, 2021
Merged

Adjust frag_duration setting in stream#59135
allenporter merged 1 commit intohome-assistant:devfrom
uvjustin:tweak-part-fragment

Conversation

@uvjustin
Copy link
Copy Markdown
Contributor

@uvjustin uvjustin commented Nov 5, 2021

Proposed change

As I was doing more testing with LL-HLS I noticed a playback artifact when using hls.js with one of my cameras. The playback loader is consistently skipping the last part in a segment. This can be addressed somewhat in the frontend via playback options, but I think the cause is when the media fragments are consistently slightly too long and the metadata reported is slightly shorter. Near the end of the segment, the loader sees that the duration of the media it has already equals the total duration indicated in the metadata, so the last part is skipped. However, when actually concatenating the media itself, there is now a hole where the missing fragment should belong, which can cause playback problems.
Previously the fragmenting strategy was to use a higher frag_duration parameter when streams have audio to avoid having any parts which are too short, as having any of these seems to break the iOS native player. However, with the addition of a floor for part duration metadata in #58036, this may not be a problem as long as the average part duration is still ok. Assuming this is the case, risking a too short part duration is better than risking a too long part duration, as a too long part duration may cause more issues with the last part having an inaccurate duration.
This value seems to work better for my cameras, but we may need to tweak things further or perhaps make this frag_duration multiplier a tunable parameter depending on what other users experience.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@probot-home-assistant
Copy link
Copy Markdown

Hey there @hunterjm, @allenporter, mind taking a look at this pull request as it has been labeled with an integration (stream) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@allenporter allenporter merged commit 3693b9b into home-assistant:dev Nov 6, 2021
@uvjustin uvjustin added this to the 2021.11.2 milestone Nov 6, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Nov 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants