summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-02-19 15:35:54 +0000
committerBenny Prijono <bennylp@teluu.com>2006-02-19 15:35:54 +0000
commit6c7aa13a6fe2a5a69ddb208f0752ccae828e9694 (patch)
tree64f88ebeb8dfb9d63f1f78697c0a42974aa1b725
parentf5ca7cbda0e310413076dd3323a66da803e2b32c (diff)
Fixed packing error in rtp header, and sdp validation supports non numeric pt for broken uas
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@199 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjmedia/include/pjmedia/rtp.h33
-rw-r--r--pjmedia/src/pjmedia/rtp.c1
-rw-r--r--pjmedia/src/pjmedia/sdp.c30
3 files changed, 36 insertions, 28 deletions
diff --git a/pjmedia/include/pjmedia/rtp.h b/pjmedia/include/pjmedia/rtp.h
index d58c7736..409ad0aa 100644
--- a/pjmedia/include/pjmedia/rtp.h
+++ b/pjmedia/include/pjmedia/rtp.h
@@ -70,33 +70,32 @@ PJ_BEGIN_DECL
*/
-#pragma pack(1)
/**
* RTP packet header.
*/
+#pragma pack(1)
struct pjmedia_rtp_hdr
{
#if defined(PJ_IS_BIG_ENDIAN) && (PJ_IS_BIG_ENDIAN!=0)
- int v:2; /**< packet type/version */
- int p:1; /**< padding flag */
- int x:1; /**< extension flag */
- int cc:4; /**< CSRC count */
- int m:1; /**< marker bit */
- int pt:7; /**< payload type */
+ pj_uint16_t v:2; /**< packet type/version */
+ pj_uint16_t p:1; /**< padding flag */
+ pj_uint16_t x:1; /**< extension flag */
+ pj_uint16_t cc:4; /**< CSRC count */
+ pj_uint16_t m:1; /**< marker bit */
+ pj_uint16_t pt:7; /**< payload type */
#else
- int cc:4; /**< CSRC count */
- int x:1; /**< header extension flag */
- int p:1; /**< padding flag */
- int v:2; /**< packet type/version */
- int pt:7; /**< payload type */
- int m:1; /**< marker bit */
+ pj_uint16_t cc:4; /**< CSRC count */
+ pj_uint16_t x:1; /**< header extension flag */
+ pj_uint16_t p:1; /**< padding flag */
+ pj_uint16_t v:2; /**< packet type/version */
+ pj_uint16_t pt:7; /**< payload type */
+ pj_uint16_t m:1; /**< marker bit */
#endif
- pj_uint16_t seq; /**< sequence number */
- pj_uint32_t ts; /**< timestamp */
- pj_uint32_t ssrc; /**< synchronization source */
+ pj_uint16_t seq; /**< sequence number */
+ pj_uint32_t ts; /**< timestamp */
+ pj_uint32_t ssrc; /**< synchronization source */
};
-
#pragma pack()
/**
diff --git a/pjmedia/src/pjmedia/rtp.c b/pjmedia/src/pjmedia/rtp.c
index 9fa31232..1901aec0 100644
--- a/pjmedia/src/pjmedia/rtp.c
+++ b/pjmedia/src/pjmedia/rtp.c
@@ -43,6 +43,7 @@ PJ_DEF(pj_status_t) pjmedia_rtp_session_init( pjmedia_rtp_session *ses,
/* Check RTP header packing. */
if (sizeof(struct pjmedia_rtp_hdr) != 12) {
+ unsigned sz = sizeof(struct pjmedia_rtp_hdr);
pj_assert(!"Wrong RTP header packing!");
return PJMEDIA_RTP_EINPACK;
}
diff --git a/pjmedia/src/pjmedia/sdp.c b/pjmedia/src/pjmedia/sdp.c
index f46be1e3..79f6cd98 100644
--- a/pjmedia/src/pjmedia/sdp.c
+++ b/pjmedia/src/pjmedia/sdp.c
@@ -1148,19 +1148,27 @@ PJ_DEF(pj_status_t) pjmedia_sdp_validate(const pjmedia_sdp_session *sdp)
/* Verify payload type. */
for (j=0; j<m->desc.fmt_count; ++j) {
- unsigned pt = pj_strtoul(&m->desc.fmt[j]);
- /* Payload type is between 0 and 127. */
- CHECK( pt <= 127, PJMEDIA_SDP_EINPT);
-
- /* If port is not zero, then for each dynamic payload type, an
- * rtpmap attribute must be specified.
+ /* Arrgh noo!! Payload type can be non-numeric!!
+ * RTC based programs sends "null" for instant messaging!
*/
- if (m->desc.port != 0 && pt >= 96) {
- const pjmedia_sdp_attr *a;
-
- a = pjmedia_sdp_media_find_attr(m,&STR_RTPMAP,&m->desc.fmt[j]);
- CHECK( a != NULL, PJMEDIA_SDP_EMISSINGRTPMAP);
+ if (pj_isdigit(*m->desc.fmt[j].ptr)) {
+ unsigned pt = pj_strtoul(&m->desc.fmt[j]);
+
+ /* Payload type is between 0 and 127.
+ */
+ CHECK( pt <= 127, PJMEDIA_SDP_EINPT);
+
+ /* If port is not zero, then for each dynamic payload type, an
+ * rtpmap attribute must be specified.
+ */
+ if (m->desc.port != 0 && pt >= 96) {
+ const pjmedia_sdp_attr *a;
+
+ a = pjmedia_sdp_media_find_attr(m, &STR_RTPMAP,
+ &m->desc.fmt[j]);
+ CHECK( a != NULL, PJMEDIA_SDP_EMISSINGRTPMAP);
+ }
}
}
}