Skip to content
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

Pipewire: Catch exceptions in CPipewire::Create() #23282

Merged
merged 1 commit into from
Jun 16, 2023

Conversation

neo1973
Copy link
Member

@neo1973 neo1973 commented May 14, 2023

Description

CPlatformLinux::InitStageOne() doesn't expect OPTIONALS::*Register() methods to throw so exceptions aren't handled, they bubble up the stack and crash the application.

Motivation and context

An exception from CAESinkPipewire::Register() crashed Kodi in #23225 which isn't good behaviour even if the host system is setup in an expected way.

How has this been tested?

Artificially create an exception in CAESinkPipewire::Register(). Kodi doesn't crash and instead initializes the pulseaudio interface.

What is the effect on users?

Kodi doesn't crash maybe there even is sound.

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Clean up (non-breaking change which removes non-working, unmaintained functionality)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that will cause existing functionality to change)
  • Cosmetic change (non-breaking change that doesn't touch code)
  • None of the above (please explain below)

Checklist:

  • My code follows the Code Guidelines of this project
  • My change requires a change to the documentation, either Doxygen or wiki
  • I have updated the documentation accordingly
  • I have read the Contributing document
  • I have added tests to cover my change
  • All new and existing tests passed

@neo1973 neo1973 added Type: Fix non-breaking change which fixes an issue Platform: Linux Component: Audio v21 Omega labels May 14, 2023
@neo1973 neo1973 added this to the Omega 21.0 Alpha 2 milestone May 14, 2023
@neo1973 neo1973 requested a review from lrusak May 14, 2023 14:30
}
catch (const std::exception&)
{
return false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it make sense to log the actual exception?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added logging, but unfortunately it doesn't show up in the log because the logger is not yet initialized. But it helps when logging directly to the console 🙂

Copy link
Contributor

@lrusak lrusak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm actually fine throwing if we hit undefined/unexpected behaviour. Many distros may only build Kodi with one audio sink anyways so no matter what they may have broken audio if the pipewire sink cannot initialize.

return false;
try
{
pipewire = PIPEWIRE::CPipewire::Create();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have try/catch blocks in PIPEWIRE::CPipewire::Create It would be nice if we could just catch the exception in there.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the exception handling to CPipewire::Create.

@neo1973 neo1973 changed the title AESinkPipewire: Catch exceptions in CAESinkPipewire::Register() Pipewire: Catch exceptions in CPipewire::Create() May 28, 2023
@neo1973 neo1973 linked an issue May 31, 2023 that may be closed by this pull request
7 tasks
@neo1973 neo1973 requested review from lrusak and enen92 June 9, 2023 01:08
@neo1973 neo1973 merged commit b4d4386 into xbmc:master Jun 16, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Audio Platform: Linux Type: Fix non-breaking change which fixes an issue v21 Omega
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kodi dies due to strict pipewire requirements
3 participants