smithdtyler / prettygoodmusicplayer

A music player app for Android hits the basics hard
GNU General Public License v3.0
52 stars 23 forks source link

Player Occasionally Crashes on Bluetooth Disconnect #91

Closed smithdtyler closed 9 years ago

smithdtyler commented 9 years ago

To replicate: turn off bluetooth headset while playing. Player continues playing and the GUI is largely unresponsive.

smithdtyler commented 9 years ago

Here's a log trace from the issue occurring:

07-29 19:17:32.309  21417-21417/com.smithdtyler.prettygoodmusicplayer I/MusicBroadcastReceiver﹕ Got bluetooth disconnect action
07-29 19:17:32.333  21417-21417/com.smithdtyler.prettygoodmusicplayer I/MyService﹕ Received   start id 77: Intent { cmp=com.smithdtyler.prettygoodmusicplayer/.MusicPlaybackService (has extras) }
07-29 19:17:32.333  21417-21417/com.smithdtyler.prettygoodmusicplayer I/MusicPlaybackService﹕ I got a message! 7
07-29 19:17:32.333  21417-21417/com.smithdtyler.prettygoodmusicplayer I/MusicPlaybackService﹕ I got a pause message
07-29 19:17:32.334  21417-21417/com.smithdtyler.prettygoodmusicplayer E/MediaPlayer[Native]﹕ internal/external state mismatch corrected
07-29 19:17:38.484  21417-21498/com.smithdtyler.prettygoodmusicplayer I/MusicPlaybackService﹕ Preferences update success: true
smithdtyler commented 9 years ago

In the non-error case, the "internal/external state mismatch corrected" is not displayed:

07-29 19:20:44.946  21417-21417/com.smithdtyler.prettygoodmusicplayer I/MusicBroadcastReceiver﹕ Got bluetooth disconnect action
07-29 19:20:44.948  21417-21417/com.smithdtyler.prettygoodmusicplayer I/MyService﹕ Received start id 82: Intent { cmp=com.smithdtyler.prettygoodmusicplayer/.MusicPlaybackService (has extras) }
07-29 19:20:44.948  21417-21417/com.smithdtyler.prettygoodmusicplayer I/MusicPlaybackService﹕ I got a message! 7
07-29 19:20:44.948  21417-21417/com.smithdtyler.prettygoodmusicplayer I/MusicPlaybackService﹕ I got a pause message
smithdtyler commented 9 years ago

Sigh, looks like this is a common issue:

https://stackoverflow.com/questions/26545205/what-means-the-message-internal-external-state-mismatch-corrected-at-the-media

smithdtyler commented 9 years ago

When the crash occurs, the app doesn't crash entirely. UI events keep getting passed to the playback service, which attempts to handle them but apparently fails to take action.

smithdtyler commented 9 years ago

Adding some additional logging, I can see that the error causes the player to think it is paused when it isn't.

07-29 19:45:13.954  18480-18480/com.smithdtyler.prettygoodmusicplayer I/MyService﹕ Received start id 5: Intent { cmp=com.smithdtyler.prettygoodmusicplayer/.MusicPlaybackService (has extras) }
07-29 19:45:13.954  18480-18480/com.smithdtyler.prettygoodmusicplayer I/MusicPlaybackService﹕ I got a message! 7
07-29 19:45:13.954  18480-18480/com.smithdtyler.prettygoodmusicplayer I/MusicPlaybackService﹕ I got a pause message
07-29 19:45:13.955  18480-18480/com.smithdtyler.prettygoodmusicplayer E/MediaPlayer[Native]﹕ internal/external state mismatch corrected
07-29 19:45:13.955  18480-18480/com.smithdtyler.prettygoodmusicplayer W/MusicPlaybackService﹕ Odd condition - pause was called but the media player reported that it is already paused

This error does not seem tightly correlated with the bluetooth headset itself, the headset disconnect is just the source of the message.

Perhaps I can just do a "pause" and catch the exception?

omyno commented 8 years ago

Just a reminder, I still experience this crash on Android 6.0 (Cyanogenmod 13) with Pretty Good Music Player 3.3.2.