From 7c23f149037e0c88665239e3df590363b6dde4fc Mon Sep 17 00:00:00 2001 From: pedroSG94 Date: Thu, 8 Aug 2024 00:23:38 +0200 Subject: [PATCH] remove unnecesary methods --- .../pedro/library/generic/GenericStream.kt | 30 +++++-------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/library/src/main/java/com/pedro/library/generic/GenericStream.kt b/library/src/main/java/com/pedro/library/generic/GenericStream.kt index 4936a85cb..b84ecd0e3 100644 --- a/library/src/main/java/com/pedro/library/generic/GenericStream.kt +++ b/library/src/main/java/com/pedro/library/generic/GenericStream.kt @@ -108,16 +108,19 @@ class GenericStream( streamClient.connecting(endPoint) if (endPoint.startsWith("rtmp", ignoreCase = true)) { connectedType = ClientType.RTMP - startStreamRtpRtmp(endPoint) + val resolution = super.getVideoResolution() + rtmpClient.setVideoResolution(resolution.width, resolution.height) + rtmpClient.setFps(super.getVideoFps()) + rtmpClient.connect(endPoint) } else if (endPoint.startsWith("rtsp", ignoreCase = true)) { connectedType = ClientType.RTSP - startStreamRtpRtsp(endPoint) + rtspClient.connect(endPoint) } else if (endPoint.startsWith("srt", ignoreCase = true)) { connectedType = ClientType.SRT - startStreamRtpSrt(endPoint) + srtClient.connect(endPoint) } else if (endPoint.startsWith("udp", ignoreCase = true)) { connectedType = ClientType.UDP - startStreamRtpUdp(endPoint) + udpClient.connect(endPoint) } else { onMainThreadHandler { connectChecker.onConnectionFailed("Unsupported protocol. Only support rtmp, rtsp and srt") @@ -125,25 +128,6 @@ class GenericStream( } } - private fun startStreamRtpRtmp(endPoint: String) { - val resolution = super.getVideoResolution() - rtmpClient.setVideoResolution(resolution.width, resolution.height) - rtmpClient.setFps(super.getVideoFps()) - rtmpClient.connect(endPoint) - } - - private fun startStreamRtpRtsp(endPoint: String) { - rtspClient.connect(endPoint) - } - - private fun startStreamRtpSrt(endPoint: String) { - srtClient.connect(endPoint) - } - - private fun startStreamRtpUdp(endPoint: String) { - udpClient.connect(endPoint) - } - override fun stopStreamImp() { when (connectedType) { ClientType.RTMP -> rtmpClient.disconnect()