[FFmpeg-devel] [PATCH] Support RTP/TCP in the RTSP muxer

Martin Storsjö martin
Mon Mar 22 15:48:12 CET 2010


Hi,

On Mon, 22 Mar 2010, Ronald S. Bultje wrote:

> On Mon, Mar 22, 2010 at 10:35 AM, Martin Storsj? <martin at martin.st> wrote:
> >> > - ? ?return av_write_frame(rtpctx, &local_pkt);
> >> > + ? ?ret = av_write_frame(rtpctx, &local_pkt);
> >> > + ? ?if (!ret && rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP)
> >> > + ? ? ? ?ret = tcp_write_packet(s, rtsp_st);
> >> > + ? ?return ret;
> >> > ?}
> >>
> >> So what does this do exactly? It still writes the frame over the
> >> non-existing UDP session, right?
> >
> > No, it writes the packet(s) to the dyn_packet_buf opened in the section
> > you quoted above.
> 
> Shouldn't it be
> if (transport==tcp)
>   tcp_write_packet();
> else
>  av_write_frame();
> ?

No - av_write_frame() invokes the RTP muxer, doing the RTP packetization 
(merging/splitting frames to packets, adding RTP headers), outputting 
packets to its ByteIOContext whenever it has a packet to send. If the 
ByteIOContext happens to be a dyn_packet_buf, we need to flush the 
buffered packets and send them out over TCP, otherwise they've already 
been sent out, if the ByteIOContext was an UDP protocol.

// Martin



More information about the ffmpeg-devel mailing list