Browse Source

obs-ffmpeg: Initialize SRT stats object before requesting stats

The `srt_bstats()` function is not guaranteed to zero the stats object
before filling in stats. If a socket was connected, then disconnected,
without any data being sent over it, the stats object would remain
uninitialized, and weird results could occur.
tt2468 2 years ago
parent
commit
b2375a0660
1 changed files with 1 additions and 1 deletions
  1. 1 1
      plugins/obs-ffmpeg/obs-ffmpeg-srt.h

+ 1 - 1
plugins/obs-ffmpeg/obs-ffmpeg-srt.h

@@ -854,7 +854,7 @@ static int libsrt_close(URLContext *h)
 	if (s->passphrase)
 		av_freep(&s->passphrase);
 	/* Log stream stats. */
-	SRT_TRACEBSTATS perf;
+	SRT_TRACEBSTATS perf = {0};
 	srt_bstats(s->fd, &perf, 1);
 	blog(LOG_INFO, "---------------------------------");
 	blog(LOG_INFO,