mirror of
https://github.com/oxen-io/session-android.git
synced 2023-12-14 02:53:01 +01:00
32 lines
821 B
Kotlin
32 lines
821 B
Kotlin
package org.thoughtcrime.securesms.webrtc.video
|
|
|
|
import org.thoughtcrime.securesms.webrtc.data.quadrantRotation
|
|
import org.webrtc.VideoFrame
|
|
import org.webrtc.VideoSink
|
|
|
|
class RemoteRotationVideoProxySink: VideoSink {
|
|
|
|
private var targetSink: VideoSink? = null
|
|
|
|
var rotation: Int = 0
|
|
|
|
override fun onFrame(frame: VideoFrame?) {
|
|
val thisSink = targetSink ?: return
|
|
val thisFrame = frame ?: return
|
|
|
|
val quadrantRotation = rotation.quadrantRotation()
|
|
val modifiedRotation = thisFrame.rotation - quadrantRotation
|
|
|
|
val newFrame = VideoFrame(thisFrame.buffer, modifiedRotation, thisFrame.timestampNs)
|
|
thisSink.onFrame(newFrame)
|
|
}
|
|
|
|
fun setSink(videoSink: VideoSink) {
|
|
targetSink = videoSink
|
|
}
|
|
|
|
fun release() {
|
|
targetSink = null
|
|
}
|
|
|
|
} |