From 0482b91e00653765b36a1fbd9c4d1306b87201d5 Mon Sep 17 00:00:00 2001 From: pedro Date: Thu, 5 Oct 2023 17:25:52 +0200 Subject: [PATCH 1/2] fix srt streamid value --- srt/src/main/java/com/pedro/srt/srt/SrtClient.kt | 4 ++-- .../packets/control/handshake/extension/HandshakeExtension.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/srt/src/main/java/com/pedro/srt/srt/SrtClient.kt b/srt/src/main/java/com/pedro/srt/srt/SrtClient.kt index c1e13b1ff..6c5e94fa2 100644 --- a/srt/src/main/java/com/pedro/srt/srt/SrtClient.kt +++ b/srt/src/main/java/com/pedro/srt/srt/SrtClient.kt @@ -141,7 +141,7 @@ class SrtClient(private val connectCheckerSrt: ConnectCheckerSrt) { if (url == null) { isStreaming = false onMainThread { - connectCheckerSrt.onConnectionFailedSrt("Endpoint malformed, should be: rtsp://ip:port/appname/streamname") + connectCheckerSrt.onConnectionFailedSrt("Endpoint malformed, should be: srt://ip:port/streamid") } return@launch } @@ -153,7 +153,7 @@ class SrtClient(private val connectCheckerSrt: ConnectCheckerSrt) { if (!srtMatcher.matches()) { isStreaming = false onMainThread { - connectCheckerSrt.onConnectionFailedSrt("Endpoint malformed, should be: srt://ip:port/appname/streamname") + connectCheckerSrt.onConnectionFailedSrt("Endpoint malformed, should be: srt://ip:port/streamid") } return@launch } diff --git a/srt/src/main/java/com/pedro/srt/srt/packets/control/handshake/extension/HandshakeExtension.kt b/srt/src/main/java/com/pedro/srt/srt/packets/control/handshake/extension/HandshakeExtension.kt index 72b2995ca..5c6750c39 100644 --- a/srt/src/main/java/com/pedro/srt/srt/packets/control/handshake/extension/HandshakeExtension.kt +++ b/srt/src/main/java/com/pedro/srt/srt/packets/control/handshake/extension/HandshakeExtension.kt @@ -42,7 +42,7 @@ data class HandshakeExtension( buffer.writeUInt16(senderDelay) buffer.writeUInt16(ExtensionType.SRT_CMD_SID.value) - val data = fixPathData("publish:$path".toByteArray(Charsets.UTF_8)) + val data = fixPathData(path.toByteArray(Charsets.UTF_8)) buffer.writeUInt16(data.size / 4) buffer.write(data) } From 7a148436ec5ed4c4b2d580b97faa9070241e8787 Mon Sep 17 00:00:00 2001 From: pedro Date: Thu, 5 Oct 2023 17:41:25 +0200 Subject: [PATCH 2/2] fix srt handshake test --- srt/src/test/java/com/pedro/srt/srt/control/HandshakeTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srt/src/test/java/com/pedro/srt/srt/control/HandshakeTest.kt b/srt/src/test/java/com/pedro/srt/srt/control/HandshakeTest.kt index 22aa388a6..a633f8c55 100644 --- a/srt/src/test/java/com/pedro/srt/srt/control/HandshakeTest.kt +++ b/srt/src/test/java/com/pedro/srt/srt/control/HandshakeTest.kt @@ -33,7 +33,7 @@ class HandshakeTest { @Test fun `GIVEN a handshake packet WHEN write packet in a buffer THEN get expected buffer`() { - val expectedData = byteArrayOf(-128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, -60, 0, 0, 0, 64, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 5, -36, 0, 0, 32, 0, -1, -1, -1, -1, 45, 116, -9, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 0, 1, 4, 4, 0, 0, 0, 63, 0, 120, 0, 0, 0, 5, 0, 3, 108, 98, 117, 112, 58, 104, 115, 105, 116, 115, 101, 116) + val expectedData = byteArrayOf(-128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, -60, 0, 0, 0, 64, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 5, -36, 0, 0, 32, 0, -1, -1, -1, -1, 45, 116, -9, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 0, 1, 4, 4, 0, 0, 0, 63, 0, 120, 0, 0, 0, 5, 0, 1, 116, 115, 101, 116) val handshake = Handshake( extensionField = ExtensionField.HS_REQ.value or ExtensionField.CONFIG.value, handshakeType = HandshakeType.CONCLUSION,