Commit 0afe6776 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Fix small issues in mux/ts.c:

- Fix potential memleak with SDT descriptors
- Fix compiler warning about unused variables when not using SDT descriptors
- Fix compiler warning about wrong type of psz_sdt_desc
- Add parenthesis
parent 79f436db
...@@ -1336,16 +1336,16 @@ static int Mux( sout_mux_t *p_mux ) ...@@ -1336,16 +1336,16 @@ static int Mux( sout_mux_t *p_mux )
p_input = p_mux->pp_inputs[i]; p_input = p_mux->pp_inputs[i];
p_stream = (ts_stream_t*)p_input->p_sys; p_stream = (ts_stream_t*)p_input->p_sys;
if( ( p_stream == p_pcr_stream && if( ( ( p_stream == p_pcr_stream ) &&
p_stream->i_pes_length < i_shaping_delay ) || ( p_stream->i_pes_length < i_shaping_delay ) ) ||
p_stream->i_pes_dts + p_stream->i_pes_length < ( p_stream->i_pes_dts + p_stream->i_pes_length <
p_pcr_stream->i_pes_dts + p_pcr_stream->i_pes_length ) p_pcr_stream->i_pes_dts + p_pcr_stream->i_pes_length ) )
{ {
/* Need more data */ /* Need more data */
if( block_FifoCount( p_input->p_fifo ) <= 1 ) if( block_FifoCount( p_input->p_fifo ) <= 1 )
{ {
if( p_input->p_fmt->i_cat == AUDIO_ES || if( ( p_input->p_fmt->i_cat == AUDIO_ES ) ||
p_input->p_fmt->i_cat == VIDEO_ES ) ( p_input->p_fmt->i_cat == VIDEO_ES ) )
{ {
/* We need more data */ /* We need more data */
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -1355,7 +1355,7 @@ static int Mux( sout_mux_t *p_mux ) ...@@ -1355,7 +1355,7 @@ static int Mux( sout_mux_t *p_mux )
/* spu, only one packet is needed */ /* spu, only one packet is needed */
continue; continue;
} }
else else if( p_input->p_fmt->i_cat == SPU_ES )
{ {
/* Don't mux the SPU yet if it is too early */ /* Don't mux the SPU yet if it is too early */
block_t *p_spu = block_FifoShow( p_input->p_fifo ); block_t *p_spu = block_FifoShow( p_input->p_fifo );
...@@ -1363,12 +1363,12 @@ static int Mux( sout_mux_t *p_mux ) ...@@ -1363,12 +1363,12 @@ static int Mux( sout_mux_t *p_mux )
i_spu_delay = i_spu_delay =
p_spu->i_dts - p_pcr_stream->i_pes_dts; p_spu->i_dts - p_pcr_stream->i_pes_dts;
if( i_spu_delay > i_shaping_delay && if( ( i_spu_delay > i_shaping_delay ) &&
i_spu_delay < I64C(100000000) ) ( i_spu_delay < I64C(100000000) ) )
continue; continue;
if ( i_spu_delay >= I64C(100000000) if ( ( i_spu_delay >= I64C(100000000) ) ||
|| i_spu_delay < I64C(10000) ) ( i_spu_delay < I64C(10000) ) )
{ {
BufferChainClean( p_mux->p_sout, BufferChainClean( p_mux->p_sout,
&p_stream->chain_pes ); &p_stream->chain_pes );
...@@ -2211,19 +2211,25 @@ static void GetPMT( sout_mux_t *p_mux, sout_buffer_chain_t *c ) ...@@ -2211,19 +2211,25 @@ static void GetPMT( sout_mux_t *p_mux, sout_buffer_chain_t *c )
{ {
sout_mux_sys_t *p_sys = p_mux->p_sys; sout_mux_sys_t *p_sys = p_mux->p_sys;
block_t *p_pmt[MAX_PMT]; block_t *p_pmt[MAX_PMT];
block_t *p_sdt;
dvbpsi_sdt_t sdt;
dvbpsi_pmt_es_t *p_es; dvbpsi_pmt_es_t *p_es;
dvbpsi_psi_section_t *p_section[MAX_PMT], *p_section2; dvbpsi_psi_section_t *p_section[MAX_PMT];
dvbpsi_sdt_service_t *p_service;
char *psz_sdt_desc;
int i_pidinput;
int i_pidinput;
int i_stream; int i_stream;
int i; int i;
int *p_usepid = NULL; int *p_usepid = NULL;
#ifdef HAVE_DVBPSI_SDT
block_t *p_sdt;
dvbpsi_sdt_t sdt;
dvbpsi_psi_section_t* p_section2;
dvbpsi_sdt_service_t *p_service;
uint8_t *psz_sdt_desc;
#endif
if( p_sys->dvbpmt == NULL ) if( p_sys->dvbpmt == NULL )
p_sys->dvbpmt = malloc( p_sys->i_num_pmt * sizeof(dvbpsi_pmt_t) ); p_sys->dvbpmt = malloc( p_sys->i_num_pmt * sizeof(dvbpsi_pmt_t) );
#ifdef HAVE_DVBPSI_SDT #ifdef HAVE_DVBPSI_SDT
...@@ -2253,10 +2259,12 @@ static void GetPMT( sout_mux_t *p_mux, sout_buffer_chain_t *c ) ...@@ -2253,10 +2259,12 @@ static void GetPMT( sout_mux_t *p_mux, sout_buffer_chain_t *c )
#define psz_sdtserv p_sys->sdt_descriptors[i].psz_service_name #define psz_sdtserv p_sys->sdt_descriptors[i].psz_service_name
/* FIXME: Ineffecient malloc's & ugly code...... */ /* FIXME: Ineffecient malloc's & ugly code...... */
if( psz_sdtprov != NULL && psz_sdtserv != NULL ) if( ( psz_sdtprov != NULL ) && ( psz_sdtserv != NULL ) )
{ {
psz_sdt_desc = malloc( 3 + strlen(psz_sdtprov) psz_sdt_desc = malloc( 3 + strlen(psz_sdtprov)
+ strlen(psz_sdtserv) ); + strlen(psz_sdtserv) );
if( psz_sdt_desc )
{
psz_sdt_desc[0] = 0x01; /* digital television service */ psz_sdt_desc[0] = 0x01; /* digital television service */
/* service provider name length */ /* service provider name length */
...@@ -2271,8 +2279,10 @@ static void GetPMT( sout_mux_t *p_mux, sout_buffer_chain_t *c ) ...@@ -2271,8 +2279,10 @@ static void GetPMT( sout_mux_t *p_mux, sout_buffer_chain_t *c )
dvbpsi_SDTServiceAddDescriptor( p_service, 0x48, dvbpsi_SDTServiceAddDescriptor( p_service, 0x48,
3 + strlen(psz_sdtprov) + strlen(psz_sdtserv), 3 + strlen(psz_sdtprov) + strlen(psz_sdtserv),
psz_sdt_desc ); (uint8_t *)psz_sdt_desc );
free( psz_sdt_desc ); free( psz_sdt_desc );
psz_sdt_desc = NULL;
}
} }
#undef psz_sdtprov #undef psz_sdtprov
#undef psz_sdtserv #undef psz_sdtserv
......
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