Commit dbfcf9f6 authored by Gildas Bazin's avatar Gildas Bazin

* Fixed a segfault in PSEnd in input_ps.c
* The video decoder thread is now also reniced to a lower priority on
  Win32 (as in the linux version). This slightly increases the responsiveness of vlc.
parent 712e7249
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* This header provides a portable threads implementation. * This header provides a portable threads implementation.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: threads.h,v 1.21 2001/07/25 08:41:21 gbazin Exp $ * $Id: threads.h,v 1.22 2001/07/31 21:13:30 gbazin Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr> * Samuel Hocevar <sam@via.ecp.fr>
...@@ -512,10 +512,12 @@ static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar ) ...@@ -512,10 +512,12 @@ static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar )
/* Release one waiting thread if one is available. */ /* Release one waiting thread if one is available. */
/* For this trick to work properly, the vlc_cond_signal must be surrounded /* For this trick to work properly, the vlc_cond_signal must be surrounded
* by a mutex. This will prevent another thread from stealing the signal */ * by a mutex. This will prevent another thread from stealing the signal */
while( p_condvar->i_waiting_threads ) int i_waiting_threads = p_condvar->i_waiting_threads;
while( p_condvar->i_waiting_threads
&& p_condvar->i_waiting_threads == i_waiting_threads )
{ {
PulseEvent( p_condvar->signal ); PulseEvent( p_condvar->signal );
Sleep( 0 ); /* deschedule the current thread */ Sleep( 1 ); /* deschedule the current thread */
} }
return 0; return 0;
...@@ -589,7 +591,7 @@ static __inline__ int vlc_cond_broadcast( vlc_cond_t *p_condvar ) ...@@ -589,7 +591,7 @@ static __inline__ int vlc_cond_broadcast( vlc_cond_t *p_condvar )
while( p_condvar->i_waiting_threads ) while( p_condvar->i_waiting_threads )
{ {
PulseEvent( p_condvar->signal ); PulseEvent( p_condvar->signal );
Sleep( 0 ); /* deschedule the current thread */ Sleep( 1 ); /* deschedule the current thread */
} }
return 0; return 0;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_ps.c: PS demux and packet management * input_ps.c: PS demux and packet management
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ps.c,v 1.30 2001/07/17 09:48:07 massiot Exp $ * $Id: input_ps.c,v 1.31 2001/07/31 21:13:30 gbazin Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr> * Cyril Deguet <asmax@via.ecp.fr>
...@@ -387,7 +387,22 @@ static void PSInit( input_thread_t * p_input ) ...@@ -387,7 +387,22 @@ static void PSInit( input_thread_t * p_input )
*****************************************************************************/ *****************************************************************************/
static void PSEnd( input_thread_t * p_input ) static void PSEnd( input_thread_t * p_input )
{ {
vlc_mutex_destroy( &((packet_cache_t *)p_input->p_plugin_data)->lock ); #define p_packet_cache ((packet_cache_t *)p_input->p_method_data)
vlc_mutex_destroy( &p_packet_cache->lock );
if( p_packet_cache->data.p_stack )
free( p_packet_cache->data.p_stack );
if( p_packet_cache->pes.p_stack )
free( p_packet_cache->pes.p_stack );
if( p_packet_cache->smallbuffer.p_stack )
free( p_packet_cache->smallbuffer.p_stack );
if( p_packet_cache->largebuffer.p_stack )
free( p_packet_cache->largebuffer.p_stack );
#undef p_packet_cache
free( p_input->p_method_data );
free( p_input->p_plugin_data ); free( p_input->p_plugin_data );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* video_decoder.c : video decoder thread * video_decoder.c : video decoder thread
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: video_decoder.c,v 1.55 2001/07/18 17:05:39 massiot Exp $ * $Id: video_decoder.c,v 1.56 2001/07/31 21:13:30 gbazin Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Gal Hendryckx <jimmy@via.ecp.fr> * Gal Hendryckx <jimmy@via.ecp.fr>
...@@ -130,11 +130,16 @@ void vdec_InitThread( vdec_thread_t *p_vdec ) ...@@ -130,11 +130,16 @@ void vdec_InitThread( vdec_thread_t *p_vdec )
{ {
intf_DbgMsg("vdec debug: initializing video decoder thread %p", p_vdec); intf_DbgMsg("vdec debug: initializing video decoder thread %p", p_vdec);
#if !defined(SYS_BEOS) && !defined(WIN32) #if !defined(SYS_BEOS)
# if VDEC_NICE # if VDEC_NICE
/* Re-nice ourself - otherwise we would steal CPU time from the video /* Re-nice ourself - otherwise we would steal CPU time from the video
* output, which would make a poor display. */ * output, which would make a poor display. */
#if !defined(WIN32)
if( nice(VDEC_NICE) == -1 ) if( nice(VDEC_NICE) == -1 )
#else
if( !SetThreadPriority( GetCurrentThread(),
THREAD_PRIORITY_BELOW_NORMAL ) )
#endif
{ {
intf_WarnMsg( 2, "vpar warning : couldn't nice() (%s)", intf_WarnMsg( 2, "vpar warning : couldn't nice() (%s)",
strerror(errno) ); strerror(errno) );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment