]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
workaround to test a theory
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 20 Jan 2009 17:22:56 +0000 (17:22 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 20 Jan 2009 17:22:56 +0000 (17:22 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11312 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_opal/mod_opal.cpp
src/mod/endpoints/mod_opal/mod_opal.h

index b461ad8dd67cce11aa994d205e71ed1bdf505564..8aad7c7757284987fa467067870c0d4366bce6d6 100644 (file)
@@ -1212,6 +1212,8 @@ switch_status_t FSMediaStream::read_frame(switch_frame_t **frame, switch_io_flag
 \r
 switch_status_t FSMediaStream::write_frame(const switch_frame_t *frame, switch_io_flag_t flags)\r
 {\r
+    RTP_DataFrame rtp;\r
+\r
     if (!switch_channel_ready(m_fsChannel)) {\r
         return SWITCH_STATUS_FALSE;\r
     }\r
@@ -1221,22 +1223,41 @@ switch_status_t FSMediaStream::write_frame(const switch_frame_t *frame, switch_i
         m_callOnStart = false;\r
     }\r
 \r
+    if ((frame->flags & SFF_CNG)) {\r
+        return SWITCH_STATUS_SUCCESS;\r
+    }\r
+\r
     if ((frame->flags & SFF_RAW_RTP) != 0) {\r
         RTP_DataFrame rtp((const BYTE *) frame->packet, frame->packetlen, false);\r
-        if (GetPatch()->PushFrame(rtp))\r
-            return SWITCH_STATUS_SUCCESS;\r
-    } else if (frame->flags == 0) {\r
-        RTP_DataFrame rtp;\r
-        rtp.SetPayloadType(mediaFormat.GetPayloadType());\r
-        rtp.SetPayloadSize(frame->datalen);\r
-        rtp.SetTimestamp(frame->timestamp);\r
-        rtp.SetSyncSource(frame->ssrc);\r
-        rtp.SetMarker(frame->m);\r
-        memcpy(rtp.GetPayloadPtr(), frame->data, frame->datalen);\r
-        if (GetPatch()->PushFrame(rtp))\r
+        if (GetPatch()->PushFrame(rtp)) {\r
             return SWITCH_STATUS_SUCCESS;\r
+        }\r
+    } \r
+    \r
+    /* If we reach this code it means a call to an ivr or something else that does not generate timestamps\r
+       Its possible that frame->timestamp is set but not guarenteed and is best ignored for the time being.\r
+       We are probably relying on the rtp stack to generate the timestamp and ssrc for us at this point.\r
+       As a quick hack I am going to keep a sample counter and increment it by frame->samples but it would be \r
+       better if we could engage whatever it is in opal that makes it generate the timestamp.\r
+     */\r
+\r
+    rtp.SetPayloadType(mediaFormat.GetPayloadType());\r
+    rtp.SetPayloadSize(frame->datalen);\r
+\r
+    m_timeStamp += frame->samples;\r
+    rtp.SetTimestamp(m_timeStamp);\r
+    \r
+    //rtp.SetTimestamp(frame->timestamp);\r
+    //rtp.SetSyncSource(frame->ssrc);\r
+    //rtp.SetMarker(frame->m);\r
+\r
+    memcpy(rtp.GetPayloadPtr(), frame->data, frame->datalen);\r
+\r
+    if (GetPatch()->PushFrame(rtp)) {\r
+        return SWITCH_STATUS_SUCCESS;\r
     }\r
 \r
+\r
     return SWITCH_STATUS_FALSE;\r
 }\r
 \r
index 5b16bb3b8d2811373529dba3880c8862f8dc2b3e..d4a096c680e15a80682d06241bc1b55b65d6ba21 100644 (file)
@@ -216,6 +216,7 @@ class FSMediaStream:public OpalMediaStream {
     switch_frame_t m_readFrame;
     RTP_DataFrame m_readRTP;
     bool m_callOnStart;
+    uint32_t m_timeStamp;
 };