[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Linphone-developers] How to realize DTX with oRTPlib?
From: |
Simon Morlat |
Subject: |
Re: [Linphone-developers] How to realize DTX with oRTPlib? |
Date: |
Tue, 8 Apr 2008 22:14:45 +0200 |
User-agent: |
KMail/1.9.7 |
Hi,
Thank you very much, I've merged it.
Simon
Le Saturday 01 March 2008 12:48:36 Машкин С В, vous avez écrit :
> Hi, Simon!
>
>
>
> I've realized the "patch", and it seems, that it works...
>
> The "patch" is only 4 additional strings in rtp_session_sendm_with_ts()
> body
>
> and 1 string in its description).
>
> With this patch if mp==NULL, rtp_session_sendm_with_ts() does not send any
> packets,
>
> but does process timestamp and tx-rtpsession-time.
>
>
>
> P.S.: For experimental tests I used
>
> oRTP-0.13.1,
>
> G.729-annexb ITU vocoder (to form mp),
>
> Ethereal (to check rtp-streams),
>
> remote eyeBeam ip-phone software.
>
>
>
> Serg Ma
>
>
>
> ---------------------------------------------------------------------------
>----
>
> New "patched" version of rtp_session_sendm_with_ts(),
>
> additional strings are marked by (***).
>
> Used original version of ortplib is oRTP-0.13.1.
>
> ---------------------------------------------------------------------------
>----
>
>
>
> /**
>
> * Send the rtp datagram @mp to the destination set by
> rtp_session_set_remote_addr()
>
> * with timestamp @timestamp. For audio data, the timestamp is the number
>
> * of the first sample resulting of the data transmitted. See rfc1889 for
> details.
>
> * If @mp is NULL, no rtp datagram will be sent. (***)
>
> * The packet (@mp) is freed once it is sended.
>
> *
>
> address@hidden session a rtp session.
>
> address@hidden mp a rtp packet presented as a mblk_t.
>
> address@hidden timestamp the timestamp of the data to be sent.
>
> * @return the number of bytes sent over the network.
>
> **/
>
> int
>
> rtp_session_sendm_with_ts (RtpSession * session, mblk_t *mp, uint32_t
> timestamp)
>
> {
>
> rtp_header_t *rtp;
>
> uint32_t packet_time;
>
> int error = 0;
>
> int packsize;
>
> RtpScheduler *sched=session->sched;
>
> RtpStream *stream=&session->rtp;
>
>
>
> if (session->flags & RTP_SESSION_SEND_NOT_STARTED)
>
> {
>
> session->rtp.snd_ts_offset = timestamp;
>
> /* Set initial last_rcv_time to first send time. */
>
> if ((session->flags & RTP_SESSION_RECV_NOT_STARTED)
>
> || session->mode == RTP_SESSION_SENDONLY)
>
> {
>
> gettimeofday(&session->last_recv_time, NULL);
>
> }
>
> if (session->flags & RTP_SESSION_SCHEDULED)
>
> {
>
> session->rtp.snd_time_offset = sched->time_;
>
> }
>
> rtp_session_unset_flag (session,RTP_SESSION_SEND_NOT_STARTED);
>
> }
>
> /* if we are in blocking mode, then suspend the process until the
> scheduler it's time to send the
>
> * next packet */
>
> /* if the timestamp of the packet queued is older than current time,
> then
> you we must
>
> * not block */
>
> if (session->flags & RTP_SESSION_SCHEDULED)
>
> {
>
> packet_time =
>
> rtp_session_ts_to_time (session,
>
> timestamp -
>
> session->rtp.snd_ts_offset) +
>
> session->rtp.snd_time_offset;
>
> /*ortp_message("rtp_session_send_with_ts: packet_time=%i
> time=%i",packet_time,sched->time_);*/
>
> wait_point_lock(&session->snd.wp);
>
> if (TIME_IS_STRICTLY_NEWER_THAN (packet_time, sched->time_))
>
> {
>
>
> wait_point_wakeup_at(&session->snd.wp,packet_time,(session->flags &
> RTP_SESSION_BLOCKING_MODE)!=0);
>
> session_set_clr(&sched->w_sessions,session); /* the
> session has written
> */
>
> }
>
> else
>
> {
>
> session_set_set(&sched->w_sessions,session); /*to
> indicate select to return immediately */
>
> }
>
> wait_point_unlock(&session->snd.wp);
>
> }
>
>
>
> if(mp==NULL) { //(***)
>
> session->rtp.snd_last_ts = timestamp; //(***)
>
> return 0; //(***)
>
> } //(***)
>
>
>
> rtp=(rtp_header_t*)mp->b_rptr;
>
>
>
> packsize = msgdsize(mp) ;
>
>
>
> rtp->timestamp=timestamp;
>
> if (session->snd.telephone_events_pt==rtp->paytype)
>
> {
>
> session->rtp.snd_seq++;
>
> rtp->seq_number = session->rtp.snd_seq;
>
> }
>
> else
>
> session->rtp.snd_seq=rtp->seq_number+1;
>
> session->rtp.snd_last_ts = timestamp;
>
>
>
> ortp_global_stats.sent += packsize;
>
> stream->stats.sent += packsize;
>
> ortp_global_stats.packet_sent++;
>
> stream->stats.packet_sent++;
>
>
>
> error = rtp_session_rtp_send (session, mp);
>
> /*send RTCP packet if needed */
>
> rtp_session_rtcp_process_send(session);
>
> /* receives rtcp packet if session is send-only*/
>
> /*otherwise it is done in rtp_session_recvm_with_ts */
>
> if (session->mode==RTP_SESSION_SENDONLY) rtp_session_rtcp_recv(session);
>
> return error;
>
> }
>
>
>
>
>
>
>
> ---------------------------------------------------------------------------
>----
>
> > > Can rtp_session_sendm_with_ts() send nothing when input
> > >
> > >
> > >
> > > argument mp==NULL?
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > If it can't, may be it is good idea to make the patch?
> >
> > Yes I think can be a possibility. I realize the session_set* api is not
> > very
> >
> > suitable for discontinuous transmission.
> >
> > Do you have a strong requirement for using this session_set api ?
> >
> > Alternatively you can just create one thread per session and use
> >
> > rtp_session_sendm_with_ts() with blocking mode.
> >
> > In that case, when sending the packet that comes after a silence periods,
> > so
> >
> > with a timestamp in the future, then rtp_session_sendm_with_ts() will
> > block
> >
> > until it's really time for the packet to be sent.
> >
> >
> >
> > Simon
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > P.S.: But may be there is standard way to realize DTX with oRTPlib?
> >
> > > Thanks.
> > >
> > >
> > >
> > > Serg Ma
>
> _______________________________________________
> Linphone-developers mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/linphone-developers
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Linphone-developers] How to realize DTX with oRTPlib?,
Simon Morlat <=