int64_t open_timeout = 0;
int eid;
- eid = srt_epoll_create();
- if (eid < 0)
- return libsrt_neterrno(h);
- s->eid = eid;
-
av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname),
&port, path, sizeof(path), uri);
if (strcmp(proto, "srt"))
cur_ai = ai;
+ eid = srt_epoll_create();
+ if (eid < 0)
+ return libsrt_neterrno(h);
+ s->eid = eid;
+
restart:
fd = srt_socket(cur_ai->ai_family, cur_ai->ai_socktype, 0);
if (listen_fd >= 0)
srt_close(listen_fd);
freeaddrinfo(ai);
+ srt_epoll_release(s->eid);
return ret;
}
} else if (!strcmp(buf, "rendezvous")) {
s->mode = SRT_MODE_RENDEZVOUS;
} else {
- return AVERROR(EIO);
+ ret = AVERROR(EINVAL);
+ goto err;
}
}
if (av_find_info_tag(buf, sizeof(buf), "sndbuf", p)) {
s->linger = strtol(buf, NULL, 10);
}
}
- return libsrt_setup(h, uri, flags);
+ ret = libsrt_setup(h, uri, flags);
+ if (ret < 0)
+ goto err;
+ return 0;
+
err:
av_freep(&s->smoother);
av_freep(&s->streamid);
+ srt_cleanup();
return ret;
}