Commit f2491f9b authored by Marian Ďurkovič's avatar Marian Ďurkovič Committed by Christophe Massiot

* demux.c: Fix multiple PID refcounting.

parent b7e58850
...@@ -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;
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 ); 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