Commit 2b7961e1 authored by Rémi Duraffort's avatar Rémi Duraffort

Simplify code and remove unneeded tests.

parent 9e1c977b
...@@ -64,8 +64,7 @@ static int SDES_client_item_del( rtcp_client_t *p_client ) ...@@ -64,8 +64,7 @@ static int SDES_client_item_del( rtcp_client_t *p_client )
rtcp_SDES_item_t *p_old = p_client->pp_sdes[i]; rtcp_SDES_item_t *p_old = p_client->pp_sdes[i];
REMOVE_ELEM( p_client->pp_sdes, p_client->i_items, i ); REMOVE_ELEM( p_client->pp_sdes, p_client->i_items, i );
p_client->i_items--; p_client->i_items--;
if( p_old->psz_data) free( p_old->psz_data );
free( p_old->psz_data );
free( p_old ); free( p_old );
} }
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -332,15 +331,12 @@ static int rtcp_decode_SR( vlc_object_t *p_this, rtcp_pkt_t *p_pkt ) ...@@ -332,15 +331,12 @@ static int rtcp_decode_SR( vlc_object_t *p_this, rtcp_pkt_t *p_pkt )
rtcp_client_t *p_client = NULL; rtcp_client_t *p_client = NULL;
uint32_t i_pos = 0; uint32_t i_pos = 0;
uint32_t u_ssrc = 0; uint32_t u_ssrc = 0;
int result = 0;
u_ssrc = bs_read( p_rtcp->bs, 32 ); u_ssrc = bs_read( p_rtcp->bs, 32 );
result = p_rtcp->pf_find_client( p_this, u_ssrc, &i_pos ); if( p_rtcp->pf_find_client( p_this, u_ssrc, &i_pos ) == VLC_EGENERIC )
if( result == VLC_EGENERIC )
{ {
result = p_rtcp->pf_add_client( p_this, p_pkt->u_ssrc, &i_pos ); if( p_rtcp->pf_add_client( p_this, p_pkt->u_ssrc, &i_pos ) == VLC_EGENERIC )
if( result == VLC_EGENERIC )
return VLC_ENOMEM; return VLC_ENOMEM;
} }
vlc_object_lock( p_rtcp ); vlc_object_lock( p_rtcp );
...@@ -400,15 +396,12 @@ static int rtcp_decode_RR( vlc_object_t *p_this, rtcp_pkt_t *p_pkt ) ...@@ -400,15 +396,12 @@ static int rtcp_decode_RR( vlc_object_t *p_this, rtcp_pkt_t *p_pkt )
rtcp_client_t *p_client = NULL; rtcp_client_t *p_client = NULL;
uint32_t i_pos = 0; uint32_t i_pos = 0;
uint32_t u_ssrc = 0; uint32_t u_ssrc = 0;
int result = 0;
u_ssrc = bs_read( p_rtcp->bs, 32 ); u_ssrc = bs_read( p_rtcp->bs, 32 );
result = p_rtcp->pf_find_client( p_this, u_ssrc, &i_pos ); if( p_rtcp->pf_find_client( p_this, u_ssrc, &i_pos ) == VLC_EGENERIC )
if( result == VLC_EGENERIC )
{ {
result = p_rtcp->pf_add_client( p_this, p_pkt->u_ssrc, &i_pos ); if( p_rtcp->pf_add_client( p_this, p_pkt->u_ssrc, &i_pos ) == VLC_EGENERIC )
if( result == VLC_EGENERIC )
return VLC_ENOMEM; return VLC_ENOMEM;
} }
...@@ -466,15 +459,12 @@ static int rtcp_decode_SDES( vlc_object_t *p_this, rtcp_pkt_t *p_pkt ) ...@@ -466,15 +459,12 @@ static int rtcp_decode_SDES( vlc_object_t *p_this, rtcp_pkt_t *p_pkt )
uint8_t u_item = 0; uint8_t u_item = 0;
uint8_t u_length = 0; uint8_t u_length = 0;
int i = 0; int i = 0;
int result = 0;
u_ssrc = bs_read( p_rtcp->bs, 32 ); u_ssrc = bs_read( p_rtcp->bs, 32 );
result = p_rtcp->pf_find_client( p_this, u_ssrc, &i_pos ); if( p_rtcp->pf_find_client( p_this, u_ssrc, &i_pos ) == VLC_EGENERIC )
if( result == VLC_EGENERIC )
{ {
result = p_rtcp->pf_add_client( p_this, p_pkt->u_ssrc, &i_pos ); if( p_rtcp->pf_add_client( p_this, p_pkt->u_ssrc, &i_pos ) == VLC_EGENERIC )
if( result == VLC_EGENERIC )
return VLC_ENOMEM; return VLC_ENOMEM;
} }
...@@ -580,7 +570,6 @@ static int rtcp_decode_APP( vlc_object_t *p_this, rtcp_pkt_t *p_pkt ) ...@@ -580,7 +570,6 @@ static int rtcp_decode_APP( vlc_object_t *p_this, rtcp_pkt_t *p_pkt )
uint32_t u_ssrc = 0; uint32_t u_ssrc = 0;
uint32_t i_pos = 0; uint32_t i_pos = 0;
uint32_t i = 0; uint32_t i = 0;
int result = 0;
if( !p_pkt ) if( !p_pkt )
return VLC_EGENERIC; return VLC_EGENERIC;
...@@ -589,11 +578,9 @@ static int rtcp_decode_APP( vlc_object_t *p_this, rtcp_pkt_t *p_pkt ) ...@@ -589,11 +578,9 @@ static int rtcp_decode_APP( vlc_object_t *p_this, rtcp_pkt_t *p_pkt )
u_ssrc = bs_read( p_rtcp->bs, 32 ); u_ssrc = bs_read( p_rtcp->bs, 32 );
result = p_rtcp->pf_find_client( p_this, u_ssrc, &i_pos ); if( p_rtcp->pf_find_client( p_this, u_ssrc, &i_pos ) == VLC_EGENERIC )
if( result == VLC_EGENERIC )
{ {
result = p_rtcp->pf_add_client( p_this, p_pkt->u_ssrc, &i_pos ); if( p_rtcp->pf_add_client( p_this, p_pkt->u_ssrc, &i_pos ) == VLC_EGENERIC )
if( result == VLC_EGENERIC )
return VLC_ENOMEM; return VLC_ENOMEM;
} }
...@@ -823,7 +810,6 @@ block_t *rtcp_encode_SR( vlc_object_t *p_this, rtcp_pkt_t *p_pkt ) ...@@ -823,7 +810,6 @@ block_t *rtcp_encode_SR( vlc_object_t *p_this, rtcp_pkt_t *p_pkt )
rtcp_stats_t *p_stats = NULL; rtcp_stats_t *p_stats = NULL;
rtcp_client_t *p_client = NULL; rtcp_client_t *p_client = NULL;
uint32_t i_pos = 0; uint32_t i_pos = 0;
int result = 0;
if( p_pkt->u_payload_type != RTCP_SR ) if( p_pkt->u_payload_type != RTCP_SR )
return NULL; return NULL;
...@@ -858,8 +844,7 @@ block_t *rtcp_encode_SR( vlc_object_t *p_this, rtcp_pkt_t *p_pkt ) ...@@ -858,8 +844,7 @@ block_t *rtcp_encode_SR( vlc_object_t *p_this, rtcp_pkt_t *p_pkt )
bs_write( s, 32, p_pkt->report.sr.u_octet_count ); bs_write( s, 32, p_pkt->report.sr.u_octet_count );
/* report block */ /* report block */
result = p_rtcp->pf_find_client( p_this, p_pkt->u_ssrc, &i_pos ); if( p_rtcp->pf_find_client( p_this, p_pkt->u_ssrc, &i_pos ) == VLC_EGENERIC )
if( result == VLC_EGENERIC )
{ {
msg_Err( p_this, "SR: SSRC identifier doesn't exists", p_pkt->u_ssrc ); msg_Err( p_this, "SR: SSRC identifier doesn't exists", p_pkt->u_ssrc );
free( p_block ); free( p_block );
...@@ -898,7 +883,6 @@ block_t *rtcp_encode_RR( vlc_object_t *p_this, rtcp_pkt_t *p_pkt ) ...@@ -898,7 +883,6 @@ block_t *rtcp_encode_RR( vlc_object_t *p_this, rtcp_pkt_t *p_pkt )
rtcp_stats_t *p_stats = NULL; rtcp_stats_t *p_stats = NULL;
rtcp_client_t *p_client = NULL; rtcp_client_t *p_client = NULL;
uint32_t i_pos = 0; uint32_t i_pos = 0;
int result = 0;
if( p_pkt->u_payload_type != RTCP_RR ) if( p_pkt->u_payload_type != RTCP_RR )
return NULL; return NULL;
...@@ -919,8 +903,7 @@ block_t *rtcp_encode_RR( vlc_object_t *p_this, rtcp_pkt_t *p_pkt ) ...@@ -919,8 +903,7 @@ block_t *rtcp_encode_RR( vlc_object_t *p_this, rtcp_pkt_t *p_pkt )
bs_write( s, 32, p_pkt->u_ssrc ); bs_write( s, 32, p_pkt->u_ssrc );
/* report block */ /* report block */
result = p_rtcp->pf_find_client( p_this, p_pkt->u_ssrc, &i_pos ); if( p_rtcp->pf_find_client( p_this, p_pkt->u_ssrc, &i_pos ) == VLC_EGENERIC )
if( result == VLC_EGENERIC )
{ {
msg_Err( p_this, "RR: SSRC identifier doesn't exists", p_pkt->u_ssrc ); msg_Err( p_this, "RR: SSRC identifier doesn't exists", p_pkt->u_ssrc );
free( p_block ); free( p_block );
......
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