Skip to content

Cap AVC profile level at 4.1 in stream master playlist#41592

Merged
hunterjm merged 2 commits intohome-assistant:devfrom
uvjustin:cap-reported-avc-profile-in-stream
Oct 15, 2020
Merged

Cap AVC profile level at 4.1 in stream master playlist#41592
hunterjm merged 2 commits intohome-assistant:devfrom
uvjustin:cap-reported-avc-profile-in-stream

Conversation

@uvjustin
Copy link
Copy Markdown
Contributor

Proposed change

In #40483 we added master playlists to allow Google Cast devices to correctly play video streams with no audio by explicitly specifying the codecs in the master playlist. However, this seems to have caused some problems with some Google Cast devices and some cameras. Specifically, some cameras use a higher profile number than the Cast devices can officially support, and since we now specify the codec and profile explicitly, the Cast player aborts without even trying to play the stream (even though the higher profiles are not officially supported they may still be able to be played).
This PR caps the AVC profile we report in the master playlist to 4.1 which should be supported by the devices listed here: https://developers.google.com/cast/docs/media . Besides checking whether this change fixes issue #41579, we should also test whether this underreporting of the AVC profile adversely affects any cast devices. This change should only affect Cast devices and not the frontend as we are not sending the master_playlist to the players in ha-hls-player.

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

Example entry for configuration.yaml:

# Example configuration.yaml

Additional information

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.
  • 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, mind taking a look at this pull request as its been labeled with an integration (stream) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

@hunterjm
Copy link
Copy Markdown
Member

This change should only affect Cast devices and not the frontend as we are not sending the master_playlist to the players in ha-hls-player.

I believe I actually defaulted the playlist returned to be the master playlist everywhere.

@uvjustin
Copy link
Copy Markdown
Contributor Author

uvjustin commented Oct 10, 2020

This change should only affect Cast devices and not the frontend as we are not sending the master_playlist to the players in ha-hls-player.

I believe I actually defaulted the playlist returned to be the master playlist everywhere.

Yup it was changed that way..but when I made the PR to the frontend to only use ExoPlayer for H.265, I parsed the master and then just passed the regular playlist down to the 3 player types.
Is there anywhere else besides cast and ha-hls-player that accesses the hls stream?

Edit: Frontend PR with the change is here: home-assistant/frontend#7010

@hunterjm
Copy link
Copy Markdown
Member

I see. Thanks for the PR link. I don’t think it’s used anywhere else at the moment.

It might be better to add an option to the request stream method where you can ask for either the master or normal playlist instead of doing a string replace in the frontend. Then the cast and Google assistant integrations can just request the master playlist.

@uvjustin
Copy link
Copy Markdown
Contributor Author

That makes sense...I'll make a PR for that after we merge the outstanding ones.

@timmo001
Copy link
Copy Markdown
Member

timmo001 commented Oct 11, 2020

Fixes #38937

Audio and video working with this fix.

Thanks for this! 👍

@hunterjm
Copy link
Copy Markdown
Member

@uvjustin - Thanks for digging into this one! I was at a complete loss on where to even begin. Tag me when this is ready to go.

@uvjustin
Copy link
Copy Markdown
Contributor Author

uvjustin commented Oct 12, 2020

@hunterjm This seems to fix #38937 and #41579 , so I think we can go ahead and merge this one. We just have to keep an eye out to see if it breaks things for some other cast users as the profile level we are reporting may now technically be incorrect.
@stboch has an outstanding issue but it may or not be related to this.

@uvjustin uvjustin marked this pull request as ready for review October 12, 2020 03:04
@uvjustin
Copy link
Copy Markdown
Contributor Author

@hunterjm We can merge this now

@hunterjm hunterjm merged commit 9270585 into home-assistant:dev Oct 15, 2020
@hunterjm
Copy link
Copy Markdown
Member

Sorry, been preoccupied with writing a new integration :)

@hunterjm hunterjm added this to the 0.116.4 milestone Oct 15, 2020
balloob pushed a commit that referenced this pull request Oct 15, 2020
* Cap AVC profile level at 4.1

* Use smaller multiplier in bandwidth calculation
@balloob balloob mentioned this pull request Oct 15, 2020
@uvjustin uvjustin deleted the cap-reported-avc-profile-in-stream branch November 25, 2020 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Casting Camera to Google Home Hub/Chromecast not longer working

5 participants