avformat/rtsp: do not log invalid values

When reading fails the first time, ch would be uninitialized and
printed in the log message. Instead check for an error early and
log it properly.
This commit is contained in:
Marvin Scholz
2025-08-22 16:50:34 +02:00
parent 899e497122
commit 2ed47ab725

View File

@@ -1239,9 +1239,12 @@ start:
q = buf;
for (;;) {
ret = ffurl_read_complete(rt->rtsp_hd, &ch, 1);
if (ret != 1) {
ret = (ret < 0) ? ret : AVERROR(EIO);
av_log(s, AV_LOG_WARNING, "Failed reading RTSP data: %s\n", av_err2str(ret));
return ret;
}
av_log(s, AV_LOG_TRACE, "ret=%d c=%02x [%c]\n", ret, ch, ch);
if (ret != 1)
return ret < 0 ? ret : AVERROR(EIO);
if (ch == '\n')
break;
if (ch == '$' && q == buf) {