linphone-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Linphone-users] Using test_rtprecv Applicatoin


From: Eduardo Bezerra
Subject: Re: [Linphone-users] Using test_rtprecv Applicatoin
Date: Mon, 30 May 2005 11:39:58 -0600

Hi,


  I've tried to do the stuff. I made some changes in recv and I created the send.
But the versions above don't use files. The sender gets from the mic, codifies using
MUAlaw and the sends using oRTP. The recv is exactly the original, except that
I removed the dispatcher and the file handler MSFilters:


##########
Receiver
##########


#include "msrtprecv.h"
#include "ms.h"
#include "mswrite.h"
#include "msosswrite.h"
#include "msMUlawdec.h"
#include "mstimer.h"
#include "msfdispatcher.h"

#include <signal.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>

static int cond=1;

void usage(){
    printf(
            "\nUsage: \ntest_rtprecv <output_file> <address> <port>\n"
            "<output_file> is a file to log the flow\n"
            "<address> is a local ip address to listen\n"
            "<port> is a local udp port to listen\n"
        );

}

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

int main(int argc, char *argv[]){
    MSFilter *play,*dec,*rec;
    MSSync *timer;
    RtpSession *rtps;
    int port;
   
    if (argc < 4){
        usage();
        exit(0);
    }
    port = atoi(argv[3]);

    printf("#################################\n"
           "Test Program\n"
           "Receiving RTP flow with oRTP\n"
           "#################################\n"
          );
    /*create the rtp session */
    ortp_init();
    ortp_set_debug_file("oRTP",NULL);
    rtps=rtp_session_new(RTP_SESSION_RECVONLY);
    rtp_session_set_local_addr(rtps,argv[2],port);
    rtp_session_set_scheduling_mode(rtps,0);
    rtp_session_set_blocking_mode(rtps,0);

    printf(
        "##########################################################################\n"
        "Inicialized to listen to the %s (local address) in the port %d\n"
        "##########################################################################\n", argv[2], port);
    ms_init();
    signal(SIGINT,stop_handler);
   
    play=ms_rtp_recv_new();
    rec=ms_oss_write_new();
    ms_sound_write_set_device(MS_SOUND_WRITE(rec),0);
    dec=ms_MULAWdecoder_new();
    timer=ms_timer_new();

    ms_rtp_recv_set_session(MS_RTP_RECV(play),rtps);
   
    ms_filter_add_link(play,dec);
    ms_filter_add_link(dec,rec);
    ms_sync_attach(timer,play);
    printf(
        "############\n"
        "gran=%i\n"
        "############\n",MS_SYNC(timer)->samples_per_tick);
   
    ms_start(timer);
    ms_sound_write_start(MS_SOUND_WRITE(rec));
    while(cond)
    {
        sleep(1);
    }
   
    printf(
        "#################################\n"
        "stoping sync...\n"
        "#################################\n");
    ms_stop(timer);
    ms_sound_write_stop(MS_SOUND_WRITE(rec));
    printf(
        "#################################\n"
        "unlinking filters...\n"
        "#################################\n");
    ms_filter_remove_links(play,dec);
    ms_filter_remove_links(dec,rec);
    printf( "#################################\n"
            "destroying filters...\n"
            "#################################\n");
    ms_filter_destroy(play);
    ms_filter_destroy(dec);
    ms_filter_destroy(rec);
   
    rtp_session_destroy(rtps);
    ms_sync_destroy(timer);
    ortp_global_stats_display();
   
    return 0;
}


#############
Sender
#############

#include "msrtpsend.h"
#include "ms.h"
#include "msread.h"
#include "msossread.h"
#include "msMUlawenc.h"
#include "mstimer.h"
#include "msfdispatcher.h"

#include <signal.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>

static int cond=1;

void usage(){
    printf(
            "\nUsage: \ntest_rtpsend <output_file> <address> <port>\n"
            "<output_file> is a file to log the flow\n"
            "<address> is a remote ip address to listen\n"
            "<port> is a remote udp port to listen\n"
        );

}

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

int main(int argc, char *argv[]){
    MSFilter *sender,*enc,*mic;
    MSSync *timer;
    RtpSession *rtps;
    int port;
   
    if (argc < 4){
        usage();
        exit(0);
    }
    port = atoi(argv[3]);

    printf("#################################\n"
           "Test Program\n"
           "Sending RTP flow with oRTP\n"
           "#################################\n"
          );
    /*create the rtp session */
    ortp_init();
    ortp_set_debug_file("oRTP",NULL);
    rtps=rtp_session_new(RTP_SESSION_SENDONLY);
    rtp_session_set_remote_addr(rtps,argv[2],port);
    rtp_session_set_scheduling_mode(rtps,0);
    rtp_session_set_blocking_mode(rtps,0);

    printf(
        "##########################################################################\n"
        "Inicialized to write on the %s (remote address) in the port %d\n"
        "##########################################################################\n", argv[2], port);
    ms_init();
    signal(SIGINT,stop_handler);
   
    sender=(MSFilter*)ms_rtp_send_new();
    mic=(MSFilter*)ms_oss_read_new();
    ms_sound_read_set_device(MS_SOUND_READ(mic),0);
    enc=(MSFilter*)ms_MULAWencoder_new();

    timer=ms_timer_new();

    ms_rtp_send_set_session(MS_RTP_SEND(sender),rtps);
   
    ms_filter_add_link(mic,enc);
    ms_filter_add_link(enc,sender);
    ms_sync_attach(timer,mic);
    printf(
        "############\n"
        "gran=%i\n"
        "############\n",MS_SYNC(timer)->samples_per_tick);
   
    ms_start(timer);
    ms_sound_read_start(MS_SOUND_READ(mic));
    while(cond)
    {
        sleep(1);
    }
   
    printf(
        "#################################\n"
        "stoping sync...\n"
        "#################################\n");
    ms_stop(timer);
    ms_sound_read_stop(MS_SOUND_READ(mic));
    printf(
        "#################################\n"
        "unlinking filters...\n"
        "#################################\n");
    ms_filter_remove_links(enc,sender);
    ms_filter_remove_links(mic,enc);
    printf( "#################################\n"
            "destroying filters...\n"
            "#################################\n");
    ms_filter_destroy(sender);
    ms_filter_destroy(enc);
    ms_filter_destroy(mic);
   
    rtp_session_destroy(rtps);
    ms_sync_destroy(timer);
    ortp_global_stats_display();
   
    return 0;
}


Eduardo Bezerra Valentin

2005/5/13, Vanitha Ramaswami <address@hidden>:
Hi All,

How to run the test_rtprecv application present in the
mediastream. Where do i find the
equivalent rtpsend application for it ?

I would like to establish a rtp session between the
target and the another host PC, and
would like to playout some .wav files to my target. Is
it possible to do the
same using the test_rtprecv application. Am i on the
right track ?.

I Appreciate your inputs on this.

Thanks
Vanitha

__________________________________
Yahoo! Mail Mobile
Take Yahoo! Mail with you! Check email on your mobile phone.
http://mobile.yahoo.com/learn/mail

_______________________________________________
Linphone-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/linphone-users


reply via email to

[Prev in Thread] Current Thread [Next in Thread]