linphone-developers
[Top][All Lists]
Advanced

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

[Linphone-developers] Re: Issue with rtp_session_recvm_with_ts


From: Prakash Krishnaswamy
Subject: [Linphone-developers] Re: Issue with rtp_session_recvm_with_ts
Date: Wed, 20 Aug 2008 18:09:41 +0530
User-agent: Thunderbird 2.0.0.6 (Windows/20070728)

Prakash Krishnaswamy wrote:
Hi All,

I am using rtp_session_recvm_with_ts API to read RTP packets.
I read audio and video packets in separate threads.
Video is half-duplex and audio is full-duplex.
But some times rtp_session_recvm_with_ts does not return any packets and waits until socket is closed. I am pasting the code I am using.
Any suggestion would be very helpful to me.

Thanks,
Prakash.K

Initialization:
#define RTP_RECV_SIZE      1500

pRTPVideoSession = rtp_session_new(RTP_SESSION_RECVONLY);
rtp_session_set_scheduling_mode(pRTPVideoSession, TRUE);
rtp_session_set_blocking_mode(pRTPVideoSession, FALSE);
rtp_session_set_local_addr(pRTPVideoSession, localIP, vseParams.localVideoPort);
rtp_session_set_recv_payload_type(pRTPVideoSession, 34);
rtp_session_set_recv_buf_size(pRTPVideoSession, RTP_RECV_SIZE);
rtp_session_enable_jitter_buffer(pRTPVideoSession, FALSE);
rtp_session_set_jitter_compensation(pRTPVideoSession, 0);
pSessionSetVideo = session_set_new();
ortpTimeStamp = 0;

pRTPAudioSession = rtp_session_new(RTP_SESSION_SENDRECV);
rtp_session_set_scheduling_mode(pRTPAudioSession, 1);
rtp_session_set_blocking_mode(pRTPAudioSession, 0);
rtp_session_set_remote_addr(pRTPAudioSession, remoteIP, remAudioPort);
rtp_session_set_send_payload_type(pRTPAudioSession, 0);
rtp_session_set_local_addr(pRTPAudioSession, localIP, vseParams.localAudioPort);
rtp_session_set_recv_payload_type(pRTPAudioSession, 0);
rtp_session_set_recv_buf_size(pRTPAudioSession, RTP_RECV_SIZE);
rtp_session_enable_jitter_buffer(pRTPAudioSession, FALSE);
rtp_session_set_jitter_compensation(pRTPAudioSession, 0);
pSessionSetAudio = session_set_new();

Video Receive function (called from separate thread)
void VSEngine::pollVideoRTPMessages(void)
{
    session_set_set(pSessionSetVideo, pRTPVideoSession);
    int ret = session_set_select(pSessionSetVideo, NULL, NULL);
    if (ret == 0)
      PFDLog("session_set_select is returning 0\n");

    if (!session_set_is_set(pSessionSetVideo, pRTPVideoSession)) {
      PFDLog("session_set_is_set FALSE\n");
        return;
    }

   mblk_t *mp;

while ((mp = rtp_session_recvm_with_ts(pRTPVideoSession, ortpTimeStamp)) != NULL)
   {
PayloadType *payload = rtp_profile_get_payload (pRTPVideoSession->rcv.profile,
                        pRTPVideoSession->rcv.pt);

       if (payload != NULL) {
         int size = msg_to_buf(mp, pRTPVideoRcvBuf, RTP_RECV_SIZE);

         if ((size > 2) && (size < RTP_RECV_SIZE)) {
             int mark = rtp_get_markbit(mp);
            pRfc2429->dePacketize(pRTPVideoRcvBuf, size, mark);
         }
       }
       freemsg(mp);
   }

   ortpTimeStamp += 1;
}

Audio Receive function (called from separate thread)
void VSEngine::pollAudioRTPMessages(void)
{
static int audioOrtpTimestamp = 0 ;
    session_set_set(pSessionSetAudio, pRTPAudioSession);
    int ret = session_set_select(pSessionSetAudio, NULL, NULL);
    if (ret == 0)
        PFDLog("session_set_select is returning 0\n");

    if (!session_set_is_set(pSessionSetAudio, pRTPAudioSession)) {
        PFDLog("session_set_is_set FALSE\n");
        return;
    }

    mblk_t *mp ;

while ((mp = rtp_session_recvm_with_ts(pRTPAudioSession, audioOrtpTimestamp++)) != NULL)
    {

PayloadType *payload = rtp_profile_get_payload (pRTPAudioSession->rcv.profile,
            pRTPAudioSession->rcv.pt);

        if (payload != NULL) {
            mblk_t *m = mp->b_cont;
            int size = (int) msgdsize (m);

memcpy (pRTPAudioRcvBuf, m->b_rptr, size); PFDAudioPlayStart(pAudioHandle, pRTPAudioRcvBuf, size) ;
        }

        freemsg(mp);
    }
}


I have been facing this issue for a long time.
Kindly help me.

Thanks,
Prakash.K




reply via email to

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