]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add payload accessor functions to rtp
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 6 Apr 2006 21:08:30 +0000 (21:08 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 6 Apr 2006 21:08:30 +0000 (21:08 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1071 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_rtp.h
src/switch_rtp.c

index 755559b1a79510f41fbcf981dbaf88929a8e3b02..9c083633c9ec020590356b2c2d068f33b79ef075 100644 (file)
@@ -151,6 +151,21 @@ SWITCH_DECLARE(switch_status) switch_rtp_activate_ice(switch_rtp *rtp_session, c
 */
 SWITCH_DECLARE(switch_socket_t *)switch_rtp_get_rtp_socket(switch_rtp *rtp_session);
 
+/*! 
+  \brief Set the default payload number for a given RTP session
+  \param rtp_session the RTP session to set the payload number on
+  \param payload the new default payload number 
+*/
+SWITCH_DECLARE(void) switch_rtp_set_default_payload(switch_rtp *rtp_session, uint32_t payload);
+
+/*! 
+  \brief Get the default payload number for a given RTP session
+  \param rtp_session the RTP session to get the payload number from
+  \return the default payload of the RTP session
+*/
+SWITCH_DECLARE(uint32_t) switch_rtp_get_default_payload(switch_rtp *rtp_session);
+
+
 /*! 
   \brief Set a callback function to execute when an invalid RTP packet is encountered
   \param rtp_session the RTP session
index 72796476fb1c4b27835ca7e034d67621ed4ea508..4bddcb81b5c73d6d916fcc84e084e98c5356fc50 100644 (file)
@@ -372,6 +372,16 @@ SWITCH_DECLARE(switch_socket_t *)switch_rtp_get_rtp_socket(switch_rtp *rtp_sessi
        return rtp_session->sock;
 }
 
+SWITCH_DECLARE(void) switch_rtp_set_default_payload(switch_rtp *rtp_session, uint32_t payload)
+{
+       rtp_session->payload = payload;
+}
+
+SWITCH_DECLARE(uint32_t) switch_rtp_get_default_payload(switch_rtp *rtp_session)
+{
+       return rtp_session->payload;
+}
+
 SWITCH_DECLARE(void) switch_rtp_set_invald_handler(switch_rtp *rtp_session, switch_rtp_invalid_handler on_invalid)
 {
        rtp_session->invalid_handler = on_invalid;
@@ -453,7 +463,7 @@ SWITCH_DECLARE(int) switch_rtp_write(switch_rtp *rtp_session, void *data, int da
 {
        switch_size_t bytes;
 
-       if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO)) {
+       if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO) || !rtp_session->remote_addr) {
                return -1;
        }
 
@@ -481,7 +491,7 @@ SWITCH_DECLARE(int) switch_rtp_write_payload(switch_rtp *rtp_session, void *data
 {
        switch_size_t bytes;
 
-       if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO)) {
+       if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO) || !rtp_session->remote_addr) {
                return -1;
        }
        rtp_session->ts += ts;