[FFmpeg-devel] [PATCH] : libavformat segfault when a RTSP reading is interrupted

Michael Niedermayer michaelni
Thu Jul 5 20:19:23 CEST 2007


Hi

On Thu, Jul 05, 2007 at 03:13:01PM +0200, Eric Paul wrote:
> Hi,
> 
> (Please, forgive my possibly bad English, I'm no native ...)
> 
> I've tried to use ffmpeg to read an RTSP stream. It works pretty well, but
> when the stream ends, my application hang.
> 
> I've browsed the code and I've found that you can set a callback to tell
> libavformat that you want to interrupt the reading. So I've used libavformat
> url_set_interrupt_cb function and a thread to manage a timeout for
> av_read_frame when reading a RTSP stream. Again, it works pretty well, but
> sometimes libavformat segfaults.
> 
> Back to the code, it seems that when reading is interrupted by the callback
> (in libavformat/rtsp.c udp_read_packet line 1130 rev 9482 in my case), the
> struct pointer rtsp_st in function rtsp_read_packet is uninitialized, so the
> next line of code which read rtsp_st->rtp_ctx segfaults !
> 
> As udp_read_packet returns -1 when interrupted by the callback, I've done a
> (very) little patch which seems to correct the problem (patch attached).

the patch looks ok


> 
> By the way, it should be interesting to change the callback signature to
> something like :
> 
> int URLInterruptCB(void*) instead of int URLInterruptCB(void)

that would break ABI

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070705/0ec26905/attachment.pgp>



More information about the ffmpeg-devel mailing list