[FFmpeg-trac] #9670(undetermined:new): RTP with custom IO hangs on av_read_frame

FFmpeg trac at avcodec.org
Tue Mar 1 05:28:15 EET 2022


#9670: RTP with custom IO hangs on av_read_frame
-------------------------------------+-------------------------------------
             Reporter:  kevmo314     |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 If I construct an avio alloc context for RTP packets with

 avio_alloc_context(buf, 1500, 0, NULL, read_func, NULL, NULL)

 ie, not setting write_flag, that read_packet in rtsp.c will hang,
 specifically these two lines:
 https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/rtsp.c#L2183-L2184

 The custom IO attempts to write a receiver report and infinite-loops when
 calling avio_write().

 I think to fix this, this line:

   if (len > 0 && (*rtsp_st)->transport_priv && rt->transport ==
 RTSP_TRANSPORT_RTP)

 should also check the write_flag:

   if (len > 0 && (*rtsp_st)->transport_priv && rt->transport ==
 RTSP_TRANSPORT_RTP && s->pb->write_flag)

 because currently it seems to assume that RTCP packets can be written,
 which is not necessarily true with custom IO.

 I can provide a more detailed reproduction script if necessary, but given
 the relatively simple fix I'm hoping the above information is sufficient.
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9670>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list