obs-outputs: Properly reset stream count on RTMP_Close

Every addStream call would increment this counter. After merging the
mbedTLS fixes, we no longer have extraneous RTMP_Init calls which were
masking the prescence of this bug. This caused every stream after the
first stream to have the wrong channel index, and eventually OBS would
crash due to an out of bounds write if the counter reached
RTMP_MAX_STREAMS.
This commit is contained in:
Richard Stanway 2020-02-23 00:21:58 +01:00
parent 28cdebdc9e
commit ee4cbb1199
2 changed files with 5 additions and 3 deletions

View File

@ -4361,11 +4361,11 @@ RTMP_Close(RTMP *r)
free(r->Link.streams[idx].playpath.av_val);
r->Link.streams[idx].playpath.av_val = NULL;
}
r->Link.curStreamIdx = 0;
r->Link.nStreams = 0;
}
r->Link.curStreamIdx = 0;
r->Link.nStreams = 0;
if ((r->Link.protocol & RTMP_FEATURE_WRITE) &&
(r->Link.pFlags & RTMP_PUB_CLEAN) &&
(r->Link.pFlags & RTMP_PUB_ALLOC))

View File

@ -407,6 +407,8 @@ static int send_packet(struct rtmp_stream *stream,
int recv_size = 0;
int ret = 0;
assert(idx < RTMP_MAX_STREAMS);
if (!stream->new_socket_loop) {
#ifdef _WIN32
ret = ioctlsocket(stream->rtmp.m_sb.sb_socket, FIONREAD,