mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 03:48:12 +03:00
Use CopyOnWriteArrayList
This commit is contained in:
parent
f2cc08263f
commit
4a76998c98
2 changed files with 4 additions and 2 deletions
|
@ -41,6 +41,7 @@ import org.matrix.android.sdk.api.session.room.timeline.Timeline
|
|||
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
|
||||
import org.matrix.android.sdk.api.session.room.timeline.TimelineSettings
|
||||
import timber.log.Timber
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
|
@ -84,7 +85,7 @@ class VoiceBroadcastPlayer @Inject constructor(
|
|||
listeners.forEach { it.onStateChanged(value) }
|
||||
}
|
||||
private var currentRoomId: String? = null
|
||||
private var listeners = mutableListOf<Listener>()
|
||||
private var listeners = CopyOnWriteArrayList<Listener>()
|
||||
|
||||
fun playOrResume(roomId: String, eventId: String) {
|
||||
val hasChanged = currentVoiceBroadcastId != eventId
|
||||
|
|
|
@ -23,6 +23,7 @@ import androidx.annotation.RequiresApi
|
|||
import im.vector.app.features.voice.AbstractVoiceRecorderQ
|
||||
import org.matrix.android.sdk.api.extensions.tryOrNull
|
||||
import org.matrix.android.sdk.api.session.content.ContentAttachmentData
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.Q)
|
||||
class VoiceBroadcastRecorderQ(
|
||||
|
@ -38,7 +39,7 @@ class VoiceBroadcastRecorderQ(
|
|||
listeners.forEach { it.onStateUpdated(value) }
|
||||
}
|
||||
|
||||
private val listeners = mutableListOf<VoiceBroadcastRecorder.Listener>()
|
||||
private val listeners = CopyOnWriteArrayList<VoiceBroadcastRecorder.Listener>()
|
||||
|
||||
override val outputFormat = MediaRecorder.OutputFormat.MPEG_4
|
||||
override val audioEncoder = MediaRecorder.AudioEncoder.HE_AAC
|
||||
|
|
Loading…
Reference in a new issue