Changeset 253ac451cadf69a9ee788d4f640d294957b877f7
- Timestamp:
- 07/09/08 22:21:41
(3 months ago)
- Author:
- Laurent Aimar <fenrir@videolan.org>
- git-committer:
- Laurent Aimar <fenrir@videolan.org> 1220818901 +0200
- git-parent:
[9ea2d78d6b4507764373bcfd07ec054596f9edf2]
- git-author:
- Laurent Aimar <fenrir@videolan.org> 1220818773 +0200
- Message:
Removed the need to msleep to handle input pause.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r9ea2d78 |
r253ac45 |
|
| 65 | 65 | static void MainLoop( input_thread_t *p_input ); |
|---|
| 66 | 66 | |
|---|
| 67 | | static inline int ControlPopNoLock( input_thread_t *, int *, vlc_value_t * ); |
|---|
| | 67 | static inline int ControlPopNoLock( input_thread_t *, int *, vlc_value_t *, mtime_t i_deadline ); |
|---|
| 68 | 68 | static void ControlReduce( input_thread_t * ); |
|---|
| 69 | 69 | static bool Control( input_thread_t *, int, vlc_value_t ); |
|---|
| … | … | |
| 224 | 224 | /* Init control buffer */ |
|---|
| 225 | 225 | vlc_mutex_init( &p_input->p->lock_control ); |
|---|
| | 226 | vlc_cond_init( &p_input->p->wait_control ); |
|---|
| 226 | 227 | p_input->p->i_control = 0; |
|---|
| 227 | 228 | |
|---|
| … | … | |
| 338 | 339 | vlc_mutex_destroy( &p_input->p->counters.counters_lock ); |
|---|
| 339 | 340 | |
|---|
| | 341 | vlc_cond_destroy( &p_input->p->wait_control ); |
|---|
| 340 | 342 | vlc_mutex_destroy( &p_input->p->lock_control ); |
|---|
| 341 | 343 | free( p_input->p ); |
|---|
| … | … | |
| 731 | 733 | vlc_value_t val; |
|---|
| 732 | 734 | mtime_t i_current; |
|---|
| 733 | | |
|---|
| 734 | | /* Do the read */ |
|---|
| | 735 | mtime_t i_deadline; |
|---|
| | 736 | |
|---|
| | 737 | /* Demux data */ |
|---|
| | 738 | b_force_update = false; |
|---|
| 735 | 739 | if( p_input->i_state != PAUSE_S ) |
|---|
| 736 | | { |
|---|
| 737 | 740 | MainLoopDemux( p_input, &b_force_update, &i_start_mdate ); |
|---|
| 738 | | } |
|---|
| 739 | | else |
|---|
| 740 | | { |
|---|
| 741 | | /* Small wait */ |
|---|
| 742 | | b_force_update = false; |
|---|
| 743 | | msleep( 10*1000 ); |
|---|
| 744 | | } |
|---|
| | 741 | |
|---|
| | 742 | /* */ |
|---|
| | 743 | i_deadline = 0; |
|---|
| | 744 | if( p_input->i_state == PAUSE_S ) |
|---|
| | 745 | i_deadline = __MIN( i_intf_update, i_statistic_update ); |
|---|
| 745 | 746 | |
|---|
| 746 | 747 | /* Handle control */ |
|---|
| 747 | 748 | vlc_mutex_lock( &p_input->p->lock_control ); |
|---|
| 748 | 749 | ControlReduce( p_input ); |
|---|
| 749 | | while( !ControlPopNoLock( p_input, &i_type, &val ) ) |
|---|
| | 750 | while( !ControlPopNoLock( p_input, &i_type, &val, i_deadline ) ) |
|---|
| 750 | 751 | { |
|---|
| 751 | 752 | msg_Dbg( p_input, "control type=%d", i_type ); |
|---|
| … | … | |
| 1397 | 1398 | *****************************************************************************/ |
|---|
| 1398 | 1399 | static inline int ControlPopNoLock( input_thread_t *p_input, |
|---|
| 1399 | | int *pi_type, vlc_value_t *p_val ) |
|---|
| 1400 | | { |
|---|
| 1401 | | if( p_input->p->i_control <= 0 ) |
|---|
| 1402 | | { |
|---|
| 1403 | | return VLC_EGENERIC; |
|---|
| | 1400 | int *pi_type, vlc_value_t *p_val, |
|---|
| | 1401 | mtime_t i_deadline ) |
|---|
| | 1402 | { |
|---|
| | 1403 | |
|---|
| | 1404 | while( p_input->p->i_control <= 0 ) |
|---|
| | 1405 | { |
|---|
| | 1406 | if( i_deadline <= 0 ) |
|---|
| | 1407 | return VLC_EGENERIC; |
|---|
| | 1408 | |
|---|
| | 1409 | if( vlc_cond_timedwait( &p_input->p->wait_control, &p_input->p->lock_control, i_deadline ) ) |
|---|
| | 1410 | return VLC_EGENERIC; |
|---|
| 1404 | 1411 | } |
|---|
| 1405 | 1412 | |
|---|
| rc35c18a |
r253ac45 |
|
| 148 | 148 | /* Buffer of pending actions */ |
|---|
| 149 | 149 | vlc_mutex_t lock_control; |
|---|
| | 150 | vlc_cond_t wait_control; |
|---|
| 150 | 151 | int i_control; |
|---|
| 151 | 152 | struct |
|---|
| … | … | |
| 212 | 213 | memset( &p_input->p->control[0].val, 0, sizeof( vlc_value_t ) ); |
|---|
| 213 | 214 | } |
|---|
| 214 | | else |
|---|
| 215 | | if( p_input->p->i_control >= INPUT_CONTROL_FIFO_SIZE ) |
|---|
| | 215 | else if( p_input->p->i_control >= INPUT_CONTROL_FIFO_SIZE ) |
|---|
| 216 | 216 | { |
|---|
| 217 | 217 | msg_Err( p_input, "input control fifo overflow, trashing type=%d", |
|---|
| … | … | |
| 229 | 229 | p_input->p->i_control++; |
|---|
| 230 | 230 | } |
|---|
| | 231 | vlc_cond_signal( &p_input->p->wait_control ); |
|---|
| 231 | 232 | vlc_mutex_unlock( &p_input->p->lock_control ); |
|---|
| 232 | 233 | } |
|---|