Skip to content

Comments

Add player state and refactor inter task communication#203

Open
luar123 wants to merge 2 commits intoCarlosDerSeher:refactor_parserfrom
luar123:player_state
Open

Add player state and refactor inter task communication#203
luar123 wants to merge 2 commits intoCarlosDerSeher:refactor_parserfrom
luar123:player_state

Conversation

@luar123
Copy link
Contributor

@luar123 luar123 commented Feb 15, 2026

This PR adds player state + callbacks and refactors the inter task communication.

  • player state: IDLE, PLAYING or PAUSED
  • callbacks can be registered and fire on state change
  • player_pause() allows to pause the player from main app or any other task. Can be used to free i2s and play from another source
  • player task is not aware of mute/volume state anymore. This simplifies player_send_snapcast_setting
  • handle dac sleepmode from main task. Use state callback to decide wake up/ shutdown.
  • dac is only unmuted if snapcast mute state and player mute state is false, avoiding unnecessary mute/unmute.
  • discard chunks before decoding if player is paused
  • use mutex instead of player_shutdown_in_progress from feat: Unified Ethernet interface with settings manager and web UI #201

I am unsure about the task notifications, had a race conditions when using them in the callbacks (that's why the main task callback uses a mutex). So maybe it would be better to use mutex or queues instead.

Todo: Either change notifications or set configTASK_NOTIFICATION_ARRAY_ENTRIES=2 in sdkconfigs.

@craigmillard86 Using this PR network_playback_stopped/network_playback_started from #201 could be replaced by a state callback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants