views:

53

answers:

0

My simple audio streaming app works perfectly in 1.6 and 2.1 does not work in 2.2. I have no clue as to why. It works fine on the emulator, on actual 2.2 devices the audio stops unexpectedly after about 10 minutes or so. When I looked at logcat on my phone (HTC EVO) I see this:

I/HTTPStream(   65): 1358 Bytes read, progress 34346/65536
I/HTTPStream(   65): 1358 Bytes read, progress 35704/65536
I/HTTPStream(   65): 1359 Bytes read, progress 37063/65536
I/HTTPStream(   65): 1358 Bytes read, progress 38421/65536
I/HTTPStream(   65): 1358 Bytes read, progress 39779/65536
I/HTTPStream(   65): 1359 Bytes read, progress 41138/65536
I/HTTPStream(   65): 2716 Bytes read, progress 43854/65536
I/HTTPStream(   65): 1359 Bytes read, progress 45213/65536
I/HTTPStream(   65): 1358 Bytes read, progress 46571/65536

and then all of a sudden:

E/HTTPStream(   65): recv failed, errno = 11 (Try again)
I/HTTPDataSource(   65): Retry ... 0 times left
W/HTTPStream(   65): Calling connect()...
I/AudioHardwareQSD(   65): AudioHardware pcm playback is going to standby.
D/StreamProcess(   65): OutputStreamProcess::ResetAOLC()
W/HTTPStream(   65): Returned from connect()...
E/HTTPDataSource(   65): retrying connection failed
V/MediaPlayerService(   65): [2] notify (0x355d0, 4, 0, 0)
I/MediaPlayer( 1719): MediaPlayer handleMessage what=4
I/Prefetcher(   65): [0x3db60] cache below low water mark, filling cache.
W/HTTPStream(   65): Calling connect()...
W/HTTPStream(   65): Returned from connect()...
V/MediaPlayerService(   65): [2] notify (0x355d0, 4, 0, 0)
I/MediaPlayer( 1719): MediaPlayer handleMessage what=4
I/Prefetcher(   65): [0x3db60] cache below low water mark, filling cache.
E/HTTPStream(   65): recv failed, errno = 9 (Bad file number)
V/MediaPlayerService(   65): [2] notify (0x355d0, 4, 0, 0)
I/MediaPlayer( 1719): MediaPlayer handleMessage what=4
I/Prefetcher(   65): [0x3db60] cache below low water mark, filling cache.
E/HTTPStream(   65): recv failed, errno = 9 (Bad file number)
V/MediaPlayerService(   65): [2] notify (0x355d0, 4, 0, 0)
I/MediaPlayer( 1719): MediaPlayer handleMessage what=4
I/Prefetcher(   65): [0x3db60] cache below low water mark, filling cache.

The code is basically directly from Google's own docs "Playing from a file or stream" here: http://developer.android.com/guide/topics/media/index.html.

Again it works perfectly on 1.6 and 2.1 and the 2.2 emulator, but fails like above on 2.2 devices.

This is driving me crazy, any ideas? Thanks.

EDIT: Here's another example of the logcat on my phone when it runs, all of a sudden receive fails, and the server is "gone":

I/HTTPStream( 65): 29329 Bytes read, progress 29329/65536
I/HTTPStream( 65): 1448 Bytes read, progress 30777/65536 
I/HTTPStream( 65): 1448 Bytes read, progress 32225/65536 
I/HTTPStream( 65): 2896 Bytes read, progress 35121/65536 
I/HTTPStream( 65): 1448 Bytes read, progress 36569/65536 
I/HTTPStream( 65): 2896 Bytes read, progress 39465/65536 
I/HTTPStream( 65): 5792 Bytes read, progress 45257/65536 
I/HTTPStream( 65): 1448 Bytes read, progress 46705/65536 
I/HTTPStream( 65): 4344 Bytes read, progress 51049/65536 
I/HTTPStream( 65): 7240 Bytes read, progress 58289/65536 
I/HTTPStream( 65): 5792 Bytes read, progress 64081/65536 
I/HTTPStream( 65): 1448 Bytes read, progress 65529/65536 
I/HTTPStream( 65): 7 Bytes read, progress 65536/65536 
I/HTTPStream( 65): 21713 Bytes read, progress 21713/65536 
I/HTTPStream( 65): 1448 Bytes read, progress 23161/65536 
I/HTTPStream( 65): 5792 Bytes read, progress 28953/65536 
I/HTTPStream( 65): 4344 Bytes read, progress 33297/65536 
I/HTTPStream( 65): 1448 Bytes read, progress 34745/65536 
I/HTTPStream( 65): 5792 Bytes read, progress 40537/65536 
I/HTTPStream( 65): 1448 Bytes read, progress 41985/65536 
I/HTTPStream( 65): 5792 Bytes read, progress 47777/65536 
I/HTTPStream( 65): 5792 Bytes read, progress 53569/65536 
I/HTTPStream( 65): 1448 Bytes read, progress 55017/65536 
I/HTTPStream( 65): 2896 Bytes read, progress 57913/65536 
I/HTTPStream( 65): 4344 Bytes read, progress 62257/65536 
I/HTTPStream( 65): 1448 Bytes read, progress 63705/65536 
I/HTTPStream( 65): 1831 Bytes read, progress 65536/65536 
I/HTTPStream( 65): 31473 Bytes read, progress 31473/65536 
I/HTTPStream( 65): 1448 Bytes read, progress 32921/65536 
I/HTTPStream( 65): 23168 Bytes read, progress 56089/65536 
I/HTTPStream( 65): 1448 Bytes read, progress 57537/65536 
I/HTTPStream( 65): 4344 Bytes read, progress 61881/65536 
I/HTTPStream( 65): 2896 Bytes read, progress 64777/65536 
I/HTTPStream( 65): 759 Bytes read, progress 65536/65536 
I/HTTPStream( 65): 36889 Bytes read, progress 36889/65536 
I/HTTPStream( 65): 1448 Bytes read, progress 38337/65536 
I/HTTPStream( 65): 4344 Bytes read, progress 42681/65536 
I/HTTPStream( 65): 10136 Bytes read, progress 52817/65536 
I/HTTPStream( 65): 12719 Bytes read, progress 65536/65536 
I/HTTPStream( 65): 3209 Bytes read, progress 3209/65536 
E/HTTPStream( 65): recv failed, server is gone, total received: 3209 bytes

Again, works fine in 1.6 and 2.1 and the 2.2 emulator, just fails on a 2.2 device, specifically my HTC EVO 4G. Note this is using Wi-Fi with an excellent signal.