Opened 3 months ago

Last modified 3 months ago

#9670 new defect

RTP with custom IO hangs on av_read_frame

Reported by: kevmo314 Owned by:
Priority: normal Component: avformat
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


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:

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.

Change History (1)

comment:1 by kevmo314, 3 months ago

Component: undeterminedavformat
Note: See TracTickets for help on using tickets.