[vlc-devel] [PATCH v4 1/3] access: srt: introduce srt input module

Rémi Denis-Courmont remi at remlab.net
Wed Aug 23 22:26:13 CEST 2017


Le keskiviikkona 16. elokuuta 2017, 5.10.17 EEST Justin Kim a écrit :
> +static block_t *BlockSRT(stream_t *p_stream, bool *restrict eof)
> +{
> +    stream_sys_t *p_sys = p_stream->p_sys;
> +
> +    block_t *pkt = block_Alloc( p_sys->i_chunk_size );
> +
> +    if (unlikely(pkt == NULL))
> +    {
> +        return NULL;
> +    }
> +
> +    SRTSOCKET ready[2];
> +    if ( srt_epoll_wait( p_sys->i_poll_id, 0, 0, ready, &(int) { 2 }, -1,
> 0, 0, 0, 0 ) == -1 )
> +    {
> +        msg_Err( p_stream, "%s", srt_getlasterror_str() );
> +        goto skip;
> +    }
> +
> +    int stat = srt_recvmsg( p_sys->sock, (char *)pkt->p_buffer,
> p_sys->i_chunk_size ); +
> +    if ( stat == SRT_ERROR )
> +    {
> +        msg_Err( p_stream, "%s", srt_getlasterror_str() );
> +        goto skip;
> +    }

What happens if no packets are received? poll waits forever? What happens if 
the user tries to stop the stream then?

> +
> +    pkt->i_buffer = stat;
> +    return pkt;
> +
> +skip:
> +   *eof = true;
> +    block_Release(pkt);
> +    return NULL;
> +}

-- 
雷米‧德尼-库尔蒙
https://www.remlab.net/



More information about the vlc-devel mailing list