rtp/rtcp 汇总

rtp/rtcp stack

custom rtp

ORTP

UCL Common RTP library

Bell Labs RTP Library

jrtplib

 

1、custom rtp send/recv

send.c

#include <stdio.h>
#include <unistd.h> 
#include <string.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
 
#define TS_PACKET_SIZE 188
#define MTU 1500
 
/*rtp struct*/
struct rtp_header{  
    uint16_t cc:4;  
    uint16_t x:1;  
    uint16_t p:1;  
    uint16_t v:2;       
    uint16_t pt:7;  
    uint16_t m:1;  
    uint16_t sequence_number;
    uint32_t timestamp;
    uint32_t ssrc;
};  
 
void init_rtp_header(struct rtp_header *h){
    h->v = 2;  
    h->p = 0;  
    h->x = 0;  
    h->cc = 0;  
    h->m = 0;  
    h->pt = 8;  
    h->sequence_number =0;  
    h->timestamp = 0;  
    h->ssrc =0;  
}  
 
void sequence_number_increase(struct rtp_header *header, uint32_t timestamp){  
    uint16_t sequence = ntohs(header->sequence_number);  
    sequence++;  
    header->sequence_number = htons(sequence);
    uint32_t user_ts = ntohl(header->timestamp);
    user_ts += timestamp;
    header->timestamp = htonl(user_ts); 
}
 
int main(int argc,char *argv[]){  
    char buf[MTU];  
    unsigned int count = 0;  
    if(argc < 2){
        printf(" need wav path \n");
        return -1;
    }
  
    init_rtp_header((struct rtp_header*)buf);
    count = sizeof(struct rtp_header);  
 
    int sock = socket(AF_INET, SOCK_DGRAM, 0);  
    struct sockaddr_in dest_addr;  
 
    dest_addr.sin_family=AF_INET;  
    dest_addr.sin_port = htons(10001);  
    dest_addr.sin_addr.s_addr =inet_addr("127.0.0.1");
 
    bzero(&(dest_addr.sin_zero),8);  
 
    // Open TS file  
    FILE *ts_file = fopen(argv[1], "r+"); 
    int n=0;
    while(!feof(ts_file)){  
        int read_len = fread(buf+count, 1, TS_PACKET_SIZE, ts_file);   
        count += read_len;  
        if (count + TS_PACKET_SIZE > MTU){
            printf("haha_count = %d\n",count);
            sequence_number_increase((struct rtp_header*)buf, 160);  
            sendto(sock, buf, count, 0, (const struct sockaddr*)&dest_addr, sizeof(dest_addr));  
            count = sizeof(struct rtp_header);  
            usleep(10000);  
            n++;    
        } 
    }  
    printf("numofcount:%d\n",n*1316);
 
    fclose(ts_file); 
}

recv.c

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
#include <sys/file.h>
#include <errno.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <string.h>
#include <stdarg.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <signal.h>
#include <sys/wait.h>
#include <regex.h> 
 
/*rtp struct*/
struct rtp_header{  
    uint16_t cc:4;  
    uint16_t x:1;  
    uint16_t p:1;  
    uint16_t v:2;       
    uint16_t pt:7;  
    uint16_t m:1;  
    uint16_t sequence_number;
    uint32_t timestamp;
    uint32_t ssrc;
};  
 
void main(int argc, char **argv)  
{   
    int socka;       
    int nPortA = 10001;  
    fd_set rfd;
    struct timeval timeout;
    struct sockaddr_in addr;
    char recv_buf[1500];
      
    int nRecLen;
      
    struct sockaddr_in cli;
    int nRet;
 
    socka = socket(AF_INET, SOCK_DGRAM, 0); 
    if (socka == -1)  
    {  
        printf("socket()/n");  
        return;  
    }  
 
    memset(&addr, 0, sizeof(addr));  
      
    addr.sin_family = AF_INET;
    addr.sin_port = htons(nPortA);
    addr.sin_addr.s_addr = htonl(INADDR_ANY);
    if (bind(socka, (struct sockaddr*)&addr, sizeof(addr)) == -1)
    {  
        printf("bind()/n");  
        return;  
    }  
       
    //timeout = 6s 
    timeout.tv_sec = 6;   
    timeout.tv_usec = 0;  
      
    memset(recv_buf, 0, sizeof(recv_buf)); 

    FILE *fp_write = fopen("out.ps", "wb+");

    while (1)  
    {  
        FD_ZERO(&rfd); 
          
        FD_SET(socka, &rfd);
  
          
        nRet = select(socka+1, &rfd, NULL, NULL, &timeout);
        if (nRet == -1)     
        {  
            printf("select()\n");  
            return;  
        }  
        else if (nRet == 0)
        {  
            //printf("timeout\n");  
            continue; 
        }  
        else
        {  
            if (FD_ISSET(socka, &rfd))
            {  
                nRecLen = sizeof(cli);  
                int nRecEcho = recvfrom(socka, recv_buf, sizeof(recv_buf), 0, (struct sockaddr*)&cli, &nRecLen);  
                if (nRecEcho == -1)  
                {  
                    printf("recvfrom()\n");  
                    break;  
                }
                
                struct rtp_header *p = (struct rtp_header *)recv_buf;
                printf("v = %d\n",p->v);
                printf("p = %d\n",p->p);
                printf("x = %d\n",p->x);
                printf("cc = %d\n",p->cc);
                printf("m = %d\n",p->m);
                printf("pt = %d\n",p->pt);
                printf("sequence_number = %d\n",ntohs(p->sequence_number));
                printf("timestamp = %d\n",ntohl(p->timestamp));
                printf("ssrc = %d\n",ntohl(p->ssrc));

                if (!feof(fp_write)) {
                    fwrite(recv_buf, 1, nRecEcho, fp_write);
                }
            }  
 
        }  
    }  
}

gcc -o send send.c -lm
gcc -o recv recv.c -lm

./recv

./send fileSequence0.ts

 

test file

https://www.cnblogs.com/dong1/p/10451577.html

 

2、jrtplib

1) 安装库文件

_install.sh

cmake -DCMAKE_INSTALL_PREFIX=./_install
make
make install

 

2)编译example

_build.sh

export LD_LIBRARY_PATH=$(pwd)/_install/lib:$LD_LIBRARY_PATH

rm ./test

g++ example1.cpp -I./_install/include/jrtplib3 -L./_install/lib -g -o test -ljrtp

 

3)测试example

dong@ubuntu:~/sip/jrtplib/example$ ls
_build.sh  example1.cpp  _install  test
dong@ubuntu:~/sip/jrtplib/example$ ./test
Using version 3.11.1
Enter local portbase:
4000

Enter the destination IP address
127.0.0.1
Enter the destination port
4000

Number of packets you wish to be sent:
10

Sending packet 1/10

Sending packet 2/10
Got packet !

Sending packet 3/10
Got packet !

Sending packet 4/10
Got packet !

Sending packet 5/10
Got packet !

Sending packet 6/10
Got packet !

Sending packet 7/10
Got packet !

Sending packet 8/10
Got packet !

Sending packet 9/10
Got packet !

Sending packet 10/10
Got packet !
dong@ubuntu:~/sip/jrtplib/example$

 

4)jrtplib的rtp大小端问题

1)README.md里有一句话

- `RTP_BIG_ENDIAN`: If set, assume big-endian byte ordering.

2)CMakeLists.txt里有一段代码

if (CMAKE_CROSSCOMPILING)
    option (JRTPLIB_USE_BIGENDIAN "Target platform is big endian" ON)
    if (JRTPLIB_USE_BIGENDIAN)
        set(RTP_ENDIAN "#define RTP_BIG_ENDIAN")
    else (JRTPLIB_USE_BIGENDIAN)
        set(RTP_ENDIAN "// Little endian system")
    endif (JRTPLIB_USE_BIGENDIAN)
else (CMAKE_CROSSCOMPILING)
    test_big_endian(JRTPLIB_BIGENDIAN)
    if (JRTPLIB_BIGENDIAN)
        set(RTP_ENDIAN "#define RTP_BIG_ENDIAN")
    else (JRTPLIB_BIGENDIAN)
        set(RTP_ENDIAN "// Little endian system")
    endif (JRTPLIB_BIGENDIAN)
endif (CMAKE_CROSSCOMPILING)

3)从以上信息可以确认默认是大端模式

注释掉jrtplib-3.11.1/src/rtpconfig.h.in的56行就是小端模式

//${RTP_ENDIAN}

 

4) ERR_RTP_SESSION_CANTGETLOGINNAME

因为login不能创建会话,注释掉

 // if (!gotlogin)
 // {
 //  char *logname = getenv("LOGNAME");
 //  if (logname == 0)
 //   return ERR_RTP_SESSION_CANTGETLOGINNAME;
 //  strncpy((char *)buffer,logname,*bufferlength);
 // }
    if (!gotlogin)                                                                

    {                                                                          

        char *logname = getenv( "LOGNAME" );                                      

        if( 0 == logname )                                                        

        {                                                                     

            printf( "Can't getenv LOGNAME, we will use \"root\" instead\n" );             

            strncpy( ( char * )buffer, "root", *bufferlength );                            

        }                                                                     

        else                                                                   

        {                                                                      

            strncpy( ( char * )buffer, logname, *bufferlength );                          

        }                                                                     

    }    

 

 

5)实际应用

将jrtplib-3.11.1/examples/example1.cpp拆分成发送和接收

send.cpp

/*
   Here's a small IPv4 example: it asks for a portbase and a destination and 
   starts sending packets to that destination.
*/

#include "rtpsession.h"
#include "rtpudpv4transmitter.h"
#include "rtpipv4address.h"
#include "rtpsessionparams.h"
#include "rtperrors.h"
#include "rtplibraryversion.h"
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string>

using namespace jrtplib;

void checkerror(int rtperr)
{
    if (rtperr < 0)
    {
        std::cout << "ERROR: " << RTPGetErrorString(rtperr) << std::endl;
        exit(-1);
    }
}

int main(void)
{
    
    RTPSession sess;
    uint16_t portbase = 3000;
    uint16_t destport = 4000;
    uint32_t destip;

    int status,i;
    int num = 10;

    destip = inet_addr("127.0.0.1");
    if (destip == INADDR_NONE)
    {
        std::cerr << "Bad IP address specified" << std::endl;
        return -1;
    }
    
    destip = ntohl(destip);
        
    RTPUDPv4TransmissionParams transparams;
    RTPSessionParams sessparams;
    
    sessparams.SetOwnTimestampUnit(1.0/10.0);            
    sessparams.SetAcceptOwnPackets(true);

    transparams.SetPortbase(portbase);

    status = sess.Create(sessparams,&transparams);    
    checkerror(status);
    
    RTPIPv4Address addr(destip,destport);    
    status = sess.AddDestination(addr);
    checkerror(status);
    
    for (i = 1 ; i <= num ; i++)
    {
        printf("\nSending packet %d/%d\n",i,num);
        
        // send the packet
        status = sess.SendPacket((void *)"1234567890",10,0,false,10);
        checkerror(status);        
        
        RTPTime::Wait(RTPTime(1,0));
    }
    
    sess.BYEDestroy(RTPTime(10,0),0,0);

    return 0;
}

recv.cpp

/*
   Here's a small IPv4 example: it asks for a portbase and a destination and 
   starts sending packets to that destination.
*/

#include "rtpsession.h"
#include "rtpudpv4transmitter.h"
#include "rtpipv4address.h"
#include "rtpsessionparams.h"
#include "rtperrors.h"
#include "rtplibraryversion.h"
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string>

using namespace jrtplib;

void checkerror(int rtperr)
{
    if (rtperr < 0)
    {
        std::cout << "ERROR: " << RTPGetErrorString(rtperr) << std::endl;
        exit(-1);
    }
}

int main(void)
{    
    RTPSession sess;
    uint16_t portbase = 4000;

    int status;
        
    RTPUDPv4TransmissionParams transparams;
    RTPSessionParams sessparams;
    
    sessparams.SetOwnTimestampUnit(1.0/10.0);        
    sessparams.SetAcceptOwnPackets(true);

    transparams.SetPortbase(portbase);

    status = sess.Create(sessparams,&transparams);    
    checkerror(status);
    
    while(1)
    {
        
        sess.BeginDataAccess();
        
        // check incoming packets
        if (sess.GotoFirstSourceWithData())
        {
            do
            {
                RTPPacket *pack;
                
                while ((pack = sess.GetNextPacket()) != NULL)
                {
                    // You can examine the data here
                    printf("Got packet !\n");
                    
                    // we don't longer need the packet, so
                    // we'll delete it
                    sess.DeletePacket(pack);
                }
            } while (sess.GotoNextSourceWithData());
        }
        
        sess.EndDataAccess();


#ifndef RTP_SUPPORT_THREAD
        status = sess.Poll();
        checkerror(status);
#endif // RTP_SUPPORT_THREAD

    }
    
    sess.BYEDestroy(RTPTime(10,0),0,0);

    return 0;
}

_build.sh

export LD_LIBRARY_PATH=$(pwd)/_install/lib:$LD_LIBRARY_PATH

rm ./send ./recv

g++ send.cpp -I./_install/include/jrtplib3 -L./_install/lib -g -o send -ljrtp
g++ recv.cpp -I./_install/include/jrtplib3 -L./_install/lib -g -o recv -ljrtp

 

3、ortp是个坑

1) 安装库文件

_install.sh

#https://blog.csdn.net/yanchenyu365/article/details/78724790
#再经过阅读26.0版本日志发现,只是27.0有了那么多依赖,增加的功能对Linux又没啥意义,
#26.0 及其以前版本,直接就可以安装!直接就可以安装!直接就可以安装

rm -rf /home/dong/_install
./autogen.sh
./configure --prefix=/home/dong/_install --enable-static --enable-shared
make && make install

 

2)Example

ortp-0.26.0/src/tests/rtpsend.c

ortp-0.26.0/src/tests/rtprecv.c

_build.sh

export LD_LIBRARY_PATH=$(pwd)/_install/lib:$LD_LIBRARY_PATH

rm ./send ./recv

gcc -g -o send rtpsend.c -I./_install/include -L./_install/lib -lortp
gcc -g -o recv rtprecv.c -I./_install/include -L./_install/lib -lortp

 

3)Debug

rtpsend.c

    ortp_init();
    //ortp_scheduler_init();
    ortp_set_log_level_mask(ORTP_LOG_DOMAIN, ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR);
    session=rtp_session_new(RTP_SESSION_SENDONLY);    
    
    //rtp_session_set_scheduling_mode(session,1);
    //rtp_session_set_blocking_mode(session,1);
    //rtp_session_set_connected_mode(session,TRUE);
    rtp_session_set_remote_addr(session,argv[2],atoi(argv[3]));
    rtp_session_set_payload_type(session,8);

rtprecv.c

    ortp_init();
    //ortp_scheduler_init();
    ortp_set_log_level_mask(ORTP_LOG_DOMAIN, ORTP_DEBUG|ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR);
    signal(SIGINT,stop_handler);
    session=rtp_session_new(RTP_SESSION_RECVONLY);    
    //rtp_session_set_scheduling_mode(session,1);
    //rtp_session_set_blocking_mode(session,1);
    rtp_session_set_local_addr(session,"0.0.0.0",atoi(argv[2]),-1);
    //rtp_session_set_connected_mode(session,TRUE);
    //rtp_session_set_symmetric_rtp(session,TRUE);
    //rtp_session_enable_adaptive_jitter_compensation(session,adapt);
    //rtp_session_set_jitter_compensation(session,jittcomp);
    rtp_session_set_payload_type(session,8);
    //rtp_session_signal_connect(session,"ssrc_changed",(RtpCallback)ssrc_cb,0);
    //rtp_session_signal_connect(session,"ssrc_changed",(RtpCallback)rtp_session_reset,0);

./send file.g711a 127.0.0.1 4000 

./recv test 4000

 

遗留bug

rtpsend能正常发送,rtprecv接收有问题,如果你解决了,记得告诉我,感谢!

dong@ubuntu:~/sip/ortp/example$ gdb recv
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from recv...done.
(gdb) set args test 4000
(gdb) r
Starting program: /home/dong/sip/ortp/example/recv test 4000
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
2019-12-05 18:20:15:555 ortp-message-RtpSession bound to [0.0.0.0] ports [4000] [38524]

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7bccbf3 in concatb (mp=mp@entry=0x6043c0, newm=newm@entry=0x0)
    at str_utils.c:317
317        while(newm->b_cont!=NULL) newm=newm->b_cont;
(gdb)

闲散下来再来修复...

 

靠,ortp官网处处都是陷阱

http://www.linphone.org/index.php/eng/code_review/ortp/

https://gitlab.linphone.org/BC/public/ortp

ortp的分支有些特性不同,下载源码需要注意

 

a) 数据收发demo在src/tests/目录

 src/tests/rtpsend.c

 src/tests/rtprecv.c

 

b) rtp数据流的处理以及质量反馈

rtcp feedback模块

rtcp_fb.c

rtcp扩展模块

rtcp_xf.c

 

4、Bell Labs

RTP Library

http://www.cs.columbia.edu/irt/software/rtplib/

 

5、UCL Common Code Library

伦敦大学学院的通用代码库里的rtp/rtcp部分

University College London

rtpdemo.c

复制代码
/* 
 * rtpdemo: A simple rtp application that sends and receives data.
 *
 * (C) 2000-2001 University College London.
 */

#include <sys/time.h>

#include <ctype.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include "uclconf.h"
#include "config_unix.h"
#include "config_win32.h"
#include "debug.h"
#include "memory.h"
#include "rtp.h"

static void 
usage() 
{
    printf("Usage: rtpdemo [switches] address port\n");
    printf("Valid switches are:\n");
    printf("  -f\t\tFilter local packets out of receive stream.\n");
    printf("  -l\t\tListen and do not transmit data.\n");
    exit(-1);
}

/* ------------------------------------------------------------------------- */
/* RTP callback related */

static void
sdes_print(struct rtp *session, uint32_t ssrc, rtcp_sdes_type stype) {
    const char *sdes_type_names[] = {
        "end", "cname", "name", "email", "telephone", 
        "location", "tool", "note", "priv"
    };
    const uint8_t n = sizeof(sdes_type_names) / sizeof(sdes_type_names[0]);

    if (stype > n) {
        /* Theoretically impossible */
        printf("boo! invalud sdes field %d\n", stype);
        return;
    }
    
    printf("SSRC 0x%08x reported SDES type %s - ", ssrc, 
           sdes_type_names[stype]);

    if (stype == RTCP_SDES_PRIV) {
        /* Requires extra-handling, not important for example */
        printf("don't know how to display.\n");
    } else {
        printf("%s\n", rtp_get_sdes(session, ssrc, stype));
    }
}

static void
packet_print(struct rtp *session, rtp_packet *p) 
{
    printf("Received data (payload %d timestamp %06d size %d) ", p->pt, p->ts, p->data_len);

    if (p->ssrc == rtp_my_ssrc(session)) {
        /* Unless filtering is enabled we are likely to see
           out packets if sending to a multicast group. */
        printf("that I just sent.\n");
    } else {
        printf("from SSRC 0x%08x\n", p->ssrc); 
    } 
}

static void
rtp_event_handler(struct rtp *session, rtp_event *e) 
{
    rtp_packet    *p;
    rtcp_sdes_item    *r;

    switch(e->type) {
    case RX_RTP:     
        p = (rtp_packet*)e->data;
        packet_print(session, p);
        xfree(p); /* xfree() is mandatory to release RTP packet data */
        break;
    case RX_SDES:
        r = (rtcp_sdes_item*)e->data;
        sdes_print(session, e->ssrc, r->type);
        break;
    case RX_BYE:
        break;
    case SOURCE_CREATED:
        printf("New source created, SSRC = 0x%08x\n", e->ssrc);
        break;
    case SOURCE_DELETED:
        printf("Source deleted, SSRC = 0x%08x\n", e->ssrc);
        break;
    case RX_SR:
    case RX_RR:
    case RX_RR_EMPTY:
    case RX_RTCP_START:
    case RX_RTCP_FINISH:
    case RR_TIMEOUT:
    case RX_APP:
        break;
    }
    fflush(stdout);
}

/* ------------------------------------------------------------------------- */
/* Send and receive loop.  Sender use 20ms audio mulaw packets */

#define MULAW_BYTES    4 * 160
#define MULAW_PAYLOAD    0
#define MULAW_MS    4 * 20

#define MAX_ROUNDS    100

static void
rxtx_loop(struct rtp* session, int send_enable) 
{
    struct timeval    timeout;
    uint32_t    rtp_ts, round;
    uint8_t        mulaw_buffer[MULAW_BYTES];

    if (send_enable) {
        printf("Sending and listening to ");
    } else {
        printf("Listening to ");
    }
    printf("%s port %d (local SSRC = 0x%08x)\n", 
           rtp_get_addr(session), 
           rtp_get_rx_port(session),
           rtp_my_ssrc(session));

    round = 0;

    for(round = 0; round < MAX_ROUNDS; round++) {
        rtp_ts = round * MULAW_MS;

        /* Send control packets */
        rtp_send_ctrl(session, rtp_ts, NULL);

        /* Send data packets */
        if (send_enable) {
            rtp_send_data(session, rtp_ts, MULAW_PAYLOAD, 
                      0, 0, 0,
                      (char*)mulaw_buffer, MULAW_BYTES, 
                      0, 0, 0);
        }

        /* Receive control and data packets */
        timeout.tv_sec  = 0;
        timeout.tv_usec = 0;
        rtp_recv(session, &timeout, rtp_ts);

        /* State maintenance */
        rtp_update(session);

        usleep(MULAW_MS * 1000);
        xmemchk();
    }
}

/* ------------------------------------------------------------------------- */
/* Main loop: parses command line and initializes RTP session */

int 
main(int argc, const char *argv[]) 
{
    const char    *address = NULL;
    struct rtp    *session = NULL;
    uint16_t    port = 0;
    int32_t        ac, filter_me = 0, send_enable = 1;

    ac = 1;
    while (ac < argc && argv[ac][0] == '-') {
        switch(tolower(argv[ac][1])) {
        case 'f':
            filter_me = 1;
            break;
        case 'l':
            send_enable = 0;
            break;
        }
        ac++;
    }

    if (argc - ac != 2) {
        usage();
    }

    address    = argv[ac];
    port    = atoi(argv[ac + 1]);

    session = rtp_init(address,        /* Host/Group IP address */ 
               port,        /* receive port */
               port,        /* transmit port */
               16,            /* time-to-live */
               64000,        /* B/W estimate */
               rtp_event_handler,    /* RTP event callback */
               NULL);        /* App. specific data */

    if (session) {
        const char     *username  = "Malcovich Malcovitch";
        const char    *telephone = "1-800-RTP-DEMO";
        const char    *toolname  = "RTPdemo";

        uint32_t     my_ssrc = rtp_my_ssrc(session);

        /* Set local participant info */
        rtp_set_sdes(session, my_ssrc, RTCP_SDES_NAME,
                 username, strlen(username));
        rtp_set_sdes(session, my_ssrc, RTCP_SDES_PHONE,
                 telephone, strlen(telephone));
        rtp_set_sdes(session, my_ssrc, RTCP_SDES_TOOL,
                 toolname, strlen(toolname));

        /* Filter out local packets if requested */
        rtp_set_option(session, RTP_OPT_FILTER_MY_PACKETS, filter_me);

        /* Run main loop */
        rxtx_loop(session, send_enable);

        /* Say bye-bye */
        rtp_send_bye(session);
        rtp_done(session);
    } else {
        printf("Could not initialize session for %s port %d\n",
               address,
               port);
    }

    return 0;
}
复制代码

 

https://files.cnblogs.com/files/dong1/common-1.2.14.tar.gz

 

posted @ 2019-03-07 20:48  dong1  阅读(747)  评论(0编辑  收藏  举报