]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 10 Apr 2006 18:28:46 +0000 (18:28 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 10 Apr 2006 18:28:46 +0000 (18:28 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1108 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_rtp.h
src/mod/endpoints/mod_dingaling/mod_dingaling.c
src/mod/endpoints/mod_exosip/mod_exosip.c
src/switch_rtp.c

index 4523105b10c1706b2b4723dbfe7786f04678807d..55bd3d78c3ea8f9c7067d4500ffb45678d1ba767 100644 (file)
@@ -202,22 +202,23 @@ SWITCH_DECLARE(void) switch_rtp_set_invald_handler(switch_rtp *rtp_session, swit
   \brief Read data from a given RTP session
   \param rtp_session the RTP session to read from
   \param data the data to read
-  \param datalen the length of the data
+  \param datalen a pointer to the datalen
   \param payload_type the IANA payload of the packet
   \param flags flags
   \return the number of bytes read
 */
-SWITCH_DECLARE(int) switch_rtp_read(switch_rtp *rtp_session, void *data, uint32_t datalen, int *payload_type, switch_frame_flag *flags);
+SWITCH_DECLARE(switch_status) switch_rtp_read(switch_rtp *rtp_session, void *data, uint32_t *datalen, int *payload_type, switch_frame_flag *flags);
 
 /*! 
   \brief Read data from a given RTP session without copying
   \param rtp_session the RTP session to read from
   \param data a pointer to point directly to the RTP read buffer
+  \param datalen a pointer to the datalen
   \param payload_type the IANA payload of the packet
   \param flags flags
   \return the number of bytes read
 */
-SWITCH_DECLARE(int) switch_rtp_zerocopy_read(switch_rtp *rtp_session, void **data, int *payload_type, switch_frame_flag *flags);
+SWITCH_DECLARE(switch_status) switch_rtp_zerocopy_read(switch_rtp *rtp_session, void **data, uint32_t *datalen, int *payload_type, switch_frame_flag *flags);
 
 /*! 
   \brief Write data to a given RTP session
index 201db84095a378019562c5eb6822d44578d836bb..26026f95f97f4326c8c779241ad7ca603bc00313 100644 (file)
@@ -573,8 +573,15 @@ static switch_status channel_read_frame(switch_core_session *session, switch_fra
        while (!switch_test_flag(tech_pvt, TFLAG_BYE) && switch_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->read_frame.datalen == 0) {
                payload = -1;
                tech_pvt->read_frame.flags = 0;
-               tech_pvt->read_frame.datalen = switch_rtp_zerocopy_read(tech_pvt->rtp_session, &tech_pvt->read_frame.data, &payload, &tech_pvt->read_frame.flags);
-               
+
+               if (switch_rtp_zerocopy_read(tech_pvt->rtp_session,
+                                                                        &tech_pvt->read_frame.data,
+                                                                        &tech_pvt->read_frame.datalen,
+                                                                        &payload,
+                                                                        &tech_pvt->read_frame.flags) != SWITCH_STATUS_SUCCESS) {
+                       
+                       return SWITCH_STATUS_FALSE;
+               }               
 
                /* RFC2833 ... TBD try harder to honor the duration etc.*/
                if (payload == 101) {
index fc32fc0a4a90571101cd93f46b079d683a7592cd..773bef17be7adc8a7db8f65dfbaa906333ea783d 100644 (file)
@@ -584,9 +584,12 @@ static switch_status exosip_read_frame(switch_core_session *session, switch_fram
                           && tech_pvt->read_frame.datalen == 0) {
                        now = switch_time_now();
                        tech_pvt->read_frame.flags = 0;
-                       tech_pvt->read_frame.datalen = switch_rtp_zerocopy_read(tech_pvt->rtp_session, &tech_pvt->read_frame.data, &payload, &tech_pvt->read_frame.flags);
-
-                       if (tech_pvt->read_frame.datalen < 0) {
+                       if (switch_rtp_zerocopy_read(tech_pvt->rtp_session,
+                                                                                &tech_pvt->read_frame.data,
+                                                                                &tech_pvt->read_frame.datalen,
+                                                                                &payload,
+                                                                                &tech_pvt->read_frame.flags) != SWITCH_STATUS_SUCCESS) {
+                               
                                return SWITCH_STATUS_FALSE;
                        }
 
index 26b80cb0c682753556e47e75bae40535aecb0d43..857772234977df4262cb406945d5d4189f225353 100644 (file)
@@ -534,29 +534,36 @@ static int rtp_common_read(switch_rtp *rtp_session, void *data, int *payload_typ
        return (int)(bytes - rtp_header_len);
 }
 
-SWITCH_DECLARE(int) switch_rtp_read(switch_rtp *rtp_session, void *data, uint32_t datalen, int *payload_type, switch_frame_flag *flags)
+SWITCH_DECLARE(switch_status) switch_rtp_read(switch_rtp *rtp_session, void *data, uint32_t *datalen, int *payload_type, switch_frame_flag *flags)
 {
 
        int bytes = rtp_common_read(rtp_session, data, payload_type, flags);
        
        if (bytes <= 0) {
-               return bytes;
+               *datalen = 0;
+               return SWITCH_STATUS_GENERR;
        }
+
+       *datalen = bytes;
+
        memcpy(data, rtp_session->recv_msg.body, bytes);
-       return bytes;
+
+       return SWITCH_STATUS_SUCCESS;   
 }
 
-SWITCH_DECLARE(int) switch_rtp_zerocopy_read(switch_rtp *rtp_session, void **data, int *payload_type, switch_frame_flag *flags)
+SWITCH_DECLARE(switch_status) switch_rtp_zerocopy_read(switch_rtp *rtp_session, void **data, uint32_t *datalen, int *payload_type, switch_frame_flag *flags)
 {
 
        int bytes = rtp_common_read(rtp_session, data, payload_type, flags);
        *data = rtp_session->recv_msg.body;
 
        if (bytes <= 0) {
-               return bytes;
+               *datalen = 0;
+               return SWITCH_STATUS_GENERR;
        }
 
-       return bytes;
+       *datalen = bytes;
+       return SWITCH_STATUS_SUCCESS;
 }
 
 static int rtp_common_write(switch_rtp *rtp_session, void *data, uint32_t datalen, uint8_t payload)