blob: d09098c93a071dd4ea3b1fdbf979724e73ddfa0b [file] [log] [blame]
b.liuf191eb72024-12-12 10:45:23 +08001/*
2* main.c
3*
4* RTP server main source.
5*
6*/
7/******************************************************************************
8
9 EDIT HISTORY FOR FILE
10
11 WHEN WHO WHAT,WHERE,WHY
12-------- -------- -------------------------------------------------------
132024/11/30 LiuBin Initial version
14
15******************************************************************************/
16#include <stdio.h>
17#include <errno.h>
18#include <pthread.h>
19#include <stdlib.h>
20#include <unistd.h>
21#include <fcntl.h>
22#include <sys/socket.h>
23#include <sys/un.h>
24#include <netinet/in.h>
25#include <sys/epoll.h>
26
27#include "mbtk_rtp_internal.h"
28#include "mbtk_log.h"
29#include "mbtk_utils.h"
30
31#define SOCK_CLIENT_MAX 5
32#define EPOLL_LISTEN_MAX 100
33
34rtp_info_t rtp_info;
35static rtp_config_t rtp_confs =
36{
37 .rtp_state_pre = RTP_STATE_DISABLE,
38 .rtp_state_cur = RTP_STATE_DISABLE,
39 .volume = 7,
40 .remote_ip = "198.18.38.15", // 198.18.38.15
41 .server_port = RTP_UDP_SER_PORT_DEFAULT,
42 .client_port = RTP_UDP_CLI_PORT_DEFAULT,
43 .vlan = {0},
44 .sample_rate = MBTK_AUDIO_SAMPLE_RATE_8000,
45 .channel = 1
46};
47
48int rtp_udp_server_start(rtp_config_t *conf_info);
49int rtp_udp_server_stop();
50int rtp_voip_server_start(const rtp_config_t *conf_info);
51int rtp_voip_server_stop();
52
53static void rtp_main_thread_wait(const char* tag)
54{
55 LOGD("main(%s) waitting...", tag);
56 pthread_mutex_lock(&rtp_info.mutex);
57 pthread_cond_wait(&rtp_info.cond, &rtp_info.mutex);
58 pthread_mutex_unlock(&rtp_info.mutex);
59 LOGD("main(%s) running...", tag);
60}
61
62static void rtp_main_thread_cond()
63{
64 pthread_mutex_lock(&rtp_info.mutex);
65 pthread_cond_signal(&rtp_info.cond);
66 pthread_mutex_unlock(&rtp_info.mutex);
67}
68
69static void rtp_msg_process(int fd, const char *msg, int msg_len)
70{
71 LOGD("CMD <%s> <len-%d>", msg, msg_len);
72 // gnss_init:x
73 usleep(10 * 1000); // sleep 10ms
74 /*
75 volume = 7,
76 .remote_ip = "127.0.0.1", // 198.18.38.15
77 .server_port = RTP_UDP_SER_PORT_DEFAULT,
78 .client_port = RTP_UDP_CLI_PORT_DEFAULT,
79 .vlan = {0},
80 .sample_rate = MBTK_AUDIO_SAMPLE_RATE_8000,
81 .channel = 1
82 */
83 if(memcmp(msg, "rtp_mode", 8) == 0) { // rtp_mode <0/1>
84 int rtp_mode = atoi(msg + 9);
85 int ret = 0;
86 if(rtp_mode == 0) { // Disable RTP
87 if(rtp_confs.rtp_state_cur == RTP_STATE_ENABLE) {
88 rtp_confs.rtp_state_pre = rtp_confs.rtp_state_cur;
89 rtp_confs.rtp_state_cur = RTP_STATE_DISABLE;
90 rtp_main_thread_cond();
91 } else if(rtp_confs.rtp_state_cur == RTP_STATE_VOIP_PROCESS) {
92 rtp_confs.rtp_state_pre = rtp_confs.rtp_state_cur;
93 rtp_confs.rtp_state_cur = RTP_STATE_DISABLE;
94 // rtp_main_thread_cond();
95 }
96 } else {
97 if(rtp_confs.rtp_state_cur == RTP_STATE_DISABLE) {
98 rtp_confs.rtp_state_pre = rtp_confs.rtp_state_cur;
99 rtp_confs.rtp_state_cur = RTP_STATE_ENABLE;
100 rtp_main_thread_cond();
101 }
102 }
103
104 char rsp[100] = {0};
105 sprintf(rsp, "%crtp_mode:%d%c", MBTK_IND_START_FLAG, ret, MBTK_IND_END_FLAG);
106 mbtk_write(fd, rsp, strlen(rsp));
107 } else if(memcmp(msg, "volume", 6) == 0) {// volume <0-7>
108 int volume = atoi(msg + 7);
109 int ret = -1;
110 if(volume >= 0 && volume <= 7) {
111 rtp_confs.volume = volume;
112 ret = 0;
113 }
114
115 char rsp[100] = {0};
116 sprintf(rsp, "%cvolume:%d%c", MBTK_IND_START_FLAG, ret, MBTK_IND_END_FLAG);
117 mbtk_write(fd, rsp, strlen(rsp));
118 } else if(memcmp(msg, "remote_ip", 9) == 0) {// remote_ip <xxx:xxx:xxx:xxx>
119 int ret = 0;
120 memcpy(rtp_confs.remote_ip, msg + 10, strlen(msg + 10) + 1);
121
122 char rsp[100] = {0};
123 sprintf(rsp, "%cremote_ip:%d%c", MBTK_IND_START_FLAG, ret, MBTK_IND_END_FLAG);
124 mbtk_write(fd, rsp, strlen(rsp));
125 } else if(memcmp(msg, "server_port", 11) == 0) {// client_port <port>
126 int port = atoi(msg + 12);
127 int ret = -1;
128 if(port >= 0 && port <= 7) {
129 rtp_confs.server_port = port;
130 ret = 0;
131 }
132
133 char rsp[100] = {0};
134 sprintf(rsp, "%cserver_port:%d%c", MBTK_IND_START_FLAG, ret, MBTK_IND_END_FLAG);
135 mbtk_write(fd, rsp, strlen(rsp));
136 } else if(memcmp(msg, "client_port", 11) == 0) {// client_port <port>
137 int port = atoi(msg + 12);
138 int ret = -1;
139 if(port > 1024 && port < 65535) {
140 rtp_confs.client_port = port;
141 ret = 0;
142 }
143
144 char rsp[100] = {0};
145 sprintf(rsp, "%cclient_port:%d%c", MBTK_IND_START_FLAG, ret, MBTK_IND_END_FLAG);
146 mbtk_write(fd, rsp, strlen(rsp));
147 } else if(memcmp(msg, "sample_rate", 11) == 0) {// client_port <port>
148 int sample_rate = atoi(msg + 12);
149 int ret = 0;
150 if(sample_rate == 8000) {
151 rtp_confs.sample_rate = MBTK_AUDIO_SAMPLE_RATE_8000;
152 } else if(sample_rate == 16000) {
153 rtp_confs.sample_rate = MBTK_AUDIO_SAMPLE_RATE_16000;
154 } else {
155 ret = -1;
156 }
157
158 char rsp[100] = {0};
159 sprintf(rsp, "%csample_rate:%d%c", MBTK_IND_START_FLAG, ret, MBTK_IND_END_FLAG);
160 mbtk_write(fd, rsp, strlen(rsp));
161 } else if(memcmp(msg, "channel", 7) == 0) {// client_port <port>
162 int channel = atoi(msg + 8);
163 int ret = -1;
164 if(channel == 1) {
165 rtp_confs.channel = channel;
166 ret = 0;
167 }
168
169 char rsp[100] = {0};
170 sprintf(rsp, "%cchannel:%d%c", MBTK_IND_START_FLAG, ret, MBTK_IND_END_FLAG);
171 mbtk_write(fd, rsp, strlen(rsp));
172 } else {
173 LOGW("Unknown RTP msg : %s", msg);
174 }
175}
176
177int epoll_fd_add(int fd)
178{
179 if(rtp_info.epoll_fd > 0) {
180 struct epoll_event ev;
181 memset(&ev, 0, sizeof(struct epoll_event));
182 ev.data.fd = fd;
183 ev.events = EPOLLIN | EPOLLET;
184 return epoll_ctl(rtp_info.epoll_fd, EPOLL_CTL_ADD, fd, &ev);
185 } else {
186 return -1;
187 }
188}
189
190int epoll_fd_del(int fd)
191{
192 if(rtp_info.epoll_fd > 0) {
193 struct epoll_event ev;
194 memset(&ev, 0, sizeof(struct epoll_event));
195 ev.data.fd = fd;
196 ev.events = EPOLLIN | EPOLLERR | EPOLLET;
197 return epoll_ctl(rtp_info.epoll_fd, EPOLL_CTL_DEL, fd, &ev);
198 } else {
199 return -1;
200 }
201}
202
203
204static void* rtp_ipc_ser_pthread(void* arg)
205{
206 int sock_listen_fd = *((int*)arg);
207 rtp_info.epoll_fd = epoll_create(SOCK_CLIENT_MAX + 1);
208 if(rtp_info.epoll_fd < 0)
209 {
210 LOGE("epoll_create() fail[%d].", errno);
211 return NULL;
212 }
213
214 rtp_info.unix_sock_cli.fd = -1;
215 rtp_info.unix_sock_cli.read_cb = NULL;
216
217 epoll_fd_add(sock_listen_fd);
218
219 int nready = -1;
220 int i = 0;
221 struct epoll_event epoll_events[EPOLL_LISTEN_MAX];
222 while(1)
223 {
224 nready = epoll_wait(rtp_info.epoll_fd, epoll_events, EPOLL_LISTEN_MAX, -1);
225 if(nready > 0)
226 {
227 for(i = 0; i < nready; i++)
228 {
229 LOGV("fd[%d] event = %x",epoll_events[i].data.fd, epoll_events[i].events);
230 if(epoll_events[i].events & EPOLLHUP) // Client Close.
231 {
232 epoll_fd_del(epoll_events[i].data.fd);
233 close(epoll_events[i].data.fd);
234 if(rtp_info.unix_sock_cli.fd == epoll_events[i].data.fd) {
235 rtp_info.unix_sock_cli.fd = -1;
236 LOGD("Local unix socket client close.");
237 } else if(rtp_info.udp_recv_sock.fd == epoll_events[i].data.fd) {
238 rtp_info.udp_recv_sock.fd = -1;
239 LOGD("RTP UDP socket client close.");
240 } else {
241 LOGE("Can not occur.");
242 }
243 }
244 else if(epoll_events[i].events & EPOLLIN)
245 {
246 if(epoll_events[i].data.fd == sock_listen_fd) // New clients connected.
247 {
248 int client_fd = -1;
249 while(1)
250 {
251 struct sockaddr_in cliaddr;
252 socklen_t clilen = sizeof(cliaddr);
253 client_fd = accept(epoll_events[i].data.fd, (struct sockaddr *) &cliaddr, &clilen);
254 if(client_fd <= 0)
255 {
256 if(errno == EAGAIN)
257 {
258 LOGE("All client connect get.");
259 }
260 else
261 {
262 LOGE("accept() error[%d].", errno);
263 }
264 break;
265 } else {
266 if(rtp_info.unix_sock_cli.fd > 0) {
267 LOGE("Client is full.");
268 break;
269 }
270 rtp_info.unix_sock_cli.fd = client_fd;
271 rtp_info.unix_sock_cli.read_cb = NULL;
272 }
273
274 epoll_fd_add(client_fd);
275
276 LOGD("Start monitor client cmd : %d", client_fd);
277 }
278 }
279 else if(rtp_info.unix_sock_cli.fd == epoll_events[i].data.fd) // Client data arrive.
280 {
281 char buff[1024] = {0};
282 int len = read(epoll_events[i].data.fd, buff, sizeof(buff));
283 if(len > 0) {
284 rtp_msg_process(epoll_events[i].data.fd, buff, len);
285 }
286 }
287 else if(rtp_info.udp_recv_sock.fd == epoll_events[i].data.fd) // RTP UDP data reach.
288 {
289 if(rtp_info.udp_recv_sock.read_cb) {
290 rtp_info.udp_recv_sock.read_cb(epoll_events[i].data.fd);
291 }
292 }
293 else
294 {
295 LOGE("Unknown socket : %d", epoll_events[i].data.fd);
296 }
297 }
298 else
299 {
300 LOGE("Unknown event : %x", epoll_events[i].events);
301 }
302 }
303 }
304 else
305 {
306 LOGE("epoll_wait() fail[%d].", errno);
307 }
308 }
309
310 return NULL;
311}
312
313
314static int rtp_ipc_server_start()
315{
316 struct sockaddr_un server_addr;
317 int sock_listen_fd = socket(AF_LOCAL, SOCK_STREAM, 0);
318 if(sock_listen_fd < 0)
319 {
320 LOGE("socket() fail[%d].", errno);
321 return -1;
322 }
323
324#if 1
325 // Set O_NONBLOCK
326 int flags = fcntl(sock_listen_fd, F_GETFL, 0);
327 if (flags < 0)
328 {
329 LOGE("Get flags error:%d", errno);
330 goto error;
331 }
332 flags |= O_NONBLOCK;
333 if (fcntl(sock_listen_fd, F_SETFL, flags) < 0)
334 {
335 LOGE("Set flags error:%d", errno);
336 goto error;
337 }
338#endif
339
340 unlink(RTP_IPC_SOCK_PATH);
341 memset(&server_addr, 0, sizeof(struct sockaddr_un));
342 server_addr.sun_family = AF_LOCAL;
343 strcpy(server_addr.sun_path, RTP_IPC_SOCK_PATH);
344 if(bind(sock_listen_fd, (struct sockaddr *)&server_addr, sizeof(server_addr)))
345 {
346 LOGE("bind() fail[%d].", errno);
347 goto error;
348 }
349
350 if(listen(sock_listen_fd, SOCK_CLIENT_MAX))
351 {
352 LOGE("listen() fail[%d].", errno);
353 goto error;
354 }
355
356 pthread_t pid;
357 pthread_attr_t thread_attr;
358 pthread_attr_init(&thread_attr);
359 if(pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED))
360 {
361 LOGE("pthread_attr_setdetachstate() fail.");
362 goto error;
363 }
364
365 if(pthread_create(&pid, &thread_attr, rtp_ipc_ser_pthread, &sock_listen_fd))
366 {
367 LOGE("pthread_create() fail.");
368 goto error;
369 }
370
371 LOGD("RTP IPC service is running...");
372 return 0;
373error:
374 close(sock_listen_fd);
375 return -1;
376}
377
b.liu30ccef12024-12-31 10:28:23 +0800378#ifdef MBTK_SOURCE_VERSION_2
b.liuf191eb72024-12-12 10:45:23 +0800379static void call_state_change_cb(const void* data, int data_len)
380{
381 if(data) {
382 mbtk_ril_call_state_info_t *state = (mbtk_ril_call_state_info_t*)data;
383 LOGD("call state change : call_id-%d, dir-%d, state-%d, num_type-%d,number-%s", state->call_id,
384 state->dir, state->state, state->num_type, state->call_number);
385 if(state->state == MBTK_RIL_CALL_STATE_DISCONNECT) {
386 if(rtp_confs.rtp_state_cur == RTP_STATE_VOIP_PROCESS) {
387 rtp_confs.rtp_state_pre = rtp_confs.rtp_state_cur;
388 rtp_confs.rtp_state_cur = RTP_STATE_ENABLE;
389 rtp_main_thread_cond();
390 } else if(rtp_confs.rtp_state_cur == RTP_STATE_DISABLE) { // 通话过程中 Disable,挂断后需要单独处理
391 rtp_confs.rtp_state_pre = RTP_STATE_VOIP_PROCESS;
392 rtp_confs.rtp_state_cur = RTP_STATE_DISABLE;
393 rtp_main_thread_cond();
394 }
395 } else if(state->state == MBTK_RIL_CALL_STATE_ACTIVE /*state->state == MBTK_RIL_CALL_STATE_ALERTING || state->state == MBTK_RIL_CALL_STATE_INCOMING*/) {
396 if(rtp_confs.rtp_state_cur == RTP_STATE_ENABLE) {
397 rtp_confs.rtp_state_pre = rtp_confs.rtp_state_cur;
398 rtp_confs.rtp_state_cur = RTP_STATE_VOIP_PROCESS;
399 rtp_main_thread_cond();
400 }
401 }
402 }
403}
404
405static int ril_ser_switch(bool open)
406{
407 if(open) {
408 if(rtp_info.ril_handle) {
409 LOGW("RIL has opened.");
410 return 0;
411 }
412 rtp_info.ril_handle = mbtk_ril_open(MBTK_AT_PORT_DEF);
413 if(rtp_info.ril_handle == NULL) {
414 LOGE("mbtk_ril_open(MBTK_AT_PORT_DEF) fail.");
415 return -1;
416 }
417
418 mbtk_call_state_change_cb_reg(call_state_change_cb);
419 } else {
420 if(!rtp_info.ril_handle) {
421 LOGW("RIL not open.");
422 return 0;
423 }
424
425 if(MBTK_RIL_ERR_SUCCESS != mbtk_ril_close(MBTK_AT_PORT_DEF)) {
426 LOGE("mbtk_ril_close(MBTK_AT_PORT_DEF) fail.");
427 return -1;
428 }
429
430 rtp_info.ril_handle = NULL;
431 }
432 return 0;
433}
434
b.liu26311322024-12-23 18:53:55 +0800435#else
436
437static void call_state_change_cb(const void* data, int data_len)
438{
439 if(data) {
440 mbtk_call_info_t *state = (mbtk_call_info_t*)data;
441 LOGD("call state change : call_wait-%d, state-%d", state->call_wait, state->state);
442 if(state->call_wait == MBTK_DISCONNECTED) {
443 if(rtp_confs.rtp_state_cur == RTP_STATE_VOIP_PROCESS) {
444 rtp_confs.rtp_state_pre = rtp_confs.rtp_state_cur;
445 rtp_confs.rtp_state_cur = RTP_STATE_ENABLE;
446 rtp_main_thread_cond();
447 } else if(rtp_confs.rtp_state_cur == RTP_STATE_DISABLE) { // 通话过程中 Disable,挂断后需要单独处理
448 rtp_confs.rtp_state_pre = RTP_STATE_VOIP_PROCESS;
449 rtp_confs.rtp_state_cur = RTP_STATE_DISABLE;
450 rtp_main_thread_cond();
451 }
452 } else if(state->call_wait == MBTK_CLCC && state->state == 0) {
453 if(rtp_confs.rtp_state_cur == RTP_STATE_ENABLE) {
454 rtp_confs.rtp_state_pre = rtp_confs.rtp_state_cur;
455 rtp_confs.rtp_state_cur = RTP_STATE_VOIP_PROCESS;
456 rtp_main_thread_cond();
457 }
458 }
459 }
460#if 0
461 mbtk_call_info_t *reg = (mbtk_call_info_t *)data;
462 switch (reg->call_wait)
463 {
464 case MBTK_CLCC:
465 printf("\r\nRING : %d, %d, %d, %d, %d, %s, %d\r\n", reg->dir1, reg->dir, reg->state, reg->mode, reg->mpty, reg->phone_number, reg->type);
466 break;
467 case MBTK_DISCONNECTED:
468 printf("\r\nRING : call dis connected!\r\n");
469 break;
470 case MBTK_CPAS:
471 printf("\r\nCALL : Call state = %d\r\n", reg->pas);
472 /*
473 MBTK_CALL_RADY, //MT allows commands from TA/TE
474 MBTK_CALL_UNAVAILABLE, //MT does not allow commands from TA/TE
475 MBTK_CALL_UNKNOWN, //MT is not guaranteed to respond to instructions
476 MBTK_CALL_RINGING, //MT is ready for commands from TA/TE, but the ringer is active
477 MBTK_CALL_PROGRESS, //MT is ready for commands from TA/TE, but a call is in progress
478 MBTK_CALL_ASLEEP, //MT is unable to process commands from TA/TE because it is in a low functionality state
479 MBTK_CALL_ACTIVE,
480 */
481 switch (reg->pas)
482 {
483 case MBTK_CALL_RADY:
484 printf("CALL: call READY\r\n");
485 break;
486 case MBTK_CALL_UNAVAILABLE:
487 printf("CALL: call unavaliable\r\n");
488 break;
489 case MBTK_CALL_UNKNOWN:
490 printf("CALL: call unknown\r\n");
491 break;
492 case MBTK_CALL_RINGING:
493 printf("CALL: call ringing\r\n");
494 break;
495 case MBTK_CALL_PROGRESS:
496 printf("CALL: call progress\r\n");
497 break;
498 case MBTK_CALL_ASLEEP:
499 printf("CALL: call asleep\r\n");
500 break;
501 case MBTK_CALL_ACTIVE:
502 printf("CALL: call active\r\n");
503 break;
504 default:
505 printf("\r\n");
506 break;
507 }
508 break;
509 default:
510 printf("\r\nRING : None call_wait = %d\r\n", reg->call_wait);
511 break;
512 }
513#endif
514}
515
516static int ril_ser_switch(bool open)
517{
518 if(open) {
519 if(rtp_info.ril_handle) {
520 LOGW("RIL has opened.");
521 return 0;
522 }
523 rtp_info.ril_handle = mbtk_info_handle_get();
524 if(rtp_info.ril_handle == NULL) {
525 LOGE("mbtk_info_handle_get() fail.");
526 return -1;
527 }
528
529 mbtk_call_state_change_cb_reg(rtp_info.ril_handle, call_state_change_cb);
530 } else {
531 if(!rtp_info.ril_handle) {
532 LOGW("RIL not open.");
533 return 0;
534 }
535
536 if(mbtk_info_handle_free(&rtp_info.ril_handle)) {
537 LOGE("mbtk_info_handle_free() fail.");
538 return -1;
539 }
540
541 rtp_info.ril_handle = NULL;
542 }
543 return 0;
544}
545
546#endif
547
b.liuf191eb72024-12-12 10:45:23 +0800548static int rtp_start(rtp_state_enum state_pre, rtp_state_enum state_cur)
549{
550 LOGD("RTP start, state : %d -> %d", state_pre, state_cur);
551 char *tag = NULL;
552 if(state_cur == RTP_STATE_DISABLE) {
553 if(state_pre == RTP_STATE_VOIP_PROCESS || state_pre == RTP_STATE_ENABLE) {
554 // Close ril server.
555 ril_ser_switch(FALSE);
556
557 // Close RTP UDP forward server.
558 if(rtp_voip_server_stop()) {
559 LOGE("rtp_voip_server_stop() fail.");
560 }
561
562 if(rtp_udp_server_stop()) {
563 LOGE("rtp_udp_server_stop() fail.");
564 }
565 } else {
566 LOGW("Can not occur[Except for the first time].");
567 }
568
569 tag = "RTP_STATE_DISABLE";
570 } else if(state_cur == RTP_STATE_ENABLE) {
571 if(state_pre == RTP_STATE_VOIP_PROCESS) {
572 // Close RTP UDP forward server.
573 if(rtp_voip_server_stop()) {
574 LOGE("rtp_udp_server_stop() fail.");
575 }
576 } else if(state_pre == RTP_STATE_DISABLE) {
577 // Open ril server.
578 ril_ser_switch(TRUE);
579
580 if(rtp_udp_server_start(&rtp_confs)) {
581 LOGE("rtp_udp_server_start() fail.");
582 }
583 } else {
584 LOGW("Can not occur.");
585 }
586
587 tag = "RTP_STATE_ENABLE";
588 } else if(state_cur == RTP_STATE_VOIP_PROCESS) {
589 if(state_pre == RTP_STATE_DISABLE) {
590 LOGW("Can not occur.");
591 } else if(state_pre == RTP_STATE_ENABLE) {
592 // Open RTP UDP forward server.
593 if(rtp_voip_server_start(&rtp_confs)) {
594 LOGE("rtp_voip_server_start() fail.");
595 }
596 } else {
597 LOGW("Can not occur.");
598 }
599
600 tag = "RTP_STATE_VOIP_PROCESS";
601 } else {
602 LOGE("Unknown state : %d", state_cur);
603 return -1;
604 }
605
606 // Wait for state change.
607 rtp_main_thread_wait(tag);
608 return 0;
609}
610
611int main(int argc, char *argv[])
612{
613 mbtk_log_init("radio", "MBTK_RTP");
614
615 LOGD("mbtk_rtpd start.");
616
617 memset(&rtp_info, 0, sizeof(rtp_info_t));
618 pthread_mutex_init(&rtp_info.mutex, NULL);
619 pthread_cond_init(&rtp_info.cond, NULL);
620
621 // Start server to monitor client messages.
622 if(rtp_ipc_server_start()) {
623 LOGE("rtp_ipc_server_start() fail.");
624 return -1;
625 }
626
627 while(!rtp_start(rtp_confs.rtp_state_pre, rtp_confs.rtp_state_cur))
628 {
629 LOGD("RTP will restart with state %d -> %d", rtp_confs.rtp_state_pre, rtp_confs.rtp_state_cur);
630 }
631
632 LOGE("RTP exit. rtp_start() fail.");
633
634 return 0;
635}
636