Changeset 199


Ignore:
Timestamp:
Feb 19, 2006 3:35:54 PM (18 years ago)
Author:
bennylp
Message:

Fixed packing error in rtp header, and sdp validation supports non numeric pt for broken uas

Location:
pjproject/trunk/pjmedia
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/include/pjmedia/rtp.h

    r188 r199  
    7171 
    7272 
     73 
     74/** 
     75 * RTP packet header. 
     76 */ 
    7377#pragma pack(1) 
    74  
    75 /** 
    76  * RTP packet header. 
    77  */ 
    7878struct pjmedia_rtp_hdr 
    7979{ 
    8080#if defined(PJ_IS_BIG_ENDIAN) && (PJ_IS_BIG_ENDIAN!=0) 
    81     int v:2;            /**< packet type/version            */ 
    82     int p:1;            /**< padding flag                   */ 
    83     int x:1;            /**< extension flag                 */ 
    84     int cc:4;           /**< CSRC count                     */ 
    85     int m:1;            /**< marker bit                     */ 
    86     int pt:7;           /**< payload type                   */ 
     81    pj_uint16_t v:2;            /**< packet type/version            */ 
     82    pj_uint16_t p:1;            /**< padding flag                   */ 
     83    pj_uint16_t x:1;            /**< extension flag                 */ 
     84    pj_uint16_t cc:4;           /**< CSRC count                     */ 
     85    pj_uint16_t m:1;            /**< marker bit                     */ 
     86    pj_uint16_t pt:7;           /**< payload type                   */ 
    8787#else 
    88     int cc:4;           /**< CSRC count                     */ 
    89     int x:1;            /**< header extension flag          */  
    90     int p:1;            /**< padding flag                   */ 
    91     int v:2;            /**< packet type/version            */ 
    92     int pt:7;           /**< payload type                   */ 
    93     int m:1;            /**< marker bit                     */ 
     88    pj_uint16_t cc:4;           /**< CSRC count                     */ 
     89    pj_uint16_t x:1;            /**< header extension flag          */  
     90    pj_uint16_t p:1;            /**< padding flag                   */ 
     91    pj_uint16_t v:2;            /**< packet type/version            */ 
     92    pj_uint16_t pt:7;           /**< payload type                   */ 
     93    pj_uint16_t m:1;            /**< marker bit                     */ 
    9494#endif 
    95     pj_uint16_t seq;    /**< sequence number                */ 
    96     pj_uint32_t ts;     /**< timestamp                      */ 
    97     pj_uint32_t ssrc;   /**< synchronization source         */ 
    98 }; 
    99  
     95    pj_uint16_t seq;            /**< sequence number                */ 
     96    pj_uint32_t ts;             /**< timestamp                      */ 
     97    pj_uint32_t ssrc;           /**< synchronization source         */ 
     98}; 
    10099#pragma pack() 
    101100 
  • pjproject/trunk/pjmedia/src/pjmedia/rtp.c

    r188 r199  
    4444    /* Check RTP header packing. */ 
    4545    if (sizeof(struct pjmedia_rtp_hdr) != 12) { 
     46        unsigned sz = sizeof(struct pjmedia_rtp_hdr); 
    4647        pj_assert(!"Wrong RTP header packing!"); 
    4748        return PJMEDIA_RTP_EINPACK; 
  • pjproject/trunk/pjmedia/src/pjmedia/sdp.c

    r188 r199  
    11491149        /* Verify payload type. */ 
    11501150        for (j=0; j<m->desc.fmt_count; ++j) { 
    1151             unsigned pt = pj_strtoul(&m->desc.fmt[j]); 
    1152  
    1153             /* Payload type is between 0 and 127. */ 
    1154             CHECK( pt <= 127, PJMEDIA_SDP_EINPT); 
    1155  
    1156             /* If port is not zero, then for each dynamic payload type, an 
    1157              * rtpmap attribute must be specified. 
     1151 
     1152            /* Arrgh noo!! Payload type can be non-numeric!! 
     1153             * RTC based programs sends "null" for instant messaging! 
    11581154             */ 
    1159             if (m->desc.port != 0 && pt >= 96) { 
    1160                 const pjmedia_sdp_attr *a; 
    1161  
    1162                 a = pjmedia_sdp_media_find_attr(m,&STR_RTPMAP,&m->desc.fmt[j]); 
    1163                 CHECK( a != NULL, PJMEDIA_SDP_EMISSINGRTPMAP); 
     1155            if (pj_isdigit(*m->desc.fmt[j].ptr)) { 
     1156                unsigned pt = pj_strtoul(&m->desc.fmt[j]); 
     1157 
     1158                /* Payload type is between 0 and 127.  
     1159                 */ 
     1160                CHECK( pt <= 127, PJMEDIA_SDP_EINPT); 
     1161 
     1162                /* If port is not zero, then for each dynamic payload type, an 
     1163                 * rtpmap attribute must be specified. 
     1164                 */ 
     1165                if (m->desc.port != 0 && pt >= 96) { 
     1166                    const pjmedia_sdp_attr *a; 
     1167 
     1168                    a = pjmedia_sdp_media_find_attr(m, &STR_RTPMAP,  
     1169                                                    &m->desc.fmt[j]); 
     1170                    CHECK( a != NULL, PJMEDIA_SDP_EMISSINGRTPMAP); 
     1171                } 
    11641172            } 
    11651173        } 
Note: See TracChangeset for help on using the changeset viewer.