linphone-developers
[Top][All Lists]
Advanced

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

[Linphone-developers] mediastreamer2 use help


From: lilinde
Subject: [Linphone-developers] mediastreamer2 use help
Date: Tue, 28 May 2019 21:17:52 -0700 (MST)

        ortp_init();
         
        ms_init();
        

        MSSndCard *card_capture =
ms_snd_card_manager_get_default_capture_card(ms_snd_card_manager_get());
        MSSndCard *card_playback =
ms_snd_card_manager_get_default_playback_card(ms_snd_card_manager_get());
        /* audio capture filter */
        MSFilter *soundread = ms_snd_card_create_reader(card_capture);
        MSFilter *soundwrite = ms_snd_card_create_writer(card_playback);
         
        MSFilter *encoder = ms_filter_create_encoder("PCMU");
        MSFilter *decoder = ms_filter_create_decoder("PCMU");
        MSFilter *rtpsend = ms_filter_new(MS_RTP_SEND_ID);
        MSFilter *rtprecv = ms_filter_new(MS_RTP_RECV_ID);

        MSFactory* factory = ms_factory_new_with_voip(); 
        RtpProfile* profile = rtp_profile_clone_full(&av_profile);
        AudioStream *audio= audio_stream_start(factory, profile, 6666, 
"127.0.0.1",
6666, 0, 0, 0);
        if (audio)
        {
         
                
                qDebug() << "ok!";

                RtpSession *rtp_session = audio_stream_get_rtp_session(audio);
                OrtpEvQueue* q = ortp_ev_queue_new();
                rtp_session_register_event_queue(rtp_session, q);

                ms_filter_call_method(rtpsend, MS_RTP_SEND_SET_SESSION, 
rtp_session);
                ms_filter_call_method(rtprecv, MS_RTP_RECV_SET_SESSION, 
rtp_session);

                int sr = 8000;
                int chan = 1;
                ms_filter_call_method(soundread, MS_FILTER_SET_SAMPLE_RATE, 
&sr);
                //ms_filter_call_method(soundread, MS_FILTER_SET_NCHANNELS, 
&chan);

                ms_filter_call_method(soundwrite, MS_FILTER_SET_SAMPLE_RATE, 
&sr);
                ms_filter_call_method(soundwrite, MS_FILTER_SET_NCHANNELS, 
&chan);

                ms_filter_call_method(encoder, MS_FILTER_SET_SAMPLE_RATE, &sr);

                ms_filter_call_method(decoder, MS_FILTER_SET_SAMPLE_RATE, &sr);

                //link
                ms_filter_link(soundread, 0, encoder, 0);
                ms_filter_link(encoder, 0, rtpsend, 0);

                ms_filter_link(rtprecv, 0, decoder, 0);
                ms_filter_link(decoder, 0, soundwrite, 0);
                //ms_filter_link(stream->dtmfgen, 0, stream->soundwrite, 0);

                  /* create ticker */
                MSTicker *ticker = ms_ticker_new();
                ms_ticker_attach(ticker, soundread);
                ms_ticker_attach(ticker, rtprecv);

        }
        
i hear my volice error ,hao to change?



--
Sent from: http://nongnu.13855.n7.nabble.com/linphone-developers-f38648.html



reply via email to

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