Commit c32494e2 authored by Ghislain MARY's avatar Ghislain MARY

Fix issues with pointers being cast to long on Windows 64 bit.

parent 306da462
......@@ -190,10 +190,10 @@ typedef enum {
OrtpRtcpXrEnhancedPlc
} OrtpRtcpXrPlcStatus;
typedef OrtpRtcpXrPlcStatus (*OrtpRtcpXrPlcCallback)(unsigned long userdata);
typedef int (*OrtpRtcpXrSignalLevelCallback)(unsigned long userdata);
typedef int (*OrtpRtcpXrNoiseLevelCallback)(unsigned long userdata);
typedef float (*OrtpRtcpXrAverageQualityIndicatorCallback)(unsigned long userdata);
typedef OrtpRtcpXrPlcStatus (*OrtpRtcpXrPlcCallback)(void *userdata);
typedef int (*OrtpRtcpXrSignalLevelCallback)(void *userdata);
typedef int (*OrtpRtcpXrNoiseLevelCallback)(void *userdata);
typedef float (*OrtpRtcpXrAverageQualityIndicatorCallback)(void *userdata);
typedef struct OrtpRtcpXrMediaCallbacks {
OrtpRtcpXrPlcCallback plc;
......@@ -201,7 +201,7 @@ typedef struct OrtpRtcpXrMediaCallbacks {
OrtpRtcpXrNoiseLevelCallback noise_level;
OrtpRtcpXrAverageQualityIndicatorCallback average_qi;
OrtpRtcpXrAverageQualityIndicatorCallback average_lq_qi;
unsigned long userdata;
void *userdata;
} OrtpRtcpXrMediaCallbacks;
typedef enum {
......
......@@ -22,7 +22,7 @@
#define RTP_CALLBACK_TABLE_MAX_ENTRIES 5
typedef void (*RtpCallback)(struct _RtpSession *, unsigned long arg1, unsigned long arg2, unsigned long arg3);
typedef void (*RtpCallback)(struct _RtpSession *, void *arg1, void *arg2, void *arg3);
struct _RtpSignalTable
{
......@@ -42,10 +42,10 @@ int rtp_signal_table_add(RtpSignalTable *table,RtpCallback cb, void *user_data);
void rtp_signal_table_emit(RtpSignalTable *table);
/* emit but with a second arg */
void rtp_signal_table_emit2(RtpSignalTable *table, unsigned long arg);
void rtp_signal_table_emit2(RtpSignalTable *table, void *arg);
/* emit but with a third arg */
void rtp_signal_table_emit3(RtpSignalTable *table, unsigned long arg1, unsigned long arg2);
void rtp_signal_table_emit3(RtpSignalTable *table, void *arg1, void *arg2);
int rtp_signal_table_remove_by_callback(RtpSignalTable *table,RtpCallback cb);
......
......@@ -301,7 +301,7 @@ void rtp_session_rtp_parse(RtpSession *session, mblk_t *mp, uint32_t local_str_t
/* detect timestamp important jumps in the future, to workaround stupid rtp senders */
if (RTP_TIMESTAMP_IS_NEWER_THAN(rtp->timestamp,session->rtp.rcv_last_ts+session->rtp.ts_jump)){
ortp_warning("rtp_parse: timestamp jump in the future detected.");
rtp_signal_table_emit2(&session->on_timestamp_jump,(long)&rtp->timestamp);
rtp_signal_table_emit2(&session->on_timestamp_jump,&rtp->timestamp);
}
else if (RTP_TIMESTAMP_IS_STRICTLY_NEWER_THAN(session->rtp.rcv_last_ts,rtp->timestamp)
|| RTP_SEQ_IS_STRICTLY_GREATER_THAN(session->rtp.rcv_last_seq,rtp->seq_number)){
......@@ -313,8 +313,7 @@ void rtp_session_rtp_parse(RtpSession *session, mblk_t *mp, uint32_t local_str_t
if ( RTP_TIMESTAMP_IS_STRICTLY_NEWER_THAN(session->rtp.rcv_last_ts, rtp->timestamp + session->rtp.ts_jump) ){
ortp_warning("rtp_parse: negative timestamp jump detected");
rtp_signal_table_emit2(&session->on_timestamp_jump,
(long)&rtp->timestamp);
rtp_signal_table_emit2(&session->on_timestamp_jump, &rtp->timestamp);
}
ortp_debug("rtp_parse: discarding too old packet (ts=%i)",rtp->timestamp);
freemsg(mp);
......
......@@ -1139,7 +1139,7 @@ rtp_session_recvm_with_ts (RtpSession * session, uint32_t user_ts)
int msgsize=msgdsize(mp);
ortp_global_stats.recv += msgsize;
stream->stats.recv += msgsize;
rtp_signal_table_emit2(&session->on_telephone_event_packet,(long)mp);
rtp_signal_table_emit2(&session->on_telephone_event_packet,mp);
rtp_session_check_telephone_events(session,mp);
freemsg(mp);
mp=NULL;
......
......@@ -1079,7 +1079,7 @@ static int rtp_session_rtp_sendto(RtpSession * session, mblk_t * m, struct socka
/*errors to auxiliary destinations are not notified*/
if (error < 0){
if (session->on_network_error.count>0){
rtp_signal_table_emit3(&session->on_network_error,(long)"Error sending RTP packet",INT_TO_POINTER(getSocketErrorCode()));
rtp_signal_table_emit3(&session->on_network_error,(long)"Error sending RTP packet",ORTP_INT_TO_POINTER(getSocketErrorCode()));
}else log_send_error(session,"rtp",m,destaddr,destlen);
session->rtp.send_errno=getSocketErrorCode();
}else{
......@@ -1137,7 +1137,7 @@ static int rtp_session_rtcp_sendto(RtpSession * session, mblk_t * m, struct sock
if (!is_aux){
if (error < 0){
if (session->on_network_error.count>0){
rtp_signal_table_emit3(&session->on_network_error,(long)"Error sending RTCP packet",INT_TO_POINTER(getSocketErrorCode()));
rtp_signal_table_emit3(&session->on_network_error,(long)"Error sending RTCP packet",ORTP_INT_TO_POINTER(getSocketErrorCode()));
}else{
log_send_error(session,"rtcp",m,destaddr,destlen);
}
......@@ -1564,7 +1564,7 @@ int rtp_session_rtp_recv (RtpSession * session, uint32_t user_ts) {
if (error==-1 && !is_would_block_error((errnum=getSocketErrorCode())) )
{
if (session->on_network_error.count>0){
rtp_signal_table_emit3(&session->on_network_error,(long)"Error receiving RTP packet",INT_TO_POINTER(getSocketErrorCode()));
rtp_signal_table_emit3(&session->on_network_error,(long)"Error receiving RTP packet",ORTP_INT_TO_POINTER(getSocketErrorCode()));
}else ortp_warning("Error receiving RTP packet: %s, err num [%i],error [%i]",getSocketError(),errnum,error);
#ifdef __ios
/*hack for iOS and non-working socket because of background mode*/
......@@ -1641,7 +1641,7 @@ int rtp_session_rtcp_recv (RtpSession * session) {
if (error==-1 && !is_would_block_error((errnum=getSocketErrorCode())) )
{
if (session->on_network_error.count>0){
rtp_signal_table_emit3(&session->on_network_error,(long)"Error receiving RTCP packet",INT_TO_POINTER(getSocketErrorCode()));
rtp_signal_table_emit3(&session->on_network_error,(long)"Error receiving RTCP packet",ORTP_INT_TO_POINTER(getSocketErrorCode()));
}else ortp_warning("Error receiving RTCP packet: %s, err num [%i],error [%i]",getSocketError(),errnum,error);
#ifdef __ios
/*hack for iOS and non-working socket because of background mode*/
......
......@@ -54,31 +54,31 @@ void rtp_signal_table_emit(RtpSignalTable *table)
for (i=0,c=0;c<table->count;i++){
if (table->callback[i]!=NULL){
c++; /*I like it*/
table->callback[i](table->session,(unsigned long)table->user_data[i],0,0);
table->callback[i](table->session,table->user_data[i],0,0);
}
}
}
void rtp_signal_table_emit2(RtpSignalTable *table,unsigned long arg)
void rtp_signal_table_emit2(RtpSignalTable *table, void *arg)
{
int i,c;
for (i=0,c=0;c<table->count;i++){
if (table->callback[i]!=NULL){
c++; /*I like it*/
table->callback[i](table->session,arg,(unsigned long)table->user_data[i],0);
table->callback[i](table->session,arg,table->user_data[i],0);
}
}
}
void rtp_signal_table_emit3(RtpSignalTable *table, unsigned long arg1, unsigned long arg2)
void rtp_signal_table_emit3(RtpSignalTable *table, void *arg1, void *arg2)
{
int i,c;
for (i=0,c=0;c<table->count;i++){
if (table->callback[i]!=NULL){
c++; /*I like it*/
table->callback[i](table->session,arg1,arg2,(unsigned long)table->user_data[i]);
table->callback[i](table->session,arg1,arg2,table->user_data[i]);
}
}
}
......
......@@ -339,7 +339,7 @@ int rtp_session_read_telephone_event(RtpSession *session,
static void notify_tev(RtpSession *session, telephone_event_t *event){
OrtpEvent *ev;
OrtpEventData *evd;
rtp_signal_table_emit2(&session->on_telephone_event,(long)(long)event[0].event);
rtp_signal_table_emit2(&session->on_telephone_event,ORTP_INT_TO_POINTER(event[0].event));
if (session->eventqs!=NULL){
ev=ortp_event_new(ORTP_EVENT_TELEPHONE_EVENT);
evd=ortp_event_get_data(ev);
......
......@@ -46,8 +46,8 @@ OList * o_list_free(OList *elem);
OList *o_list_remove_link(OList *list, OList *elem);
#define INT_TO_POINTER(truc) ((long)(long)(truc))
#define POINTER_TO_INT(truc) ((int)(long)(truc))
#define ORTP_INT_TO_POINTER(truc) ((void *)(long long)(truc))
#define ORTP_POINTER_TO_INT(truc) ((int)(long long)(truc))
typedef struct _dwsplit_t{
#ifdef ORTP_BIGENDIAN
......
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