From ae2c11406ad2c11147ebb65999e5c5ec36b41743 Mon Sep 17 00:00:00 2001 From: begeekmyfriend Date: Mon, 22 Mar 2021 13:05:07 +0800 Subject: [PATCH] Fix URL server ID number parsing Signed-off-by: begeekmyfriend --- .../com/github/faucamp/simplertmp/io/RtmpConnection.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/src/main/java/com/github/faucamp/simplertmp/io/RtmpConnection.java b/library/src/main/java/com/github/faucamp/simplertmp/io/RtmpConnection.java index 16835c2..16a5c72 100644 --- a/library/src/main/java/com/github/faucamp/simplertmp/io/RtmpConnection.java +++ b/library/src/main/java/com/github/faucamp/simplertmp/io/RtmpConnection.java @@ -72,7 +72,7 @@ public class RtmpConnection implements RtmpPublisher { private int transactionIdCounter = 0; private AmfString serverIpAddr; private AmfNumber serverPid; - private AmfNumber serverId; + private AmfString serverId; private int videoWidth; private int videoHeight; private int videoFrameCount; @@ -635,12 +635,12 @@ public class RtmpConnection implements RtmpPublisher { objData = ((AmfObject) objData.getProperty("data")); serverIpAddr = (AmfString) objData.getProperty("srs_server_ip"); serverPid = (AmfNumber) objData.getProperty("srs_pid"); - serverId = (AmfNumber) objData.getProperty("srs_id"); + serverId = (AmfString) objData.getProperty("srs_id"); } String info = ""; info += serverIpAddr == null ? "" : " ip: " + serverIpAddr.getValue(); info += serverPid == null ? "" : " pid: " + (int) serverPid.getValue(); - info += serverId == null ? "" : " id: " + (int) serverId.getValue(); + info += serverId == null ? "" : " id: " + serverId.getValue(); return info; } @@ -661,7 +661,7 @@ public class RtmpConnection implements RtmpPublisher { @Override public final int getServerId() { - return serverId == null ? 0 : (int) serverId.getValue(); + return serverId == null ? 0 : Integer.parseInt(serverId.getValue()); } @Override