Rockbox

  • Status Closed
  • Percent Complete
    100%
  • 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 Dominik Riebeling - 2011-05-04
Last edited by Dominik Riebeling - 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  Dominik Riebeling
2011-06-04 19:17
Reason for closing:  Accepted
Dominik Riebeling commented on 2011-05-04 17:00

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.

Paul Louden commented on 2011-05-04 21:07

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.

Hayden Pearce 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?

Hayden Pearce 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.

Antoine Cellerier commented on 2011-05-10 13:17

If I remember correctly from my preliminary research into the topic a few weeks ago, it is recommended to also listen to http://developer.android.com/reference/android/media/AudioManager.html#ACTION_AUDIO_BECOMING_NOISY to prevent the event delay on headphone unplugging.

Dominik Riebeling commented on 2011-05-12 20:29

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.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing