[vlc-devel] [PATCH 4/4] 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
Sat Aug 30 18:34:33 CEST 2014


Le 30/08/2014 17:08, Ilkka Ollakka a écrit :
> On Thu, Aug 28, 2014 at 09:08:35AM +0200, Adrien Maglo wrote:
>
> Hi, one comment inline
>
>>   modules/stream_out/chromecast/cast.cpp | 892 +++++++++++++++++++++++++++++++++
>> +++ b/modules/stream_out/chromecast/cast.cpp
>> +
>> +/**
>> + * @brief Receive a data packet from the Chromecast
>> + * @param p_stream the sout_stream_t structure
>> + * @param b_msgReceived returns true if a message has been entirely received else false
>> + * @param i_payloadSize returns the payload size of the message received
>> + * @return the number of bytes received of -1 on error
>> + */
>> +static int recvPacket(sout_stream_t *p_stream, bool &b_msgReceived,
>> +                      uint32_t &i_payloadSize)
>> +{
>> +    // Use here only C linkage and POD types as this function is a cancelation point.
>> +    sout_stream_sys_t *p_sys = p_stream->p_sys;
>> +    struct pollfd ufd[1];
>> +    ufd[0].fd = p_sys->i_sock_fd;
>> +    ufd[0].events = POLLIN;
>> +
>> +    mtime_t deadline = mdate();
>> +    deadline += 6 * 1000 * 1000; // 6 seconds
>> +
>> +    mtime_t now = mdate();
>> +    if (now > deadline)
>> +        now = deadline;
>
> This caught my eye, are you checking if mdate() takes more than 6
> seconds in here? looks odd and maybe there isn't need to call mdate
> twice per recvPacket call?

There is indeed no need to call mdate() twice per recvPacket call. I 
will correct that.
The explanation of the six seconds deadline is given in a command just 
below:

/* The Chromecast normally sends a PING command every 5 seconds or so.
  * If we do not receive one after 6 seconds, we send a PING.
  * If after this PING, we do not receive a PONG, then we consider the
  * connection as dead. */

Please tell me if this is not the correct way for handling this.

Best regards,


-- 
MagSoft




More information about the vlc-devel mailing list