From: Minlei Sun <su...@epoint.com.cn> Regarding ignore_rtcp flag, it is turned off by default. When some devices (such as hikvision iSecure Center Platform v1.3.xxx) rtsp stream contains rtcp data packets (may be non-standard), there will be a freeze when the output is rtmp stream. So when igore_rtcp is enabled, this situation can be solved. --- doc/protocols.texi | 3 +++ libavformat/rtsp.c | 1 + libavformat/rtsp.h | 5 +++++ libavformat/rtspdec.c | 2 ++ 4 files changed, 11 insertions(+)
diff --git a/doc/protocols.texi b/doc/protocols.texi index 8371f83059..cac1300445 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -1175,6 +1175,9 @@ Set socket TCP I/O timeout in microseconds. @item user_agent Override User-Agent header. If not specified, it defaults to the libavformat identifier string. + +@item ignore_rtcp +Ignore rtcp packets in rtsp stream to avoid transcoding stuck. Default valule is 0. @end table When receiving data over UDP, the demuxer tries to reorder received packets diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 9f509a229f..8c3f9aaefe 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -97,6 +97,7 @@ const AVOption ff_rtsp_options[] = { { "timeout", "set timeout (in microseconds) of socket TCP I/O operations", OFFSET(stimeout), AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, DEC }, COMMON_OPTS(), { "user_agent", "override User-Agent header", OFFSET(user_agent), AV_OPT_TYPE_STRING, {.str = LIBAVFORMAT_IDENT}, 0, 0, DEC }, + { "ignore_rtcp", "when the rtcp packet is received in the rtsp stream, it will be ignored", OFFSET(ignore_rtcp), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DEC }, { NULL }, }; diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h index 1310dd9c08..7d5d2c1c33 100644 --- a/libavformat/rtsp.h +++ b/libavformat/rtsp.h @@ -416,6 +416,11 @@ typedef struct RTSPState { */ char *user_agent; + /** + * ignore rtcp packet + */ + int ignore_rtcp; + char default_lang[4]; int buffer_size; int pkt_size; diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c index 6e97c23330..c68f33e9ee 100644 --- a/libavformat/rtspdec.c +++ b/libavformat/rtspdec.c @@ -817,6 +817,8 @@ redo: } goto redo; found: + if (rt->ignore_rtcp && (id == 1 || id == 3 )) + goto redo; *prtsp_st = rtsp_st; return len; } -- 2.30.1 (Apple Git-130) _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".