Synced posting of events

This commit is contained in:
Juha Heinanen
2026-05-25 08:43:32 +03:00
parent ca1af66333
commit 1bc93ca133
@@ -2851,14 +2851,15 @@ class BaresipService: Service() {
} }
fun postServiceEvent(event: ServiceEvent) { fun postServiceEvent(event: ServiceEvent) {
synchronized(serviceEvents) {
serviceEvents.add(event) serviceEvents.add(event)
if (serviceEvents.size == 1) { if (serviceEvents.size == 1) {
Log.d(TAG, "Posted service event ${event.event} at ${event.timeStamp}") Log.d(TAG, "Posted service event ${event.event} at ${event.timeStamp}")
serviceEvent.postValue(Event(event.timeStamp)) serviceEvent.postValue(Event(event.timeStamp))
} } else
else
Log.d(TAG, "Added service event ${event.event}") Log.d(TAG, "Added service event ${event.event}")
} }
}
fun requestAudioFocus(ctx: Context): Boolean { fun requestAudioFocus(ctx: Context): Boolean {
Log.d(TAG, "Requesting audio focus") Log.d(TAG, "Requesting audio focus")