This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#12097 - Android: headphone detection (enabling pause on unplug)
Attached to Project:
Rockbox
Opened by Dominik Riebeling (bluebrother) - Wednesday, 04 May 2011, 18:57 GMT+2
Last edited by Dominik Riebeling (bluebrother) - Saturday, 04 June 2011, 21:17 GMT+2
Opened by Dominik Riebeling (bluebrother) - Wednesday, 04 May 2011, 18:57 GMT+2
Last edited by Dominik Riebeling (bluebrother) - Saturday, 04 June 2011, 21:17 GMT+2
|
DetailsThis 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. |
This task depends upon
Closed by Dominik Riebeling (bluebrother)
Saturday, 04 June 2011, 21:17 GMT+2
Reason for closing: Accepted
Saturday, 04 June 2011, 21:17 GMT+2
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.
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?
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 http://developer.android.com/reference/android/media/AudioManager.html#ACTION_AUDIO_BECOMING_NOISY 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.