Hi,
How to reduce the latency for RTSP live streaming? I am not interested to keep the quality, the latency is the most important
I am currently using. The result are ok, but not great, it still has a bit of latency:
val minBufferDuration = 3000 // 3 seconds
val maxBufferDuration = 8000 // 8 seconds
val minPlaybackResumeBuffer = 1500 // 1.5 seconds
val minPlaybackStartBuffer = 500 // 0.5 seconds
val customLoadControl = DefaultLoadControl.Builder()
.setAllocator(DefaultAllocator(true, 16))
.setBufferDurationsMs(
minBufferDuration,
maxBufferDuration,
minPlaybackStartBuffer,
minPlaybackResumeBuffer)
.setTargetBufferBytes(-1)
.setPrioritizeTimeOverSizeThresholds(true)
.build()
val mediaSource = RtspMediaSource
.Factory()
.setDebugLoggingEnabled(false)
.createMediaSource(
MediaItem.fromUri(uri)
)
player = ExoPlayer.Builder(requireActivity()).setLoadControl(customLoadControl).build()
binding.thermalCameraTextureView.player = player
// Set the media item to be played.
player?.setMediaSource(mediaSource)
// Prepare the player.
player?.prepare()
// Start the playback.
player?.play()
where:
<com.google.android.exoplayer2.ui.PlayerView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/thermal_camera_texture_view"
app:surface_type="texture_view"
app:use_controller="false"
android:layout_width="match_parent"
android:layout_height="match_parent" />
and:
implementation "com.google.android.exoplayer:exoplayer-core:2.18.1"
implementation 'com.google.android.exoplayer:exoplayer-dash:2.18.1'
implementation 'com.google.android.exoplayer:exoplayer-rtsp:2.18.1'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.18.1'
Hi,
How to reduce the latency for RTSP live streaming? I am not interested to keep the quality, the latency is the most important
I am currently using. The result are ok, but not great, it still has a bit of latency:
where:
and: