diff options
author | Benny Prijono <bennylp@teluu.com> | 2010-12-06 04:25:44 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2010-12-06 04:25:44 +0000 |
commit | f0bd29e213d567051ca2cef2fca10739c59d1626 (patch) | |
tree | 990179db7e09c9247af75056c7cf62d076e41744 /pjmedia | |
parent | 08e7af79c559ba18fc5db4dbadb5c9fab210db3b (diff) |
Fixed #1160: Option to bypass RTP payload type verification in the stream (thanks Johan Lantz for the suggestion)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3387 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r-- | pjmedia/include/pjmedia/config.h | 11 | ||||
-rw-r--r-- | pjmedia/src/pjmedia/stream.c | 12 |
2 files changed, 21 insertions, 2 deletions
diff --git a/pjmedia/include/pjmedia/config.h b/pjmedia/include/pjmedia/config.h index 0f98633a..4d4f7ed7 100644 --- a/pjmedia/include/pjmedia/config.h +++ b/pjmedia/include/pjmedia/config.h @@ -502,6 +502,17 @@ # define PJMEDIA_STREAM_VAD_SUSPEND_MSEC 600 #endif +/** + * Perform RTP payload type checking in the stream. Normally the peer + * MUST send RTP with payload type as we specified in our SDP. Certain + * agents may not be able to follow this hence the only way to have + * communication is to disable this check. + * + * Default: 1 + */ +#ifndef PJMEDIA_STREAM_CHECK_RTP_PT +# define PJMEDIA_STREAM_CHECK_RTP_PT 1 +#endif /** * Specify the maximum duration of silence period in the codec, in msec. diff --git a/pjmedia/src/pjmedia/stream.c b/pjmedia/src/pjmedia/stream.c index 8bb5fc1a..7a62dbea 100644 --- a/pjmedia/src/pjmedia/stream.c +++ b/pjmedia/src/pjmedia/stream.c @@ -1573,6 +1573,7 @@ static void on_rx_rtp( void *data, const void *payload; unsigned payloadlen; pjmedia_rtp_status seq_st; + pj_bool_t check_pt; pj_status_t status; pj_bool_t pkt_discarded = PJ_FALSE; @@ -1602,8 +1603,15 @@ static void on_rx_rtp( void *data, /* Update RTP session (also checks if RTP session can accept * the incoming packet. */ - pjmedia_rtp_session_update2(&channel->rtp, hdr, &seq_st, - hdr->pt != stream->rx_event_pt); + check_pt = (hdr->pt != stream->rx_event_pt) && PJMEDIA_STREAM_CHECK_RTP_PT; + pjmedia_rtp_session_update2(&channel->rtp, hdr, &seq_st, check_pt); +#if !PJMEDIA_STREAM_CHECK_RTP_PT + if (!check_pt && hdr->pt != channel->rtp.out_pt && + hdr->pt != stream->rx_event_pt) + { + seq_st.status.flag.badpt = 1; + } +#endif if (seq_st.status.value) { TRC_ ((stream->port.info.name.ptr, "RTP status: badpt=%d, badssrc=%d, dup=%d, " |