Changeset 5619 for pjproject


Ignore:
Timestamp:
Jul 5, 2017 3:57:53 AM (7 years ago)
Author:
riza
Message:

Fix #2026: Add option to for the SDP version to not increment when there's no
change from previous answer/offer.

Location:
pjproject/trunk/pjmedia
Files:
3 edited

Legend:

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

    r5597 r5619  
    744744 
    745745/** 
     746 * This specifies if the SDP negotiator should compare its content before  
     747 * incrementing the origin version on the subsequent offer/answer.  
     748 * If this is set to 1, origin version will only by incremented if the  
     749 * new offer/answer is different than the previous one. For backward  
     750 * compatibility and performance this is set to 0. 
     751 * 
     752 * Default is 0 (No) 
     753 */ 
     754#ifndef PJMEDIA_SDP_NEG_COMPARE_BEFORE_INC_VERSION 
     755#   define PJMEDIA_SDP_NEG_COMPARE_BEFORE_INC_VERSION   0 
     756#endif 
     757 
     758 
     759/** 
    746760 * Support for sending and decoding RTCP port in SDP (RFC 3605). 
    747761 * Default is equal to PJMEDIA_ADVERTISE_RTCP setting. 
  • pjproject/trunk/pjmedia/src/pjmedia/sdp_neg.c

    r5170 r5619  
    335335    pj_strdup(pool, &new_offer->origin.user, &old_offer->origin.user); 
    336336    new_offer->origin.id = old_offer->origin.id; 
    337     new_offer->origin.version = old_offer->origin.version + 1; 
     337 
    338338    pj_strdup(pool, &new_offer->origin.net_type, &old_offer->origin.net_type); 
    339339    pj_strdup(pool, &new_offer->origin.addr_type,&old_offer->origin.addr_type); 
     
    400400 
    401401    /* New_offer fixed */ 
     402#if PJMEDIA_SDP_NEG_COMPARE_BEFORE_INC_VERSION 
     403    new_offer->origin.version = old_offer->origin.version; 
     404 
     405    if (pjmedia_sdp_session_cmp(new_offer, neg->initial_sdp, 0) != PJ_SUCCESS) 
     406    { 
     407        ++new_offer->origin.version; 
     408    }     
     409#else 
     410    new_offer->origin.version = old_offer->origin.version + 1; 
     411#endif 
     412     
    402413    neg->initial_sdp_tmp = neg->initial_sdp; 
    403414    neg->initial_sdp = new_offer; 
     
    14751486                active_ver = neg->initial_sdp->origin.version; 
    14761487 
     1488#if PJMEDIA_SDP_NEG_COMPARE_BEFORE_INC_VERSION 
     1489            answer->origin.version = active_ver; 
     1490 
     1491            if ((neg->active_local_sdp == NULL) ||  
     1492                (pjmedia_sdp_session_cmp(answer, neg->active_local_sdp, 0)  
     1493                                                                != PJ_SUCCESS)) 
     1494            { 
     1495                ++answer->origin.version; 
     1496            } 
     1497#else 
     1498            answer->origin.version = active_ver + 1; 
     1499#endif       
    14771500            /* Only update active SDPs when negotiation is successfull */ 
    14781501            neg->active_local_sdp = answer; 
    14791502            neg->active_remote_sdp = neg->neg_remote_sdp; 
    1480  
    1481             /* Increment SDP version */ 
    1482             neg->active_local_sdp->origin.version = ++active_ver; 
    14831503        } 
    14841504    } 
  • pjproject/trunk/pjmedia/src/test/sdp_neg_test.c

    r3553 r5619  
    662662            /* This is how Bob's answer should look like: */ 
    663663            "v=0\r\n" 
     664#if PJMEDIA_SDP_NEG_COMPARE_BEFORE_INC_VERSION 
     665            "o=bob 2808844564 2808844564 IN IP4 host.biloxi.example.com\r\n" 
     666#else 
    664667            "o=bob 2808844564 2808844565 IN IP4 host.biloxi.example.com\r\n" 
     668#endif 
    665669            "s=bob\r\n" 
    666670            "c=IN IP4 host.biloxi.example.com\r\n" 
Note: See TracChangeset for help on using the changeset viewer.