[feature][T8TSK-84][TCAM_T800_SW_0270] rtp support vlan config
Change-Id: Ie44c4b29054c4360b92c616dcda39f5f2785a136
diff --git a/src/lynq/lib/liblynq-call/include/libcall/lynq_call.h b/src/lynq/lib/liblynq-call/include/libcall/lynq_call.h
index 8f6d0af..f1cf502 100755
--- a/src/lynq/lib/liblynq-call/include/libcall/lynq_call.h
+++ b/src/lynq/lib/liblynq-call/include/libcall/lynq_call.h
@@ -137,11 +137,13 @@
/*set*/
int lynq_set_voice_audio_mode(const LYNQ_Audio_Mode audio_mode);
int lynq_set_remote_rtp_ip(const char* ip, const int ip_length);
+int lynq_set_vlan_info(const char* vlan_info, const int vlan_info_length);
int lynq_set_rtp_port(const LYNQ_Rtp_Mode rtp_mode, const int port);
int lynq_set_rtp_param(const int clock_rate,const int channels,const int latency); //only for client
/*get*/
LYNQ_Audio_Mode lynq_get_voice_audio_mode();
int lynq_get_remote_rtp_ip(char* ip, const int ip_length);
+int lynq_get_vlan_info(char* vlan_info, const int vlan_info_length);
int lynq_get_rtp_port(const LYNQ_Rtp_Mode rtp_mode, int* port);
int lynq_get_rtp_param(int* clock_rate,int* channels, int* latency);//only for client
/*Audio Path setting end*/
diff --git a/src/lynq/lib/liblynq-call/lynq_call.cpp b/src/lynq/lib/liblynq-call/lynq_call.cpp
index c91bea3..6fa3bcf 100755
--- a/src/lynq/lib/liblynq-call/lynq_call.cpp
+++ b/src/lynq/lib/liblynq-call/lynq_call.cpp
@@ -28,8 +28,10 @@
#define LYQN_SEDN_BUF 1024*8+sizeof(int)*3
#define INVALID_ID (-1)
#define RTP_FROM_CMD "gst-launch-1.0 -v udpsrc port=%d caps=\'application/x-rtp, media=(string)audio, clock-rate=(int)%d, channels=(int)%d\' ! rtpjitterbuffer latency=%d ! rtppcmadepay ! alawdec ! audioresample ! audioconvert ! alsasink device=\'hw:0,2\'"
-#define RTP_TO_CMD "gst-launch-1.0 -v alsasrc device=\'hw:0,6\' ! audioconvert ! audioresample ! alawenc ! rtppcmapay ! udpsink host=%s auto-multicast=true port=%d"
+#define RTP_TO_CMD "gst-launch-1.0 -v alsasrc device=\'hw:0,6\' ! audioconvert ! audioresample ! alawenc ! rtppcmapay ! udpsink host=%s %s auto-multicast=true port=%d"
+#define RTP_VLAN_INFO_FORMAT "multicast-iface=\"%s\""
#define MAX_IP_LENGTH 128
+#define MAX_VLAN_INFO_LENGTH 128
#define USER_LOG_TAG "LYNQ_CALL"
using ::android::Parcel;
@@ -2077,6 +2079,7 @@
}
int* rtp_mode= (int*) arg;
char cmd[384];
+ char vlan_para_string[sizeof(RTP_VLAN_INFO_FORMAT)+MAX_VLAN_INFO_LENGTH-2/*sizeof "%s"*/]={0};
LYINFLOG("lynq_start_rtp_cmd: rtp_mode is %d",(*rtp_mode));
if ((*rtp_mode) == RTP_CLIENT)
{
@@ -2088,8 +2091,12 @@
}
else if ((*rtp_mode) == RTP_SERVER)
{
+ if(strlen(g_rtp_server_info.vlan_info)>0)
+ {
+ sprintf(vlan_para_string,RTP_VLAN_INFO_FORMAT,g_rtp_server_info.vlan_info);
+ }
sprintf(cmd,RTP_TO_CMD, \
- g_rtp_server_info.ip,g_rtp_server_info.port);
+ g_rtp_server_info.ip,vlan_para_string,g_rtp_server_info.port);
// LYINFLOG("start to rtp play: cmd is %s",cmd);
system(cmd);
}
@@ -2198,6 +2205,28 @@
return 0;
}
+int lynq_set_vlan_info(const char* vlan_info, const int vlan_info_length)
+{
+ if (NULL == vlan_info)
+ {
+ LYERRLOG("vlan_info is NULL!!!");
+ return -1;
+ }
+
+ if ((vlan_info_length < strlen(vlan_info)+1) || (vlan_info_length > MAX_VLAN_INFO_LENGTH))
+ {
+ LYERRLOG("incoming vlan_info error, vlan info length %d", vlan_info_length);
+ return -1;
+ }
+
+
+ bzero(g_rtp_server_info.vlan_info,MAX_VLAN_INFO_LENGTH);
+ strcpy(g_rtp_server_info.vlan_info,vlan_info);
+
+ LYINFLOG("lynq_set_vlan_info suc: vlan is %s, length is %d", vlan_info,vlan_info_length);
+
+ return 0;
+}
int lynq_set_rtp_port(const LYNQ_Rtp_Mode rtp_mode, const int port)
{
if (port < 0)
@@ -2261,6 +2290,25 @@
strcpy(ip,g_rtp_server_info.ip);
return 0;
}
+int lynq_get_vlan_info(char* vlan_info, const int vlan_info_length)
+{
+ if(vlan_info==NULL)
+ {
+ LYERRLOG("vlan info is NULL");
+ return -1;
+ }
+
+ if(vlan_info_length < strlen(g_rtp_server_info.vlan_info)+1)
+ {
+ LYERRLOG("vlan info length %d is shorter than saved vlan info length %d",vlan_info_length,strlen(g_rtp_server_info.vlan_info)+1);
+ return -1;
+ }
+
+ bzero(vlan_info,vlan_info_length);
+ strcpy(vlan_info,g_rtp_server_info.vlan_info);
+
+ return 0;
+}
int lynq_get_rtp_port(const LYNQ_Rtp_Mode rtp_mode, int* port)
{
if(g_lynq_call_init_flag == 0)