diff options
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, " |