1111 * DECLARATIONS
1212 ******************************************************************************/
1313
14- static inline int __rtcp_send_sr (struct connection_item_t * con );
14+ static inline int __rtcp_send_sr (struct connection_item_t * con , int track_id );
1515
1616
1717/******************************************************************************
1818 * INLINE FUNCTIONS
1919 ******************************************************************************/
20- static inline int __rtcp_send_sr (struct connection_item_t * con )
20+ static inline int __rtcp_send_sr (struct connection_item_t * con , int track_id )
2121{
2222 struct timeval tv ;
2323 unsigned int ts_h ;
2424 unsigned int ts_l ;
2525 int send_bytes ;
2626 struct sockaddr_in to_addr ;
27+ transport_t * t ;
28+
29+ ASSERT (track_id >= 0 &&
30+ track_id < (int )(sizeof (con -> trans ) / sizeof (con -> trans [0 ])),
31+ return FAILURE );
32+ t = & con -> trans [track_id ];
2733
2834 ASSERT (gettimeofday (& tv ,NULL ) == 0 , return FAILURE );
2935
@@ -34,21 +40,21 @@ static inline int __rtcp_send_sr(struct connection_item_t *con)
3440 r : { sr : { ssrc : htonl (con -> ssrc ),
3541 ntp_sec : htonl (ts_h ),
3642 ntp_frac : htonl (ts_l ),
37- rtp_ts : htonl (con -> trans [ con -> track_id ]. rtp_timestamp ),
38- psent : htonl (con -> trans [ con -> track_id ]. rtcp_packet_cnt ),
39- osent : htonl (con -> trans [ con -> track_id ]. rtcp_octet )}}};
43+ rtp_ts : htonl (t -> rtp_timestamp ),
44+ psent : htonl (t -> rtcp_packet_cnt ),
45+ osent : htonl (t -> rtcp_octet )}}};
4046
4147 to_addr = con -> addr ;
42- to_addr .sin_port = con -> trans [ con -> track_id ]. client_port_rtcp ;
48+ to_addr .sin_port = t -> client_port_rtcp ;
4349
44- ASSERT ((send_bytes = send (con -> trans [ con -> track_id ]. server_rtcp_fd ,
50+ ASSERT ((send_bytes = send (t -> server_rtcp_fd ,
4551 & (rtcp ),36 ,0 )) == 36 , ({
4652 ERR ("send:%d:%s¥n" ,send_bytes ,strerror (errno ));
4753 return FAILURE ;}));
4854
49- con -> trans [ con -> track_id ]. rtcp_packet_cnt = 0 ;
50- con -> trans [ con -> track_id ]. rtcp_octet = 0 ;
51- con -> trans [ con -> track_id ]. rtcp_tick = con -> trans [ con -> track_id ]. rtcp_tick_org ;
55+ t -> rtcp_packet_cnt = 0 ;
56+ t -> rtcp_octet = 0 ;
57+ t -> rtcp_tick = t -> rtcp_tick_org ;
5258
5359 return SUCCESS ;
5460}
0 commit comments