I have been trying to reproduce what my QA team has called a βrandom pauseβ for some time. Today I played it three times when debugging using logcat. It appears intermittently and only in a bad network.
The user pauses in the sound until he touches his phone (press the power button or trackball), and he immediately starts playing again. This is because I call start in the onPrepared callback, and start is never called in these cases. This is our most serious mistake.
What i know:
1) This happens intermittently on the Nexus One with 2.2.1 (not sure if on other devices)
2) I call prepareAsyc () from the playback service while the device screen is off. Sometimes onPrepared () is never called, so my next call to mediaplayer.start () never starts. I see with network sniffers and a buffering callback that buffering is happening.
3) If I touch the power of the device or the trackball to wake it up, onPrepared () will be called immediately (already buffered) and my callback will start playing.
Here are logs with timestamps showing the problem three times:
FIRST EXAMPLE (without a callback for 20 seconds until I pressed the power button):
11-10 16:10:55.966 I/AwesomePlayer( 59): calling prefetcher->prepare() 11-10 16:11:15.511 D/KeyguardViewMediator( 94): wakeWhenReadyLocked(26) 11-10 16:11:15.511 D/KeyguardViewMediator( 94): handleWakeWhenReady(26) 11-10 16:11:15.511 D/KeyguardViewMediator( 94): pokeWakelock(5000) 11-10 16:11:15.511 I/power ( 94): *** set_screen_state 1 11-10 16:11:15.561 D/SurfaceFlinger( 94): Screen about to return, flinger = 0x1fe300 11-10 16:11:15.701 D/AK8973 ( 64): Compass Start 11-10 16:11:15.701 D/WifiService( 94): ACTION_SCREEN_ON 11-10 16:11:15.711 I/Prefetcher( 59): [0x602d80] cache below low water mark, filling cache. 11-10 16:11:15.821 I/AwesomePlayer( 59): prefetcher is done preparing 11-10 16:11:15.831 W/MogMediaPlayer.onPreparedListener( 2968): onPrepared, calling notifyPrepared()
TWO MORE EXAMPLES (the first time 3 seconds before I hit the power, the next was 8 s):
11-10 16:14:54.649 I/AwesomePlayer( 59): calling prefetcher->prepare() 11-10 16:14:57.500 D/KeyguardViewMediator( 94): wakeWhenReadyLocked(26) 11-10 16:14:57.500 D/KeyguardViewMediator( 94): handleWakeWhenReady(26) 11-10 16:14:57.500 D/KeyguardViewMediator( 94): pokeWakelock(5000) 11-10 16:14:57.500 I/power ( 94): *** set_screen_state 1 11-10 16:14:57.560 D/SurfaceFlinger( 94): Screen about to return, flinger = 0x1fe300 11-10 16:14:57.580 D/WifiStateTracker( 94): Reset connections and stopping DHCP 11-10 16:14:57.580 D/WifiService( 94): ACTION_SCREEN_ON 11-10 16:14:57.670 I/Prefetcher( 59): [0xa990] cache below low water mark, filling cache. 11-10 16:14:57.700 D/AK8973 ( 64): Compass Start 11-10 16:14:57.800 I/AwesomePlayer( 59): prefetcher is done preparing 11-10 16:14:57.800 W/MogMediaPlayer.onPreparedListener( 2968): onPrepared, calling notifyPrepared() 11-10 16:39:03.608 I/AwesomePlayer( 59): calling prefetcher->prepare() 11-10 16:39:11.506 D/KeyguardViewMediator( 94): wakeWhenReadyLocked(26) 11-10 16:39:11.506 D/KeyguardViewMediator( 94): handleWakeWhenReady(26) 11-10 16:39:11.506 D/KeyguardViewMediator( 94): pokeWakelock(5000) 11-10 16:39:11.506 I/power ( 94): *** set_screen_state 1 11-10 16:39:11.566 D/SurfaceFlinger( 94): Screen about to return, flinger = 0x1fe300 11-10 16:39:11.586 D/WifiStateTracker( 94): Reset connections and stopping DHCP 11-10 16:39:11.586 D/WifiService( 94): ACTION_SCREEN_ON 11-10 16:39:11.716 D/AK8973 ( 64): Compass Start 11-10 16:39:11.766 I/Prefetcher( 59): [0x59ac18] cache below low water mark, filling cache. 11-10 16:39:11.856 I/AwesomePlayer( 59): prefetcher is done preparing 11-10 16:39:11.946 W/MogMediaPlayer.onPreparedListener( 2968): onPrepared, calling notifyPrepared()
Does anyone know anything about this error or how to get around it?
Thanks in advance Ben