PR #25760 opened by Kilian (lusoris)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25760
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25760.patch
PLAY and PAUSE failures with a status code that `ff_rtsp_averror()` does not
map are reported as `-1`, which reads as EPERM ("Operation not permitted") on
Linux. This change passes `AVERROR_INVALIDDATA` as the fallback in
`rtsp_read_play()` and `rtsp_read_pause()`, as the other RTSP callers already
do. Recognized error codes keep their existing mappings.
**What was measured** (x86-64 Linux, a local RTSP test server that answers PLAY
or PAUSE with an injected status code, and a small client that reads the return
value):
- Before: PLAY and PAUSE replies with status 201, 250, 300 and 399 returned
`-1` ("Operation not permitted").
- After: the same replies return `AVERROR_INVALIDDATA`. Status 200 still
returns 0, and 404, 455 and 503 keep their mapped errors. All 16 cases pass,
and `ffprobe` against the same server reports "Invalid data found when
processing input".
- `make fate-rtsp fate-source` passes and `git diff --check` is clean on this
head.
The test server and client are local harnesses and are not part of this change.
>From d039de33f79cce247c374e61c08856446c4e78aa Mon Sep 17 00:00:00 2001
From: lusoris <[email protected]>
Date: Tue, 3 Nov 2026 23:16:46 +0100
Subject: [PATCH] avformat/rtspdec: use invalid data for unmapped PLAY and
PAUSE replies
The fallback passed to ff_rtsp_averror() is returned for status codes
outside its HTTP error mappings. Passing -1 makes an unmapped PLAY or
PAUSE failure appear as EPERM on Linux.
Use AVERROR_INVALIDDATA, consistent with the other RTSP callers, while
preserving the existing mappings for recognized error status codes.
Signed-off-by: lusoris <[email protected]>
---
libavformat/rtspdec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
index 0e592eebaed..783cb7e73d9 100644
--- a/libavformat/rtspdec.c
+++ b/libavformat/rtspdec.c
@@ -586,7 +586,7 @@ static int rtsp_read_play(AVFormatContext *s)
}
ff_rtsp_send_cmd(s, "PLAY", rt->control_uri, cmd, reply, NULL);
if (reply->status_code != RTSP_STATUS_OK) {
- return ff_rtsp_averror(reply->status_code, -1);
+ return ff_rtsp_averror(reply->status_code, AVERROR_INVALIDDATA);
}
if (rt->transport == RTSP_TRANSPORT_RTP &&
reply->range_start != AV_NOPTS_VALUE) {
@@ -619,7 +619,7 @@ static int rtsp_read_pause(AVFormatContext *s)
else if (!(rt->server_type == RTSP_SERVER_REAL && rt->need_subscription)) {
ff_rtsp_send_cmd(s, "PAUSE", rt->control_uri, NULL, reply, NULL);
if (reply->status_code != RTSP_STATUS_OK) {
- return ff_rtsp_averror(reply->status_code, -1);
+ return ff_rtsp_averror(reply->status_code, AVERROR_INVALIDDATA);
}
}
rt->state = RTSP_STATE_PAUSED;
--
2.54.0
_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]