Fix wrong rtp signal table refactoring in case of callback with 1 or 2 parameters

parent 93d40979
......@@ -22,7 +22,7 @@
#define RTP_CALLBACK_TABLE_MAX_ENTRIES 5
typedef void (*RtpCallback)(struct _RtpSession *, unsigned long arg1, unsigned long arg2, void* userdata);
typedef void (*RtpCallback)(struct _RtpSession *, unsigned long arg1, unsigned long arg2, unsigned long userdata);
struct _RtpSignalTable
{
......
......@@ -34,7 +34,7 @@ void rtp_signal_table_init(RtpSignalTable *table,RtpSession *session, const char
int rtp_signal_table_add(RtpSignalTable *table,RtpCallback cb, void *user_data)
{
int i;
for (i=0;i<RTP_CALLBACK_TABLE_MAX_ENTRIES;i++){
if (table->callback[i]==NULL){
table->callback[i]=cb;
......@@ -47,32 +47,46 @@ int rtp_signal_table_add(RtpSignalTable *table,RtpCallback cb, void *user_data)
}
void rtp_signal_table_emit3(RtpSignalTable *table, unsigned long arg1, unsigned long arg2)
void rtp_signal_table_emit(RtpSignalTable *table)
{
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,table->user_data[i]);
table->callback[i](table->session,(unsigned long)table->user_data[i],0,0);
}
}
}
void rtp_signal_table_emit(RtpSignalTable *table)
void rtp_signal_table_emit2(RtpSignalTable *table,unsigned long arg)
{
return rtp_signal_table_emit3(table, 0, 0);
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);
}
}
}
void rtp_signal_table_emit2(RtpSignalTable *table,unsigned long arg)
void rtp_signal_table_emit3(RtpSignalTable *table, unsigned long arg1, unsigned long arg2)
{
return rtp_signal_table_emit3(table, arg, 0);
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]);
}
}
}
int rtp_signal_table_remove_by_callback(RtpSignalTable *table,RtpCallback cb)
{
int i;
for (i=0;i<RTP_CALLBACK_TABLE_MAX_ENTRIES;i++){
if (table->callback[i]==cb){
table->callback[i]=NULL;
......
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