浏览代码

obs-outputs: Don't shutdown RTMP session when silently reconnecting

The silent reconnect (GOAWAY) is supposed to be used for switching the
connection to a different server. As such, cleanly shutting down the
RTMP connection can destroy state that needs to be preserved in order
for the GOAWAY-enabled server to properly resume the same stream on
reconnect.

This commit closes the TLS/TCP connection before calling RTMP_Close,
causing librtmp to skip the FCUnpublish and deleteStream messages.
Richard Stanway 3 年之前
父节点
当前提交
dada82fec1
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. 9 0
      plugins/obs-outputs/rtmp-stream.c

+ 9 - 0
plugins/obs-outputs/rtmp-stream.c

@@ -708,6 +708,15 @@ static void *send_thread(void *data)
 	}
 
 	set_output_error(stream);
+
+	if (silently_reconnecting(stream)) {
+		/* manually close the socket to prevent librtmp from sending
+		 * unpublish / deletestream messages when we call RTMP_Close,
+		 * since we want to re-use this stream when we reconnect */
+		RTMPSockBuf_Close(&stream->rtmp.m_sb);
+		stream->rtmp.m_sb.sb_socket = -1;
+	}
+
 	RTMP_Close(&stream->rtmp);
 
 	/* reset bitrate on stop */