Thanks for your work!
I'm using Bass android in ndk
I have a certain function..
bool Record::Init(const uint32_t bitrate) noexcept
{
if(Record::initStatus)
return false;
if(BASS_IsStarted() == 0)
return false;
Log("[sv:dbg:record:init] : module initializing...");
{
int opusErrorCode { -1 };
Record::encoder = opus_encoder_create(SV::kFrequency, 1,OPUS_APPLICATION_VOIP, &opusErrorCode);
if(Record::encoder == nullptr || opusErrorCode < 0)
{
Log("[sv:err:record:init] : failed to create encoder (code:%d)", opusErrorCode);
return false;
}
}
// opus_encoder_destroy(Record::encoder);
if(const auto error = opus_encoder_ctl(Record::encoder,
OPUS_SET_BITRATE(bitrate)); error < 0)
{
Log("[sv:err:record:init] : failed to "
"set bitrate for encoder (code:%d)", error);
return false;
}
if(const auto error = opus_encoder_ctl(Record::encoder,
OPUS_SET_SIGNAL(OPUS_SIGNAL_VOICE)); error < 0)
{
Log("[sv:err:record:init] : failed to "
"set audiosignal type for encoder (code:%d)", error);
return false;
}
if(const auto error = opus_encoder_ctl(Record::encoder,
OPUS_SET_COMPLEXITY(10)); error < 0)
{
Log("[sv:err:record:init] : failed to "
"set complexity for encoder (code:%d)", error);
return false;
}
if(const auto error = opus_encoder_ctl(Record::encoder,
OPUS_SET_PREDICTION_DISABLED(0)); error < 0)
{
Log("[sv:err:record:init] : failed to "
"enable prediction for encoder (code:%d)", error);
return false;
}
if(const auto error = opus_encoder_ctl(Record::encoder,
OPUS_SET_LSB_DEPTH(16)); error < 0)
{
Log("[sv:err:record:init] : failed to "
"set lsb depth for encoder (code:%d)", error);
return false;
}
if(const auto error = opus_encoder_ctl(Record::encoder,
OPUS_SET_FORCE_CHANNELS(1)); error < 0)
{
Log("[sv:err:record:init] : failed to "
"set count channels for encoder (code:%d)", error);
return false;
}
if(const auto error = opus_encoder_ctl(Record::encoder,
OPUS_SET_DTX(0)); error < 0)
{
Log("[sv:err:record:init] : failed to "
"set dtx for encoder (code:%d)", error);
return false;
}
if(const auto error = opus_encoder_ctl(Record::encoder,
OPUS_SET_INBAND_FEC(1)); error < 0)
{
Log("[sv:err:record:init] : failed to "
"set inband fec for encoder (code:%d)", error);
return false;
}
if(const auto error = opus_encoder_ctl(Record::encoder,
OPUS_SET_PACKET_LOSS_PERC(10)); error < 0)
{
Log("[sv:err:record:init] : failed to set "
"packet loss percent for encoder (code:%d)", error);
return false;
}
bool initRecordStatus = BASS_RecordInit(-1);
if(!initRecordStatus)
{
Log("[sv:err:record:init] : failed to "
"init device (code:%d)", BASS_ErrorGetCode());
return false;
}
Log("[sv:dbg:record:startrecording] : channel recording starting...");
Record::recordChannel = BASS_RecordStart(SV::kFrequency, 1, BASS_RECORD_PAUSE, nullptr, nullptr);
if(Record::recordChannel == NULL)
{
Log("[sv:err:record:init] : failed to create record "
"stream (code:%d)", BASS_ErrorGetCode());
return false;
}
BASS_ChannelPause(Record::recordChannel);
Record::checkChannel = BASS_StreamCreate(SV::kFrequency, 1, NULL, STREAMPROC_PUSH, nullptr);
if(Record::checkChannel == NULL)
{
Log("[sv:err:record:init] : failed to create "
"check stream (code:%d)", BASS_ErrorGetCode());
return false;
}
BASS_ChannelSetAttribute(Record::checkChannel, BASS_ATTRIB_VOL, 4.f);
if(!Voice::PluginConfig::IsRecordLoaded())
{
Voice::PluginConfig::SetRecordLoaded(true);
Record::ResetConfigs();
}
// deviceListsResetScope.Release();
// encoderResetScope.Release();
// recordResetScope.Release();
// channelResetScope.Release();
Log("[sv:dbg:record:init] : module initialized");
Record::initStatus = true;
Record::SyncConfigs();
return true;
}
It causes a crash:
_ZN10soundtouch16FIFOSampleBuffer14receiveSamplesEPsj
This is all that is in my log, I use NDK and it is not very inclined to provide a detailed trace. I also can’t use debugging because I can’t repeat this crash on my device.
By disabling parts of the code, we managed to find out that the function affects the crash
BASS_RecordStart
I will be glad to any ideas