[vlc-devel] [PATCH 3/3] chromecast: add an experimental sout module that connects to a ChromeCast device and streams using the HTTP access output

Hugo Beauzee-Luyssen hugo at beauzee.fr
Fri Sep 12 09:35:21 CEST 2014


On 09/12/2014 12:24 AM, Rémi Denis-Courmont wrote:
> Le 2014-09-12 06:29, Hugo Beauzee-Luyssen a écrit :
>>>> +    // Lock the sout thread until we have sent the media loading
>>>> command to the Chromecast.
>>>> +    vlc_mutex_lock(&p_sys->loadCommandMutex);
>>
>> I'd suggest you use the vlc_mutex_locker RAII helper.
>> Same goes for all mutex locks.
> 
> No, that would actually be _wrong_ here. The mutex would be released
> after msleep().
> 

I was kind of implying the minor refactoring to avoid that, but indeed,
plain replacement isn't an option here.

>>
>>>> +    const mtime_t deadline = mdate() + 6 * CLOCK_FREQ;
>>>> +    int i_ret = vlc_cond_timedwait(&p_sys->loadCommandCond,
>>>> &p_sys->loadCommandMutex, deadline);
>>>> +    if (i_ret == ETIMEDOUT)
>>>> +    {
>>>> +        msg_Err(p_stream, "Timeout reached before sending the media
>>>> loading command");
>>>> +        vlc_mutex_unlock(&p_sys->loadCommandMutex);
>>>> +        vlc_cancel(p_sys->chromecastThread);
>>>> +        vlc_join(p_sys->chromecastThread, NULL);
>>>> +        clean(p_sys);
>>>> +        return VLC_EGENERIC;
>>>> +    }
>>>> +    vlc_mutex_unlock(&p_sys->loadCommandMutex);
>>>> +
>>>> +    /* Even uglier: sleep more to let to the Chromecast initiate
>>>> the connection
>>>> +     * to the http server. */
>>>> +    msleep(2 * CLOCK_FREQ);
> 

Also, it seems I kind of initially replied to the wrong message, my bad.

Best regards,

-- 
Hugo Beauzée-Luyssen
hugo at beauzee.fr
+1-650-430-3672

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20140912/34a12d48/attachment.sig>


More information about the vlc-devel mailing list