[Freeswitch-svn] [commit] r11312 - freeswitch/trunk/src/mod/endpoints/mod_opal

FreeSWITCH SVN anthm at freeswitch.org
Tue Jan 20 09:22:56 PST 2009


Author: anthm
Date: Tue Jan 20 11:22:56 2009
New Revision: 11312

Log:
workaround to test a theory

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp
   freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.h

Modified: freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp	Tue Jan 20 11:22:56 2009
@@ -1212,6 +1212,8 @@
 
 switch_status_t FSMediaStream::write_frame(const switch_frame_t *frame, switch_io_flag_t flags)
 {
+    RTP_DataFrame rtp;
+
     if (!switch_channel_ready(m_fsChannel)) {
         return SWITCH_STATUS_FALSE;
     }
@@ -1221,22 +1223,41 @@
         m_callOnStart = false;
     }
 
+    if ((frame->flags & SFF_CNG)) {
+        return SWITCH_STATUS_SUCCESS;
+    }
+
     if ((frame->flags & SFF_RAW_RTP) != 0) {
         RTP_DataFrame rtp((const BYTE *) frame->packet, frame->packetlen, false);
-        if (GetPatch()->PushFrame(rtp))
-            return SWITCH_STATUS_SUCCESS;
-    } else if (frame->flags == 0) {
-        RTP_DataFrame rtp;
-        rtp.SetPayloadType(mediaFormat.GetPayloadType());
-        rtp.SetPayloadSize(frame->datalen);
-        rtp.SetTimestamp(frame->timestamp);
-        rtp.SetSyncSource(frame->ssrc);
-        rtp.SetMarker(frame->m);
-        memcpy(rtp.GetPayloadPtr(), frame->data, frame->datalen);
-        if (GetPatch()->PushFrame(rtp))
+        if (GetPatch()->PushFrame(rtp)) {
             return SWITCH_STATUS_SUCCESS;
+        }
+    } 
+    
+    /* If we reach this code it means a call to an ivr or something else that does not generate timestamps
+       Its possible that frame->timestamp is set but not guarenteed and is best ignored for the time being.
+       We are probably relying on the rtp stack to generate the timestamp and ssrc for us at this point.
+       As a quick hack I am going to keep a sample counter and increment it by frame->samples but it would be 
+       better if we could engage whatever it is in opal that makes it generate the timestamp.
+     */
+
+    rtp.SetPayloadType(mediaFormat.GetPayloadType());
+    rtp.SetPayloadSize(frame->datalen);
+
+    m_timeStamp += frame->samples;
+    rtp.SetTimestamp(m_timeStamp);
+    
+    //rtp.SetTimestamp(frame->timestamp);
+    //rtp.SetSyncSource(frame->ssrc);
+    //rtp.SetMarker(frame->m);
+
+    memcpy(rtp.GetPayloadPtr(), frame->data, frame->datalen);
+
+    if (GetPatch()->PushFrame(rtp)) {
+        return SWITCH_STATUS_SUCCESS;
     }
 
+
     return SWITCH_STATUS_FALSE;
 }
 

Modified: freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.h
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.h	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.h	Tue Jan 20 11:22:56 2009
@@ -216,6 +216,7 @@
     switch_frame_t m_readFrame;
     RTP_DataFrame m_readRTP;
     bool m_callOnStart;
+    uint32_t m_timeStamp;
 };
 
 



More information about the Freeswitch-svn mailing list