• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category Music playback
  • Assigned To No-one
  • Operating System Android
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by bluebrother - 2011-05-04
Last edited by bluebrother - 2011-06-04

FS#12097 - Android: headphone detection (enabling pause on unplug)

This patch adds support for headphone detection on Android, thus enabling pause on headphone (un)plug.

There are two issues with this (though not caused by this patch):
- Android takes a while until it reports the unplug event, so there will be some delay until playback gets paused. This is an Android limitation.
- Rockbox debounces headphone state changes for one second. Therefore playback will shortly be routed to the speaker on unplug until Rockbox does the actual pause.

Closed by  bluebrother
2011-06-04 19:17
Reason for closing:  Accepted

Oops, had a change in the debouncing timeout in the previous patch. While the debouncing timeout might be a bit big it's definitely nothing this patch should change. Updated patch.

With Audible's pause-on-unplug option, I never hear audio from the speakers. If we removed the debouncing, is that would happen here? I assume the delay in reporting the unplug is the same as the delay in switching audio playback from headphones to speaker, since I've never heard it play out the speakers after an unplug and before a pause in Audible.

St. commented on 2011-05-05 08:50

Could we mute playback when unplug is detected so that even if it is routed to the internal speaker for <N> period, there won't be the nasty blast of noise?

St. commented on 2011-05-05 08:56

OOOps, scratch that. I read it wrong, I though the delay was between unplug being detected and pause applied. Not between the cable being unplugged and the unplug being detected.

If I remember correctly from my preliminary research into the topic a few weeks ago, it is recommended to also listen to to prevent the event delay on headphone unplugging.

That's a good hint. I've implemented it (not sure if it's done in a good way but it works for me) and (after also decreasing the Rockbox internal debouncing from 1s to 0.5s) I don't get audio played back through the speaker anymore on unplug. I don't know if other phones have different delays for that and might still show the issue with the current delay. Apply on top of the previous patch.


Available keyboard shortcuts


Task Details

Task Editing