[FFmpeg-trac] #10578(avformat:new): send RTSP keep alive even when paused
FFmpeg
trac at avcodec.org
Fri Sep 22 20:55:31 EEST 2023
#10578: send RTSP keep alive even when paused
-------------------------------------+------------------------------------
Reporter: tmc2001 | Owner: (none)
Type: defect | Status: new
Priority: normal | Component: avformat
Version: unspecified | Resolution:
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+------------------------------------
Description changed by tmc2001:
Old description:
> Workflow:
> 1. Have a RTSP server that supports Pause.
> 2. Have ffmpeg play a video from that server (rtsp://<ipaddr>:...).
> 3. Pause the video in ffmpeg (call av_read_pause)
> 4. ffmpeg does NOT properly send the keep alive when Paused
> (either "GET_PARAMETER" or "OPTIONS"). This is the bug.
> 5. Since the RTSP server expects the keep alive, after the specified
> timeout (usually 60s) it closes the connection.
>
> The bug is in:
> File: libavformat/rtspdec.c
> Method: rtsp_read_packet
>
> This method first does ff_rtsp_fetch_packet, which fails when the server
> is Paused, causing it to never send the "GET_PARAMETER" or "OPTIONS"
> which is placed immediately after this call.
>
> Potential easy fix:
> Simply move that block of code before ff_rtsp_fetch_packet.
>
> That is, move the entire if block:
> if (!(rt->rtsp_flags & RTSP_FLAG_LISTEN)) { ... }
>
> just before the call to:
> ret = ff_rtsp_fetch_packet(s, pkt);
>
> I have tested this and it seems to work well for our cases.
> Sent this to ffmpeg-devel mailing list as well:
> http://ffmpeg.org/pipermail/ffmpeg-devel/2023-August/313608.html
>
> Would appreciate if an experienced DEV would approve and integrate into
> ffmpeg.
> Thank you.
New description:
Workflow:
1. Have a RTSP server that supports Pause.
2. Have ffmpeg play a video from that server (rtsp://<ipaddr>:...).
3. Pause the video in ffmpeg (call av_read_pause)
4. ffmpeg does NOT properly send the keep alive when Paused (either
"GET_PARAMETER" or "OPTIONS"). This is the bug.
5. Since the RTSP server expects the keep alive, after the specified
timeout (usually 60s) it closes the connection.
The bug is in:
File: libavformat/rtspdec.c
Method: rtsp_read_packet
This method first does ff_rtsp_fetch_packet, which fails when the server
is Paused, causing it to never send the "GET_PARAMETER" or "OPTIONS" which
is placed immediately after this call.
Potential easy fix:
Simply move that block of code before ff_rtsp_fetch_packet.
That is, move the entire if block:
if (!(rt->rtsp_flags & RTSP_FLAG_LISTEN)) { ... }
just before the call to:
ret = ff_rtsp_fetch_packet(s, pkt);
I have tested this and it seems to work well for our cases.
Sent this to ffmpeg-devel mailing list as well:
http://ffmpeg.org/pipermail/ffmpeg-devel/2023-August/313608.html
Would appreciate if an experienced DEV would approve and integrate into
ffmpeg.
Thank you.
--
--
Ticket URL: <https://trac.ffmpeg.org/ticket/10578#comment:1>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list