Android Question Shoutcast problem

MetalOS

Member
Licensed User
Longtime User
Hello,

I use this code to be able to listen to a shoutcast stream that works well but at the 5 minutes blast it cuts and I have to restart the application to listen again and it crashes again 5 minutes later.

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim Media As MediaPlayerStream
    Dim Audio As AudioStreamer
  
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    Media.Initialize("Media")
    Audio.Initialize("Audio", 44100, False, 16, Audio.VOLUME_MUSIC)
  
    Media.Load("http://ipShoutcast:7777/")
  
End Sub

Sub Media_StreamReady
    Media.Play
End Sub


I also put you the unfiltered log at runtime in debug mode, or I see some error but I do not know if it's important or not for my problem.


B4X:
Logger connecté à :  samsung GT-I9505
--------- beginning of main
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
info/warning (703, 127)
info/warning (701, 0)
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
ClassLoader referenced unknown path: /data/app/barxdroid.ArcMenuDemo-1/lib/arm
Bridge logger not enabled.
<qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 10/21/15, 369a2ea, I96aee987eb
type=1400 audit(0.0:694): avc: denied { read } for name="gpuclk" dev="sysfs" ino=11273 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:sysfs:s0 tclass=file permissive=0
type=1300 audit(0.0:694): arch=40000028 syscall=322 per=800008 success=no exit=-13 a0=ffffff9c a1=a758b07a a2=20000 a3=0 items=1 ppid=250 auid=4294967295 uid=10122 gid=10122 euid=10122 suid=10122 fsuid=10122 egid=10122 sgid=10122 fsgid=10122 tty=(none) ses=4294967295 exe="/system/bin/app_process32" subj=u:r:untrusted_app:s0:c512,c768 key=(null)
Initialized EGL, version 1.4
Swap behavior 1
<get_gpu_clk:229>: open failed: errno 13
** Activity (main) Create, isFirst = true **
JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
AudioFlinger could not create record track, status: -1
Error creating AudioRecord instance: initialization check failed with status -1.
Error code -20 when initializing native AudioRecord object.
Client defaulted notificationFrames to 1178 for frameCount 3536
ClassLoader referenced unknown path: /system/framework/tcmclient.jar
No Network Security Config specified, using platform default
** Activity (main) Resume **
setSubtitleAnchor in MediaPlayer
** Activity (main) Pause, UserClosed = false **
info/warning (703, 0)
info/warning (701, 0)
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
ClassLoader referenced unknown path: /data/app/barxdroid.ArcMenuDemo-2/lib/arm
Bridge logger not enabled.
<qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 10/21/15, 369a2ea, I96aee987eb
Initialized EGL, version 1.4
Swap behavior 1
type=1400 audit(0.0:699): avc: denied { read } for name="gpuclk" dev="sysfs" ino=11273 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:sysfs:s0 tclass=file permissive=0
type=1300 audit(0.0:699): arch=40000028 syscall=322 per=800008 success=no exit=-13 a0=ffffff9c a1=a758b07a a2=20000 a3=0 items=1 ppid=250 auid=4294967295 uid=10122 gid=10122 euid=10122 suid=10122 fsuid=10122 egid=10122 sgid=10122 fsgid=10122 tty=(none) ses=4294967295 exe="/system/bin/app_process32" subj=u:r:untrusted_app:s0:c512,c768 key=(null)
<get_gpu_clk:229>: open failed: errno 13
** Activity (main) Create, isFirst = true **
JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
AudioFlinger could not create record track, status: -1
Error creating AudioRecord instance: initialization check failed with status -1.
Error code -20 when initializing native AudioRecord object.
Client defaulted notificationFrames to 1178 for frameCount 3536
ClassLoader referenced unknown path: /system/framework/tcmclient.jar
No Network Security Config specified, using platform default
** Activity (main) Resume **
setSubtitleAnchor in MediaPlayer
** Activity (main) Pause, UserClosed = false **
info/warning (703, 0)
info/warning (701, 0)
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
ClassLoader referenced unknown path: /data/app/barxdroid.ArcMenuDemo-2/lib/arm
Bridge logger not enabled.
<qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 10/21/15, 369a2ea, I96aee987eb
Initialized EGL, version 1.4
Swap behavior 1
type=1400 audit(0.0:702): avc: denied { read } for name="gpuclk" dev="sysfs" ino=11273 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:sysfs:s0 tclass=file permissive=0
type=1300 audit(0.0:702): arch=40000028 syscall=322 per=800008 success=no exit=-13 a0=ffffff9c a1=a758b07a a2=20000 a3=0 items=1 ppid=250 auid=4294967295 uid=10122 gid=10122 euid=10122 suid=10122 fsuid=10122 egid=10122 sgid=10122 fsgid=10122 tty=(none) ses=4294967295 exe="/system/bin/app_process32" subj=u:r:untrusted_app:s0:c512,c768 key=(null)
<get_gpu_clk:229>: open failed: errno 13
** Activity (main) Create, isFirst = true **
JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
AudioFlinger could not create record track, status: -1
Error creating AudioRecord instance: initialization check failed with status -1.
Error code -20 when initializing native AudioRecord object.
Client defaulted notificationFrames to 1178 for frameCount 3536
ClassLoader referenced unknown path: /system/framework/tcmclient.jar
No Network Security Config specified, using platform default
** Activity (main) Resume **
setSubtitleAnchor in MediaPlayer
** Activity (main) Pause, UserClosed = false **
info/warning (703, 0)
info/warning (701, 0)
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
ClassLoader referenced unknown path: /data/app/barxdroid.ArcMenuDemo-1/lib/arm
Class anywheresoftware.b4a.BA failed lock verification and will run slower.
Common causes for lock verification issues are non-optimized dex code
and incorrect proguard optimizations.
Starting remote logger. Port: 43878
<qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 10/21/15, 369a2ea, I96aee987eb
type=1400 audit(0.0:706): avc: denied { read } for name="gpuclk" dev="sysfs" ino=11273 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:sysfs:s0 tclass=file permissive=0
type=1300 audit(0.0:706): arch=40000028 syscall=322 per=800008 success=no exit=-13 a0=ffffff9c a1=a758b07a a2=20000 a3=0 items=1 ppid=250 auid=4294967295 uid=10122 gid=10122 euid=10122 suid=10122 fsuid=10122 egid=10122 sgid=10122 fsgid=10122 tty=(none) ses=4294967295 exe="/system/bin/app_process32" subj=u:r:untrusted_app:s0:c512,c768 key=(null)
Initialized EGL, version 1.4
Swap behavior 1
<get_gpu_clk:229>: open failed: errno 13
*** Debugger waiting for connection (0) ***
After accept
*** Debugger waiting for connection (1) ***
Copying updated assets files (12)
** Activity (main) Create, isFirst = true **
JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
AudioFlinger could not create record track, status: -1
Error creating AudioRecord instance: initialization check failed with status -1.
Error code -20 when initializing native AudioRecord object.
Client defaulted notificationFrames to 1178 for frameCount 3536
ClassLoader referenced unknown path: /system/framework/tcmclient.jar
No Network Security Config specified, using platform default
** Activity (main) Resume **
Skipped 77 frames!  The application may be doing too much work on its main thread.
setSubtitleAnchor in MediaPlayer
** Activity (main) Pause, UserClosed = false **
Remote logger timeout: 1
writer error
java.lang.InterruptedException
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2010)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2044)
    at java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:358)
    at anywheresoftware.b4a.remotelogger.Connector$Writer.run(Connector.java:160)
    at java.lang.Thread.run(Thread.java:761)
java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:151)
    at java.net.SocketInputStream.read(SocketInputStream.java:120)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
    at anywheresoftware.b4a.shell.ShellConnector.readControlData(ShellConnector.java:191)
    at anywheresoftware.b4a.shell.ShellConnector.connect(ShellConnector.java:186)
    at anywheresoftware.b4a.shell.ShellConnector.run(ShellConnector.java:119)
    at java.lang.Thread.run(Thread.java:761)
Starting remote logger. Port: 43878
System.exit called, status: 0
VM exiting with result code 0, cleanup skipped.
ClassLoader referenced unknown path: /data/app/barxdroid.ArcMenuDemo-1/lib/arm
Class anywheresoftware.b4a.BA failed lock verification and will run slower.
Common causes for lock verification issues are non-optimized dex code
and incorrect proguard optimizations.
Starting remote logger. Port: 43878
<qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 10/21/15, 369a2ea, I96aee987eb
type=1400 audit(0.0:707): avc: denied { read } for name="gpuclk" dev="sysfs" ino=11273 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:sysfs:s0 tclass=file permissive=0
type=1300 audit(0.0:707): arch=40000028 syscall=322 per=800008 success=no exit=-13 a0=ffffff9c a1=a758b07a a2=20000 a3=0 items=1 ppid=250 auid=4294967295 uid=10122 gid=10122 euid=10122 suid=10122 fsuid=10122 egid=10122 sgid=10122 fsgid=10122 tty=(none) ses=4294967295 exe="/system/bin/app_process32" subj=u:r:untrusted_app:s0:c512,c768 key=(null)
Initialized EGL, version 1.4
Swap behavior 1
<get_gpu_clk:229>: open failed: errno 13
*** Debugger waiting for connection (0) ***
*** Debugger waiting for connection (1) ***
After accept
** Activity (main) Create, isFirst = true **
JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
AudioFlinger could not create record track, status: -1
Error creating AudioRecord instance: initialization check failed with status -1.
Error code -20 when initializing native AudioRecord object.
Client defaulted notificationFrames to 1178 for frameCount 3536
ClassLoader referenced unknown path: /system/framework/tcmclient.jar
No Network Security Config specified, using platform default
** Activity (main) Resume **
Skipped 61 frames!  The application may be doing too much work on its main thread.
setSubtitleAnchor in MediaPlayer
** Activity (main) Pause, UserClosed = false **


Thank you in advance for your help.
 

MetalOS

Member
Licensed User
Longtime User
I tried with Exoplayer and the example you gave on the forum, but after a while, the flow also stops.
 

Attachments

  • testExoPlayer.zip
    8.9 KB · Views: 283
Upvote 0

MetalOS

Member
Licensed User
Longtime User
Hello Erel, actually when the screen is on, mixed if the application is not in the foreground, it works perfectly without cuts. Once the screen is in standby the stream shoutcast this cut after about 2 minutes. and it possible to correct this problem?
 
Upvote 0

MetalOS

Member
Licensed User
Longtime User
After several tests or works fine as the screen remains on. On the other hand, if the screen pauses the shoutcast stream read by exoplayer this cut 2 minutes later. How to make the shoutcast stream continue even screen off?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Aquire a partial wake lock
 
Upvote 0

MetalOS

Member
Licensed User
Longtime User
Thanks for your help. That's how I proceeded for Wake Lock and it seems to work.

B4X:
Sub Process_Globals
    Dim wakelock As PhoneWakeState
End Sub

B4X:
Sub Activity_Create(FirstTime As Boolean)
    wakelock.PartialLock
End Sub

B4X:
Sub Activity_Resume
    wakelock.ReleasePartialLock
End Sub
 
Upvote 0
Top