https://kotlinlang.org logo
#rx
Title
g

Gabe Kauffman

11/18/2020, 11:44 PM
I'm doing some CPU intensive work on this PublishSubject here and thus I think I should do it on
Schedulers.computation()
. But, I can't figure out where to put the
observeOn()
here
Copy code
val publishSubject = PublishSubject.create<Double>().toSerialized()
            remoteAudioTrackPublication.audioTrack?.addSink(object : AudioSink {
                override fun renderSample(
                    audioSample: ByteBuffer,
                    encoding: Int,
                    sampleRate: Int,
                    channels: Int
                ) {
                    publishSubject.onNext(AudioProcessingHelper.calculateAudioVolume(audioSample))
                }
            })