[vlc-devel] udp network timeout
Dermot McGahon
dermot at dspsrv.com
Tue May 24 18:32:30 CEST 2005
Hello,
I'm trying to implement a timeout for udp streams. If data hasn't
been received for a couple of seconds, tear down instead of
displaying the last received frame.
The var_Set( p_this, "key-pressed", p_val ) below isn't tearing
down the stream.
Is there a another approach or how could this one be made to work?
Dermot.
--
Index: src/misc/block.c
===================================================================
--- src/misc/block.c (revision 11147)
+++ src/misc/block.c (working copy)
@@ -39,11 +39,15 @@
int i_allocated_buffer;
};
+static vlc_object_t * p_this;
+
#define BLOCK_PADDING_SIZE 32
static void BlockRelease( block_t * );
block_t *__block_New( vlc_object_t *p_obj, int i_size )
{
+ p_this = p_obj;
+
/* We do only one malloc
* TODO bench if doing 2 malloc but keeping a pool of buffer is better
* 16 -> align on 16
@@ -215,6 +219,7 @@
block_t *block_FifoGet( block_fifo_t *p_fifo )
{
+ int i = 0;
block_t *b;
vlc_mutex_lock( &p_fifo->lock );
@@ -225,6 +230,19 @@
while( p_fifo->p_first == NULL )
{
vlc_cond_wait( &p_fifo->wait, &p_fifo->lock );
+
+ i++;
+
+ printf("i = %d\n", i);
+
+ if (i > 2)
+ {
+ vlc_value_t p_val;
+
+ printf("sending key-stop\n");
+ p_val.i_int = config_GetInt( p_this, "key-stop" );
+ var_Set( p_this, "key-pressed", p_val );
+ }
}
b = p_fifo->p_first;
[dermot at dermot-ws vlc-trunk]$ svn diff include/vlc_threads_funcs.h
Index: include/vlc_threads_funcs.h
===================================================================
--- include/vlc_threads_funcs.h (revision 11147)
+++ include/vlc_threads_funcs.h (working copy)
@@ -489,7 +489,7 @@
struct timespec timeout;
gettimeofday( &now, NULL );
- timeout.tv_sec = now.tv_sec + THREAD_COND_TIMEOUT;
+ timeout.tv_sec = now.tv_sec + THREAD_COND_TIMEOUT + 3;
timeout.tv_nsec = now.tv_usec * 1000;
i_result = pthread_cond_timedwait( &p_condvar->cond, &p_mutex->mutex,
@@ -503,7 +503,7 @@
"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 );
+ //i_result = pthread_cond_wait( &p_condvar->cond, &p_mutex->mutex
);
}
# else
--
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