[vlc-devel] [PATCH 3/3] chromecast: add an experimental sout module that connects to a ChromeCast device and streams using the HTTP access output
Adrien Maglo
magsoft at videolan.org
Tue Sep 16 12:53:25 CEST 2014
Le 16/09/2014 12:09, Francois Cartegnie a écrit :
> Le 15/09/2014 11:39, Adrien Maglo a écrit :
>> + if (poll(ufd, 1, 6000) == 0)
>> + {
>> + if (*pb_pingTimeout)
>> + {
>> + msg_Err(p_stream, "No PONG answer received from the Chromecast");
>> + return 0; // Connection died
>> + }
>> + msg_Warn(p_stream, "No PING received from the Chromecast, sending a PING");
>> + *pb_pingTimeout = true;
>> + }
>> + else
>> + *pb_pingTimeout = false;
>> +
>> + int i_ret;
>> +
>> + /* Packet structure:
>> + * +------------------------------------+------------------------------+
>> + * | Payload size (uint32_t big endian) | Payload data |
>> + * +------------------------------------+------------------------------+ */
>> + if (*pi_received < PACKET_HEADER_LEN)
>> + {
>> + // We receive the header.
>> + i_ret = tls_Recv(p_tls, p_data, PACKET_HEADER_LEN - *pi_received);
>> + if (i_ret <= 0)
>> + return i_ret;
>> + *pi_received += i_ret;
>> + }
>
> Looks wrong to me.
>
> If there's no data to receive (i_ret == 0) and there's ping timeout,
> that doesn't mean connection is dead.
Yes, maybe.
This is how I first interpreted the utility of these PING PONG messages.
I may be wrong but as we do not have a spec, it is difficult to know
what's the real purpose of this.
Besides, I have not been able yet to reproduce the timeout issues you
and j-b have.
> We also might not want to poll for 6 sec in case of missed ping as the
> device ping frequency is not related to current reply delay. ex: wait 3
> times send ping/1 sec for a pong reply then give up.
I do not understand exactly what you mean here.
> Would have been easier with just the fixup i've sent.
Your fixup patch interprets differently the meaning of these messages.
If the aim is to just reply PONG any time the device sends a PING,
without paying attention to the timings, then I think this part of the
code could be much more simplified.
Best regards,
--
MagSoft
More information about the vlc-devel
mailing list