Hello
I think I have found an issue with Obfuscated mode.
We are currently developing a PTT dispatcher which is the final part of our overall PTT solution. The issue seems to be raised when the app is complied using Release (Obfuscated).
Here is the relevent code, extracted from a class:
The following log data is form the error condition:
The following log data is form the normal condition (working correctly):
I dont know if this has to do with the use of threading or not. This is not a show stopper but I thought it was necessary to highlight it.
Regards
John.
I think I have found an issue with Obfuscated mode.
We are currently developing a PTT dispatcher which is the final part of our overall PTT solution. The issue seems to be raised when the app is complied using Release (Obfuscated).
Here is the relevent code, extracted from a class:
B4X:
public Sub audioOut_start
' // set up the ouput file name
StartRecordingOut
' // create local wav file
If Not(isWritingOut) Then
' // do we have a valid file name
If wavfileNameOut.Length > 0 Then
writelog($"${DateTime.Time(DateTime.Now)} - ${ChannelID} - start wav file write"$)
' // flag a recording
isWritingOut = True
' // create output file and output stream object
streamOut = StartWaveFileOut
End If
End If
' // setup the sending udp socket
udpSckTalk.Initialize("",0,0)
' // setup the audioOut device
audioOut.Initialize(8000,16,audioOut.CH_CONF_MONO)
audioOut.Start
' // start the thread
record.Start(Me,"Recording",Null)
End Sub
Sub Recording
' // this is the running thread for recording audio
' // https://www.b4x.com/android/forum/threads/jaudiorecord.37930/#content
isRecording = True
writelog($"${DateTime.Time(DateTime.Now)} - ${ChannelID} Recording ..."$)
Dim RecDataSize As Int = BufferSize
Do While isRecording
' // get audio data
Dim Data(RecDataSize) As Byte
audioOut.Read(Data,0,Data.Length)
writelog($"${DateTime.Time(DateTime.Now)} - ${ChannelID} Available=${audioOut.Available} byte's"$)
' // send the audio to the PTT server
Dim p As UDPPacket
p.Initialize(alaw.Encode(Data),thisChannel.host,thisChannel.udp_speaker)
udpSckTalk.Send(p)
' // write the data to file if we are initialised and currently writing
If streamOut.IsInitialized And isWritingOut Then
streamOut.WriteBytes(Data, 0, Data.Length)
End If
Loop
' // finalise the local recording
StopRecordingOut
End Sub
The following log data is form the error condition:
B4X:
' // RELEASE (OBFUSCATED)
10:11:15.525 - 2 cls_channel_listen::ID=2 ad123 PTT_KEY_DOWN
10:11:15.561 - 2 - start wav file write
10:11:15.572 - 2 StartWaveFile C:\Isle Systems Data\3.0\Atlas PTT Dispatcher\Channel 2\Recordings\2021.07.02_10.11.15.561-dispatcherwx.wav
Getting line from Audiosystem
TextMessage Error: (RuntimeException) java.lang.RuntimeException: Thread.Start : Sub recording not found!
10:11:21.575 - 2 cls_channel_listen::ID=2 unregister_listen
10:11:21.575 - 2 - StopRecording() output.IsInitialized = false
update_channel_presence::2 true izap40bjdh7xdy3objjgisrdw4305a ad123
10:11:25.672 - 2cls_channel_listen::ID=2 wsh_Closed,MAINTENANCE Reason=
update_channel_presence::2 false izap40bjdh7xdy3objjgisrdw4305a ad123
10:11:25.894 - 2 cls_channel_listen::ID=2 connect, Calling Channel MAINTENANCE @ ws://lux.ptt.aspect365.com:10022/connect
10:11:25.984 - 2 cls_channel_listen::ID=2 wsh_Connected
update_channel_presence::2 true k1lve6kacfb8az1fsjgkbca0wi666v ad123
The following log data is form the normal condition (working correctly):
B4X:
' // RELEASE
10:12:50.271 - 2 cls_channel_listen::ID=2 ad123 PTT_KEY_DOWN
10:12:50.309 - 2 - start wav file write
10:12:50.321 - 2 StartWaveFile C:\Isle Systems Data\3.0\Atlas PTT Dispatcher\Channel 2\Recordings\2021.07.02_10.12.50.309-dispatcherwx.wav
Getting line from Audiosystem
10:12:50 - 2 Recording ...
10:12:50 - 2 Available=1452 byte's
10:12:50 - 2 Available=1404 byte's
10:12:50 - 2 Available=1356 byte's
10:12:50 - 2 Available=1308 byte's
10:12:51 - 2 Available=1260 byte's
10:12:51 - 2 Available=1212 byte's
10:12:51 - 2 Available=1164 byte's
10:12:51 - 2 Available=1116 byte's
10:12:51 - 2 Available=1068 byte's
10:12:51 - 2 Available=1020 byte's
10:12:51 - 2 - StopRecording() closing output stream
10:12:51 - 2 - StopRecording() C:\Isle Systems Data\3.0\Atlas PTT Dispatcher\Channel 2\Recordings\2021.07.02_10.12.50.309-dispatcherwx.wav
10:12:51.813 - 2 cls_channel_listen::ID=2 ad123 PTT_KEY_UP
10:12:51.813 - 2 Thread Recording, true
I dont know if this has to do with the use of threading or not. This is not a show stopper but I thought it was necessary to highlight it.
Regards
John.