Commit 5f8fde36 authored by massiot's avatar massiot

* demux.c: Fix multiple PID refcounting, patch by Marian Ďurkovič.


git-svn-id: svn://svn.videolan.org/dvblast/trunk@44 55d3f8b6-4a41-4d2d-a900-313d1436a5b8
parent 0be26c12
...@@ -471,14 +471,12 @@ static void StartPID( output_t *p_output, uint16_t i_pid ) ...@@ -471,14 +471,12 @@ static void StartPID( output_t *p_output, uint16_t i_pid )
} }
p_pids[i_pid].pp_outputs[j] = p_output; p_pids[i_pid].pp_outputs[j] = p_output;
SetPID( i_pid );
} }
SetPID( i_pid );
} }
static void StopPID( output_t *p_output, uint16_t i_pid ) static void StopPID( output_t *p_output, uint16_t i_pid )
{ {
int b_wanted = 0;
int j; int j;
for ( j = 0; j < p_pids[i_pid].i_nb_outputs; j++ ) for ( j = 0; j < p_pids[i_pid].i_nb_outputs; j++ )
...@@ -487,20 +485,16 @@ static void StopPID( output_t *p_output, uint16_t i_pid ) ...@@ -487,20 +485,16 @@ static void StopPID( output_t *p_output, uint16_t i_pid )
{ {
if ( p_pids[i_pid].pp_outputs[j] == p_output ) if ( p_pids[i_pid].pp_outputs[j] == p_output )
break; break;
b_wanted = 1;
} }
} }
if ( j == p_pids[i_pid].i_nb_outputs ) if ( j == p_pids[i_pid].i_nb_outputs )
msg_Warn( NULL, "unselecting an unselected PID %d", i_pid ); msg_Warn( NULL, "unselecting an unselected PID %d", i_pid );
else else
{
p_pids[i_pid].pp_outputs[j] = NULL; p_pids[i_pid].pp_outputs[j] = NULL;
UnsetPID( i_pid );
for ( j++; !b_wanted && j < p_pids[i_pid].i_nb_outputs; j++ ) }
if ( p_pids[i_pid].pp_outputs[j] != NULL )
b_wanted = 1;
UnsetPID( i_pid );
} }
/***************************************************************************** /*****************************************************************************
......
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