[FFmpeg-devel] [PATCH v6] avformat/udp: return the error code instead of generic EIO
lance.lmwang at gmail.com
lance.lmwang at gmail.com
Wed Jan 13 01:47:18 EET 2021
On Tue, Jan 12, 2021 at 10:35:52PM +0100, Marton Balint wrote:
>
>
> On Tue, 12 Jan 2021, Nicolas George wrote:
>
> > lance.lmwang at gmail.com (12021-01-12):
> > > @@ -888,23 +901,24 @@ static int udp_open(URLContext *h, const char *uri, int flags)
> > > }
> > >
> > > if ((!is_output && s->circular_buffer_size) || (is_output && s->bitrate && s->circular_buffer_size)) {
> > > - int ret;
> > > -
> > > /* start the task going */
> > > s->fifo = av_fifo_alloc(s->circular_buffer_size);
> > > ret = pthread_mutex_init(&s->mutex, NULL);
> > > if (ret != 0) {
> > > av_log(h, AV_LOG_ERROR, "pthread_mutex_init failed : %s\n", strerror(ret));
> > > + ret = AVERROR(ret);
>
> extra space before AVERROR(ret), similarly below.
OK, will fix them.
>
> > > goto fail;
> > > }
> > > ret = pthread_cond_init(&s->cond, NULL);
> > > if (ret != 0) {
> > > av_log(h, AV_LOG_ERROR, "pthread_cond_init failed : %s\n", strerror(ret));
> > > + ret = AVERROR(ret);
> > > goto cond_fail;
> > > }
> > > ret = pthread_create(&s->circular_buffer_thread, NULL, is_output?circular_buffer_task_tx:circular_buffer_task_rx, h);
> > > if (ret != 0) {
> > > av_log(h, AV_LOG_ERROR, "pthread_create failed : %s\n", strerror(ret));
> > > + ret = AVERROR(ret);
> > > goto thread_fail;
> > > }
> > > s->thread_started = 1;
> > > @@ -923,7 +937,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
> > > closesocket(udp_fd);
> > > av_fifo_freep(&s->fifo);
> > > ff_ip_reset_filters(&s->filters);
> > > - return AVERROR(EIO);
> > > + return ret;
> > > }
> > >
> > > static int udplite_open(URLContext *h, const char *uri, int flags)
> >
> > Thanks for your efforts.
>
> Yeah, hopefully this will be the last iteration :)
>
> Thanks,
> Marton
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
--
Thanks,
Limin Wang
More information about the ffmpeg-devel
mailing list