ORTP库传输RTP声音流,VLC播放有噪音

发送WAV(PCMU)的声音文件到VLC播放器,能够听到音乐,但是噪音很大,有没有知道是什么原因的,谢谢,谢谢,谢谢... ...

发送端代码:

#include <stdio.h>
#include <signal.h>
#include <ortp/ortp.h>

#define SIZE 160
#define TIMESTAMP 160

int cond=1;

void stop(int signum)
{
    cond=0;
}

int main(int argc,char** argv)
{
    RtpSession* session;
    int ts=0;
    int fd;
    int readcount=0;
    int sendcount=0;
    char buf[SIZE];

    ortp_init();
    ortp_scheduler_init();
    ortp_init();
    ortp_scheduler_init();
    ortp_set_log_level_mask(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,0);

    fd=open(argv[1],O_RDONLY);
    if(fd==-1)
    {
        perror("open");
        return -1;
    }

    signal(SIGINT,stop);
    while(cond)
    {
        readcount=read(fd,buf,SIZE);
        if(readcount>0)
        {
            sendcount=rtp_session_send_with_ts(session,buf,readcount,ts);
        }
        else if(readcount==0)
        {
            printf("reading complete\n");
            break;
        }
        else if(readcount==-1)
        {
            perror("read");
            return -1;
        }
        ts+=TIMESTAMP;
    }

    if(close(fd)==-1)
    {
        perror("close");
        return -1;
    }
    rtp_session_destroy(session);
    ortp_exit();
    ortp_global_stats_display();

    return 0;
}

VLC的SDP文件:

m=audio 8888 RTP/AVP 0 
a=rtpmap:0 pcmu/8000
a=ptime:20
c=IN IP4 192.168.0.36

我自己发现问题的原因了:是声音格式的问题

在VLC的SDP文件中表明用PCMU格式,我之前用Cool Edit Pro将声音文件转换为PCMU格式,但不知道是我操作的原因还是这个软件本身的原因,其实转换出来的声音文件格式并不是U-LAW的,所以VLC这边解码播放的时候有问题,我用另一种软件转换为U-LAW后,播放就正常了

你有传过aac吗,弄不出来