diff options
author | Benny Prijono <bennylp@teluu.com> | 2014-02-19 04:11:43 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2014-02-19 04:11:43 +0000 |
commit | 7c7dd8a6151a607ac7fda3da0a657fddd07be8d1 (patch) | |
tree | 96398ce995f9af19d04c35c6f85cf3efaf8d1b19 /pjsip/src/pjsua-lib/pjsua_media.c | |
parent | f9317b810877c3cab6bda8ea07dc94eb3ecb7c20 (diff) |
Fixed #1738: Infinite loop when re-INVITE is received while adding new media
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4750 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsua-lib/pjsua_media.c')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_media.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c index ab4c4bde..4beb821c 100644 --- a/pjsip/src/pjsua-lib/pjsua_media.c +++ b/pjsip/src/pjsua-lib/pjsua_media.c @@ -1304,6 +1304,20 @@ on_return: return status; } +/* Determine if call's media is being changed, for example when video is being + * added. Then we can reject incoming re-INVITE, for example. This is the + * solution for https://trac.pjsip.org/repos/ticket/1738 + */ +pj_bool_t pjsua_call_media_is_changing(pjsua_call *call) +{ + /* The problem in #1738 occurs because we do handle_events() loop while + * adding media, which could cause incoming re-INVITE to be processed and + * cause havoc. Since the handle_events() loop only happens while adding + * media, it is sufficient to only check if "prov > cnt" for now. + */ + return call->med_prov_cnt > call->med_cnt; +} + /* Initialize the media line */ pj_status_t pjsua_call_media_init(pjsua_call_media *call_med, pjmedia_type type, |