modify on_action_suggested callback's prototype

parent 38553e72
...@@ -101,7 +101,7 @@ struct _MSQosAnalyzerDesc{ ...@@ -101,7 +101,7 @@ struct _MSQosAnalyzerDesc{
struct _MSQosAnalyzer{ struct _MSQosAnalyzer{
MSQosAnalyzerDesc *desc; MSQosAnalyzerDesc *desc;
char *label; char *label;
void (*on_action_suggested)(void*, const char*,const char*); void (*on_action_suggested)(void*, int, const char**);
void *on_action_suggested_user_pointer; void *on_action_suggested_user_pointer;
int refcnt; int refcnt;
enum { enum {
...@@ -117,7 +117,7 @@ void ms_qos_analyzer_suggest_action(MSQosAnalyzer *obj, MSRateControlAction *act ...@@ -117,7 +117,7 @@ void ms_qos_analyzer_suggest_action(MSQosAnalyzer *obj, MSRateControlAction *act
bool_t ms_qos_analyzer_has_improved(MSQosAnalyzer *obj); bool_t ms_qos_analyzer_has_improved(MSQosAnalyzer *obj);
bool_t ms_qos_analyzer_process_rtcp(MSQosAnalyzer *obj, mblk_t *rtcp); bool_t ms_qos_analyzer_process_rtcp(MSQosAnalyzer *obj, mblk_t *rtcp);
void ms_qos_analyzer_update(MSQosAnalyzer *obj); void ms_qos_analyzer_update(MSQosAnalyzer *obj);
void ms_qos_analyzer_set_on_action_suggested(MSQosAnalyzer *obj, void (*on_action_suggested)(void*,const char*,const char*),void* u); void ms_qos_analyzer_set_on_action_suggested(MSQosAnalyzer *obj, void (*on_action_suggested)(void*,int,const char**),void* u);
/** /**
* The simple qos analyzer is an implementation of MSQosAnalyzer that performs analysis for single stream. * The simple qos analyzer is an implementation of MSQosAnalyzer that performs analysis for single stream.
......
...@@ -60,7 +60,7 @@ bool_t ms_qos_analyzer_has_improved(MSQosAnalyzer *obj){ ...@@ -60,7 +60,7 @@ bool_t ms_qos_analyzer_has_improved(MSQosAnalyzer *obj){
} }
void ms_qos_analyzer_set_on_action_suggested(MSQosAnalyzer *obj, void ms_qos_analyzer_set_on_action_suggested(MSQosAnalyzer *obj,
void (*on_action_suggested)(void*, const char*,const char*), void* u){ void (*on_action_suggested)(void*, int, const char**), void* u){
obj->on_action_suggested=on_action_suggested; obj->on_action_suggested=on_action_suggested;
obj->on_action_suggested_user_pointer=u; obj->on_action_suggested_user_pointer=u;
} }
...@@ -182,19 +182,25 @@ static void simple_analyzer_suggest_action(MSQosAnalyzer *objbase, MSRateControl ...@@ -182,19 +182,25 @@ static void simple_analyzer_suggest_action(MSQosAnalyzer *objbase, MSRateControl
} }
if (objbase->on_action_suggested!=NULL){ if (objbase->on_action_suggested!=NULL){
char *input=ms_strdup_printf("lost_percentage=%d rt_prop_increased=%d int_jitter_ms=%d rt_prop_ms=%d" int i;
const int datac=4;
char *data[datac];
data[0]=ms_strdup("lost_percentage rt_prop_increased int_jitter_ms rt_prop_ms");
data[1]=ms_strdup_printf("%d %d %d %d"
, (int)cur->lost_percentage , (int)cur->lost_percentage
, (simple_rt_prop_increased(obj)==TRUE) , (simple_rt_prop_increased(obj)==TRUE)
, (int)cur->int_jitter , (int)cur->int_jitter
, (int)(1000*cur->rt_prop)); , (int)(1000*cur->rt_prop));
char *output=ms_strdup_printf("action_type=%s action_value=%d" data[2]=ms_strdup("action_type action_value");
data[3]=ms_strdup_printf("%s %d"
, ms_rate_control_action_type_name(action->type) , ms_rate_control_action_type_name(action->type)
, action->value); , action->value);
objbase->on_action_suggested(objbase->on_action_suggested_user_pointer, input, output); objbase->on_action_suggested(objbase->on_action_suggested_user_pointer, datac, (const char**)data);
ms_free(input); for (i=0;i<datac;++i){
ms_free(output); ms_free(data[i]);
}
} }
} }
......
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