I was reading this code but i can't figure outwhat av_..._.. stands for
is it already opening the connection here?
static int tcp_open(URLContext *h, const char *uri, int flags){
struct addrinfo hints = { 0 }, *ai, *cur_ai; int port, fd = -1;
TCPContext *s = h->priv_data; const char *p; char buf[256];
int ret; char hostname[1024],proto[1024],path[1024]; char
portstr[10]; s->open_timeout = 5000000; av_url_split(proto,
sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port,
path, sizeof(path), uri); if (strcmp(proto, "tcp")) return
AVERROR(EINVAL); if (port <= 0 || port >= 65536) { av_log(h,
AV_LOG_ERROR, "Port missing in uri\n"); return AVERROR(EINVAL);
} p = strchr(uri, '?'); if (p) { if
(av_find_info_tag(buf, sizeof(buf), "listen", p)) { char
*endptr = NULL; s->listen = strtol(buf, &endptr, 10);
/* assume if no digits were found it is a request to enable it */
if (buf == endptr) s->listen = 1; }
if (av_find_info_tag(buf, sizeof(buf), "timeout", p)) {
s->rw_timeout = strtol(buf, NULL, 10); } if
(av_find_info_tag(buf, sizeof(buf), "listen_timeout", p)) {
s->listen_timeout = strtol(buf, NULL, 10); } } if
(s->rw_timeout >= 0) { s->open_timeout = h->rw_timeout
= s->rw_timeout; } hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM; snprintf(portstr, sizeof(portstr),
"%d", port); if (s->listen) hints.ai_flags |= AI_PASSIVE;
if (!hostname[0]) ret = getaddrinfo(NULL, portstr, &hints,
&ai); else ret = getaddrinfo(hostname, portstr, &hints,
&ai); if (ret) { av_log(h, AV_LOG_ERROR,
"Failed to resolve hostname %s: %s\n", hostname,
gai_strerror(ret)); return AVERROR(EIO); } cur_ai = ai;
restart:#if HAVE_STRUCT_SOCKADDR_IN6 // workaround for IOS9
getaddrinfo in IPv6 only network use hardcode IPv4 address can not
resolve port number. if (cur_ai->ai_family == AF_INET6){
struct sockaddr_in6 * sockaddr_v6 = (struct sockaddr_in6
*)cur_ai->ai_addr; if (!sockaddr_v6->sin6_port){
sockaddr_v6->sin6_port = htons(port); } }#endif fd =
ff_socket(cur_ai->ai_family, cur_ai->ai_socktype,
cur_ai->ai_protocol); if (fd < 0) { ret =
ff_neterrno(); goto fail; } /* Set the socket's send or
receive buffer sizes, if specified. If unspecified or setting
fails, system default is used. */ if (s->recv_buffer_size > 0) {
setsockopt (fd, SOL_SOCKET, SO_RCVBUF, &s->recv_buffer_size,
sizeof (s->recv_buffer_size)); } if (s->send_buffer_size > 0) {
setsockopt (fd, SOL_SOCKET, SO_SNDBUF, &s->send_buffer_size,
sizeof (s->send_buffer_size)); } if (s->tcp_nodelay > 0) {
setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &s->tcp_nodelay, sizeof
(s->tcp_nodelay)); } if (s->listen == 2) { //
multi-client if ((ret = ff_listen(fd, cur_ai->ai_addr,
cur_ai->ai_addrlen)) < 0) goto fail1; } else if
(s->listen == 1) { // single client if ((ret =
ff_listen_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen,
s->listen_timeout, h)) < 0) goto fail1;
// Socket descriptor already closed here. Safe to overwrite to
client one. fd = ret; } else { if ((ret =
ff_listen_connect(fd, cur_ai->ai_addr, cur_ai->ai_addrlen,
s->open_timeout / 1000, h, !!cur_ai->ai_next))
< 0) { if (ret == AVERROR_EXIT) goto fail1;
else goto fail; } }
h->is_streamed = 1; s->fd = fd; freeaddrinfo(ai); return 0;
fail: if (cur_ai->ai_next) { /* Retry with the next sockaddr
*/ cur_ai = cur_ai->ai_next; if (fd >= 0)
closesocket(fd); ret = 0; goto restart; } fail1:
if (fd >= 0) closesocket(fd); freeaddrinfo(ai); return
ret;}
Il giorno mar 18 set 2018 alle ore 21:54 dan Med <[email protected]>
ha scritto:
> I know that i might have written the same thing over and over again but i
> didn't get an answer (which i really need)
>
> When is ArrayBufferBuilder::Append called ?
> Thank you
>
> Il giorno sab 15 set 2018 alle ore 12:34 dan Med <[email protected]>
> ha scritto:
>
>> That’s all.
>>
>> On Fri, 14 Sep 2018 at 21:53, dan Med <[email protected]> wrote:
>>
>>> I don’t understand how that code could be helpful to me..
>>>
>>> On Fri, 14 Sep 2018 at 21:51, dan Med <[email protected]> wrote:
>>>
>>>> Technica question, when Arraybufferbuilder:append will be called ?
>>>>
>>>> On Fri, 14 Sep 2018 at 01:14, Peter Schow <[email protected]> wrote:
>>>>
>>>>> On Thu, Sep 13, 2018 at 10:45 AM dan Med <[email protected]>
>>>>> wrote:
>>>>> > That isn’t my question....
>>>>> > Arraybufferbuilder:append how could I get that to be called.
>>>>> > What I really need is a little guidance on how to understand how v8
>>>>> will parse my JavaScript script and how it will allocate the data.
>>>>> > Maybe even how a buffer or if there’s something that describes how
>>>>> buffers are handeled or if there’s a file or code that tells me that not
>>>>> the memory I know... just how it will execute it that’s all
>>>>>
>>>>> Starting with the sample REPL code at:
>>>>> https://github.com/v8/v8/blob/master/samples/shell.cc
>>>>>
>>>>> could answer your questions. In the days that you've been pursuing
>>>>> this, you could have traced all this by now. Good luck.
>>>>>
>>>>> --
>>>>> --
>>>>> v8-users mailing list
>>>>> [email protected]
>>>>> http://groups.google.com/group/v8-users
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "v8-users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
--
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.