New upstream version 4.4.13
Bernhard Schmidt
3 years ago
394 | 394 |
**/
|
395 | 395 |
struct _RtpSession
|
396 | 396 |
{
|
|
397 |
ortp_mutex_t main_mutex; /* To protect data that can be accessed simultaneously by a control thread and the real-time thread in charge of sending/receiving. */
|
397 | 398 |
RtpSession *next; /* next RtpSession, when the session are enqueued by the scheduler */
|
398 | 399 |
int mask_pos; /* the position in the scheduler mask of RtpSession : do not move this field: it is part of the ABI since the session_set macros use it*/
|
399 | 400 |
struct {
|
40 | 40 |
#cmakedefine ORTP_DEFAULT_THREAD_STACK_SIZE ${ORTP_DEFAULT_THREAD_STACK_SIZE}
|
41 | 41 |
#cmakedefine POSIXTIMER_INTERVAL ${POSIXTIMER_INTERVAL}
|
42 | 42 |
#cmakedefine __APPLE_USE_RFC_3542
|
43 | |
|
44 | |
#cmakedefine ENABLE_MICROSOFT_STORE_APP
|
232 | 232 |
return;
|
233 | 233 |
}
|
234 | 234 |
memset (session, 0, sizeof (RtpSession));
|
|
235 |
ortp_mutex_init(&session->main_mutex, NULL);
|
235 | 236 |
session->mode = (RtpSessionMode) mode;
|
236 | 237 |
if ((mode == RTP_SESSION_RECVONLY) || (mode == RTP_SESSION_SENDRECV))
|
237 | 238 |
{
|
|
1689 | 1690 |
freemsg(session->rtcp.tmmbr_info.received);
|
1690 | 1691 |
if (session->rtcp.send_algo.fb_packets)
|
1691 | 1692 |
freemsg(session->rtcp.send_algo.fb_packets);
|
|
1693 |
ortp_mutex_destroy(&session->main_mutex);
|
1692 | 1694 |
}
|
1693 | 1695 |
|
1694 | 1696 |
/**
|
928 | 928 |
ortp_free(aux_rtp);
|
929 | 929 |
ortp_free(aux_rtcp);
|
930 | 930 |
}else{
|
|
931 |
ortp_mutex_lock(&session->main_mutex);
|
931 | 932 |
session->rtp.gs.aux_destinations=o_list_append(session->rtp.gs.aux_destinations,aux_rtp);
|
932 | 933 |
session->rtcp.gs.aux_destinations=o_list_append(session->rtcp.gs.aux_destinations,aux_rtcp);
|
|
934 |
ortp_mutex_unlock(&session->main_mutex);
|
933 | 935 |
}
|
934 | 936 |
}
|
935 | 937 |
return err;
|
|
959 | 961 |
}
|
960 | 962 |
|
961 | 963 |
void rtp_session_clear_aux_remote_addr(RtpSession * session){
|
|
964 |
ortp_mutex_lock(&session->main_mutex);
|
962 | 965 |
ortp_stream_clear_aux_addresses(&session->rtp.gs);
|
963 | 966 |
ortp_stream_clear_aux_addresses(&session->rtcp.gs);
|
|
967 |
ortp_mutex_unlock(&session->main_mutex);
|
964 | 968 |
}
|
965 | 969 |
|
966 | 970 |
void rtp_session_set_sockets(RtpSession *session, int rtpfd, int rtcpfd){
|
|
1423 | 1427 |
/*first send to main destination*/
|
1424 | 1428 |
error=rtp_session_rtp_sendto(session,m,destaddr,destlen,FALSE);
|
1425 | 1429 |
/*then iterate over auxiliary destinations*/
|
|
1430 |
ortp_mutex_lock(&session->main_mutex);
|
1426 | 1431 |
for(elem=session->rtp.gs.aux_destinations;elem!=NULL;elem=elem->next){
|
1427 | 1432 |
OrtpAddress *addr=(OrtpAddress*)elem->data;
|
1428 | 1433 |
rtp_session_rtp_sendto(session,m,(struct sockaddr*)&addr->addr,addr->len,TRUE);
|
1429 | 1434 |
}
|
|
1435 |
ortp_mutex_unlock(&session->main_mutex);
|
1430 | 1436 |
freemsg(m);
|
1431 | 1437 |
return error;
|
1432 | 1438 |
}
|