[vlc-devel] Stream info

Dermot McGahon dermot at dspsrv.com
Wed May 11 15:20:34 CEST 2005


Hello,

I am looking for a way to know that VLC is not receiving
udp data for a stream.

SAP announcements are received for dvb-s streams every
30 seconds. The sap-timeout is set to 300 seconds. It
must be higher than the interval of the SAP announcements
and preferably more than twice (i.e 60 seconds) so that
any missed annoucements are catered for.

Using info command of the rc interface provided info on
whether there is an mpeg video stream or no input present.

The problem is that when streaming is stopped at the
source; vlc will block on the socket waiting for streaming
to restart. Querying the rc inferface at this point will
return the old information about the stream.

When the sap-timeout is reached, the stream is removed
 from the playlist and at this point it is possible to
tell that there the stream has gone away.

My question is: would it be useful to do a second
pthread_cond_timedwait with a longer timeout value and
close the input if it times out?

This would differentiate between transient loss of
connection and more permanent loss, but would be much
shorter than the sap-timeout period. I am thinking of
a value like five seconds.

I may implement something like this, but am aware that
what works for my use case may not be useful or sensible
for other use cases like mbone multicast or http/mms
streaming, so I am asking for feedback from others who
use vlc for network streaming.



Warm Regards,

Dermot McGahon.
--




include/vlc_threads_funcs.h:
----------------------------

     gettimeofday( &now, NULL );
     timeout.tv_sec = now.tv_sec + THREAD_COND_TIMEOUT;
     timeout.tv_nsec = now.tv_usec * 1000;

     i_result = pthread_cond_timedwait( &p_condvar->cond, &p_mutex->mutex,
                                        &timeout );

     if( i_result == ETIMEDOUT )
     {
         /* People keep pissing me off with this. --Meuuh */
         msg_Dbg( p_condvar->p_this,
                   "thread %u: secret message triggered "
                   "at %s:%d (%s)", (int)pthread_self(),
                   psz_file, i_line, strerror(i_result) );

         i_result = pthread_cond_wait( &p_condvar->cond, &p_mutex->mutex );
     }


/* When a thread waits on a condition in debug mode, delay to wait before
  * outputting an error message (in second) */
#define THREAD_COND_TIMEOUT             1




Stop streaming:
---------------

[00000319] main decoder debug: thread 126278576: secret message triggered  
at src/misc/block.c:227 (Connection timed out)
[00000318] main decoder debug: thread 149031856: secret message triggered  
at src/misc/block.c:227 (Connection timed out)

+----[ Stream 0 ]
|
| Codec: mpgv
| Language:
| Type: Video
|
+----[ Stream 1 ]
|
| Codec: mpga
| Language:
| Type: Audio
|
+----[ end of stream info ]
video_present = 1



Playlist item times out:
------------------------

[00000229] main module debug: unlocking module "xvideo"
[00000320] main video output debug: thread 159521712 joined  
(src/video_output/video_output.c:491)

no input
video_present = 0

-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html



More information about the vlc-devel mailing list