[FFmpeg-devel] [PATCH] libavformat/UDP Protocol : seg fault on closing

Michael Niedermayer michaelni at gmx.at
Sat Jan 14 00:11:55 CET 2012


On Fri, Jan 13, 2012 at 09:44:17PM +0100, Laurent BRULET wrote:
> Le 13/01/2012 20:28, Michael Niedermayer a écrit :
> > On Fri, Jan 13, 2012 at 07:15:46PM +0100, Laurent BRULET wrote:
[...]
> >
> >
> >> circular_buffer_task, h)) { av_log(h, AV_LOG_ERROR, "pthread_create
> >> failed\n"); goto fail; @@ -617,12 +619,18 @@ static int
> >> udp_write(URLContext *h, const uint8_t *buf, int size) static int
> >> udp_close(URLContext *h) { UDPContext *s = h->priv_data; + int
> >> ret;
> >>
> >> if (s->is_multicast && (h->flags & AVIO_FLAG_READ))
> >> udp_leave_multicast_group(s->udp_fd, (struct sockaddr
> >> *)&s->dest_addr); closesocket(s->udp_fd); av_fifo_free(s->fifo);
> >> #if HAVE_PTHREADS + s->exit_thread = 1;
> >
> >> + ret = pthread_join(s->circular_buffer_thread, NULL);
> >
> > Is this safe in case the thread has not been started at all?
> 
> I think it is safe because, if the thread cannot start, then udp_open
> returns with an error. And in ffurl_connect, in case of error
> URLContext.is_connected is not set to 1. However, in ffurl_close,
> udp_close is only called if URLContext.is_connect equals to 1.
> I will send a new patch (a not linewrapped one, I hope)

the thread also wont be started/used if circular_buffer_size=0

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120114/53aef5b5/attachment.asc>


More information about the ffmpeg-devel mailing list