Use aaudio instead of opensles
Added audio effects ro recorder stream
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@ android {
|
|||||||
ndkVersion '27.2.12479018'
|
ndkVersion '27.2.12479018'
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = 'com.tutpro.baresip'
|
applicationId = 'com.tutpro.baresip'
|
||||||
minSdkVersion 23
|
minSdkVersion 28
|
||||||
targetSdkVersion 35
|
targetSdkVersion 35
|
||||||
versionCode = 405
|
versionCode = 405
|
||||||
versionName = '61.1.0'
|
versionName = '61.1.0'
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ poll_method epoll
|
|||||||
call_local_timeout 120
|
call_local_timeout 120
|
||||||
call_max_calls 4
|
call_max_calls 4
|
||||||
call_hold_other_calls yes
|
call_hold_other_calls yes
|
||||||
audio_player opensles,nil
|
audio_player aaudio,nil
|
||||||
audio_source opensles,nil
|
audio_source aaudio,nil
|
||||||
audio_alert opensles,nil
|
audio_alert aaudio,nil
|
||||||
audio_level no
|
audio_level no
|
||||||
ausrc_format s16
|
ausrc_format s16
|
||||||
auplay_format s16
|
auplay_format s16
|
||||||
@@ -19,7 +19,7 @@ audio_jitter_buffer_delay 0-20
|
|||||||
rtp_stats yes
|
rtp_stats yes
|
||||||
rtp_timeout 60
|
rtp_timeout 60
|
||||||
rtp_rxmode thread
|
rtp_rxmode thread
|
||||||
module opensles.so
|
module aaudio.so
|
||||||
module stun.so
|
module stun.so
|
||||||
module turn.so
|
module turn.so
|
||||||
module ice.so
|
module ice.so
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ add_definitions(-DHAVE_PTHREAD)
|
|||||||
|
|
||||||
target_link_libraries(baresip
|
target_link_libraries(baresip
|
||||||
android
|
android
|
||||||
OpenSLES
|
aaudio
|
||||||
lib_baresip
|
lib_baresip
|
||||||
lib_re
|
lib_re
|
||||||
lib_ssl
|
lib_ssl
|
||||||
|
|||||||
@@ -246,6 +246,14 @@ static void event_handler(enum ua_event ev, struct bevent *event, void *arg)
|
|||||||
len = re_snprintf(event_buf, sizeof event_buf, "sndfile dump,%r", &data);
|
len = re_snprintf(event_buf, sizeof event_buf, "sndfile dump,%r", &data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (!pl_strcmp(&module_event, "player sessionid")) {
|
||||||
|
len = re_snprintf(event_buf, sizeof event_buf, "player sessionid,%r", &data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!pl_strcmp(&module_event, "recorder sessionid")) {
|
||||||
|
len = re_snprintf(event_buf, sizeof event_buf, "recorder sessionid,%r", &data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ import android.media.*
|
|||||||
import android.media.AudioManager.MODE_IN_COMMUNICATION
|
import android.media.AudioManager.MODE_IN_COMMUNICATION
|
||||||
import android.media.AudioManager.MODE_NORMAL
|
import android.media.AudioManager.MODE_NORMAL
|
||||||
import android.media.AudioManager.RINGER_MODE_SILENT
|
import android.media.AudioManager.RINGER_MODE_SILENT
|
||||||
|
import android.media.audiofx.AcousticEchoCanceler
|
||||||
|
import android.media.audiofx.AutomaticGainControl
|
||||||
|
import android.media.audiofx.NoiseSuppressor
|
||||||
import android.net.*
|
import android.net.*
|
||||||
import android.net.wifi.WifiManager
|
import android.net.wifi.WifiManager
|
||||||
import android.os.*
|
import android.os.*
|
||||||
@@ -70,6 +73,7 @@ class BaresipService: Service() {
|
|||||||
private lateinit var bluetoothReceiver: BroadcastReceiver
|
private lateinit var bluetoothReceiver: BroadcastReceiver
|
||||||
private lateinit var hotSpotReceiver: BroadcastReceiver
|
private lateinit var hotSpotReceiver: BroadcastReceiver
|
||||||
private lateinit var androidContactsObserver: ContentObserver
|
private lateinit var androidContactsObserver: ContentObserver
|
||||||
|
|
||||||
private lateinit var stopState: String
|
private lateinit var stopState: String
|
||||||
private lateinit var quitTimer: CountDownTimer
|
private lateinit var quitTimer: CountDownTimer
|
||||||
|
|
||||||
@@ -625,6 +629,36 @@ class BaresipService: Service() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ev[0] == "player sessionid") {
|
||||||
|
val sessionId = ev[1].toInt()
|
||||||
|
Log.d(TAG, "got player sessionid $sessionId")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ev[0] == "recorder sessionid") {
|
||||||
|
val sessionId = ev[1].toInt()
|
||||||
|
Log.d(TAG, "got recorder sessionid $sessionId")
|
||||||
|
if (AcousticEchoCanceler.isAvailable()) {
|
||||||
|
Log.i(TAG, "AcousticEchoCanceler IS available")
|
||||||
|
AcousticEchoCanceler.create(sessionId)
|
||||||
|
} else {
|
||||||
|
Log.i(TAG, "AcousticEchoCanceler IS NOT available")
|
||||||
|
}
|
||||||
|
if (AutomaticGainControl.isAvailable()) {
|
||||||
|
Log.i(TAG, "AutomaticGainControl IS available")
|
||||||
|
AutomaticGainControl.create(sessionId)
|
||||||
|
} else {
|
||||||
|
Log.i(TAG, "AutomaticGainControl IS NOT available")
|
||||||
|
}
|
||||||
|
if (NoiseSuppressor.isAvailable()) {
|
||||||
|
Log.i(TAG, "NoiseSuppressor IS available")
|
||||||
|
NoiseSuppressor.create(sessionId)
|
||||||
|
} else {
|
||||||
|
Log.i(TAG, "NoiseSuppressor IS NOT available")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
val ua = UserAgent.ofUap(uap)
|
val ua = UserAgent.ofUap(uap)
|
||||||
if (ua == null) {
|
if (ua == null) {
|
||||||
Log.w(TAG, "uaEvent $event did not find ua $uap")
|
Log.w(TAG, "uaEvent $event did not find ua $uap")
|
||||||
|
|||||||
Reference in New Issue
Block a user