[FFmpeg-soc] [PATCH] RTCP BYE

Martin Storsjö martin at martin.st
Wed Aug 25 11:54:48 CEST 2010


On Wed, 18 Aug 2010, Josh Allmann wrote:

> I might be missing something, but I don't see any particular RDT
> handling code in rtsp_fetch_packet other than rdt_parse_packet. Do I
> still need to do something?

I don't think so. All packets are received from the underlying layers and 
fed on to the correct parser (RTP or RDT), that then do whatever they want 
about it.

#1 looked ok, applied it since it was quite harmless and a general 
improvment, and ok'd by Luca earlier.

#2 looks ok, ok to commit, Luca/Ronald?

#3 looks ok, ok to commit, Luca/Ronald?

#4 looks ok, I think, but could you redo it without reindenting the 
unmodified lines, to make it clearer?

#5 raises a few questions and concerns, though. Earlier rtp_parse_packet 
returned <0 for errors or RTCP (no output packet), 0 for ok packet, 1 for 
ok packet and more packets following. Now it suddenly returns RTCP_BYE for 
such RTCP packets (and returns 0 for RTCP_SR packets). This also makes 
rtsp_fetch_packet return normally (as if a packet was returned, even if 
none was) if a RTCP packet was received, instead of retrying to get a 
proper data packet.

One way of fixing this would be to make rtcp_parse_packet return < 0 for 
all cases, and return -RTCP_BYE for byes. The handling code would then 
move up one step in rtsp_fetch_packet, to be within the "Either bad 
packet, or a RTCP packet" block, after checking the first_rtcp_ntp_time 
field.

Also, I think it would feel a bit more robust if nb_byes was reset in 
rtsp_read_play instead of in seek.

> Autoexit does not trip under my tests, perhaps because with this
> patch, the EOF never makes it back to ffplay. Instead,
> av_read_frame_internal tries to return some (bogus?) final packets
> (utils.c:1119).

That's due to the parser, which still may have outstanding data to return. 
After returning this data, we go back to av_read_packet on the next call, 
but then we still block on waiting for more packets in rtsp_fetch_packet. 
You could add a

    if (rt->nb_byes == rt->nb_rtsp_streams)
        return AVERROR_EOF;

to the start of rtsp_fetch_packet, to take care of that case when the 
function is called after returning eof once.

// Martin


More information about the FFmpeg-soc mailing list