[vlc-devel] [PATCH v4 1/3] access: srt: introduce srt input module
Rémi Denis-Courmont
remi at remlab.net
Fri Aug 25 10:52:36 CEST 2017
Le 25 août 2017 10:23:12 GMT+03:00, Justin Kim <justin.kim at collabora.com> a écrit :
>On 24/08/2017 5:26 AM, Rémi Denis-Courmont wrote:
>> 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?
>
>Thanks for good catching. 'srt_epoll_wait' can be cancelled only by
>'srt_close' when it waits infinitely. So I added a routine to give a
>chance to return by timeout. Please review my 5th patches.
>
>>
>>> +
>>> + pkt->i_buffer = stat;
>>> + return pkt;
>>> +
>>> +skip:
>>> + *eof = true;
>>> + block_Release(pkt);
>>> + return NULL;
>>> +}
>>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel
I dislike arbitrary timeouts. AFAIU the SRT API, you should create a pipe or an eventfd, add it to epoll() and register a callback to VLC with vlc_interrupt_(un)register().
--
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
More information about the vlc-devel
mailing list