[FFmpeg-devel] [PATCH v6] avformat/udp: return the error code instead of generic EIO
Marton Balint
cus at passwd.hu
Tue Jan 12 23:35:52 EET 2021
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.
>> 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
More information about the ffmpeg-devel
mailing list