Ignore:
Timestamp:
Jun 4, 2010 1:41:34 PM (14 years ago)
Author:
nanang
Message:

Re #668:

  • Fixed process_answer() of SDP negotiation, when no common format in a media, instead of returning error, it should just deactivate the media (offer & answer) and continue negotiating next media.
  • Generalized the way of deactivating media: set port to 0 and remove all attributes.
  • Added new API pjmedia_sdp_media_clone_deactivate() to clone media and deactivate the newly cloned media.
  • Updated PJMEDIA SDP negotiation test.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/sdp.c

    r3140 r3198  
    14311431                                                 pjmedia_sdp_media *m) 
    14321432{ 
    1433     pjmedia_sdp_attr *attr; 
    1434     static const pj_str_t ID_INACTIVE = { "inactive", 8 }; 
    1435  
    1436     if (m->attr_count >= PJMEDIA_MAX_SDP_ATTR) 
    1437         return PJ_ETOOMANY; 
    1438  
    1439     attr = pjmedia_sdp_attr_create(pool, ID_INACTIVE.ptr, NULL); 
    1440     if (NULL == attr) 
    1441         return PJ_ENOMEM; 
    1442  
    1443     pjmedia_sdp_media_add_attr(m, attr); 
     1433    PJ_ASSERT_RETURN(m, PJ_EINVAL); 
     1434    PJ_UNUSED_ARG(pool); 
     1435 
     1436    /* Set port to zero */ 
    14441437    m->desc.port = 0; 
    14451438 
     1439    /* And remove attributes */ 
     1440    m->attr_count = 0; 
     1441 
    14461442    return PJ_SUCCESS; 
    14471443} 
     1444 
     1445 
     1446PJ_DEF(pjmedia_sdp_media*) pjmedia_sdp_media_clone_deactivate( 
     1447                                                pj_pool_t *pool, 
     1448                                                const pjmedia_sdp_media *rhs) 
     1449{ 
     1450    unsigned int i; 
     1451    pjmedia_sdp_media *m; 
     1452 
     1453    PJ_ASSERT_RETURN(pool && rhs, NULL); 
     1454 
     1455    m = PJ_POOL_ZALLOC_T(pool, pjmedia_sdp_media); 
     1456    pj_memcpy(m, rhs, sizeof(*m)); 
     1457 
     1458    /* Clone the media line only */ 
     1459    pj_strdup (pool, &m->desc.media, &rhs->desc.media); 
     1460    pj_strdup (pool, &m->desc.transport, &rhs->desc.transport); 
     1461    for (i=0; i<rhs->desc.fmt_count; ++i) 
     1462        pj_strdup(pool, &m->desc.fmt[i], &rhs->desc.fmt[i]); 
     1463 
     1464    if (rhs->conn) { 
     1465        m->conn = pjmedia_sdp_conn_clone (pool, rhs->conn); 
     1466        PJ_ASSERT_RETURN(m->conn != NULL, NULL); 
     1467    } 
     1468 
     1469    /* And deactivate it */ 
     1470    pjmedia_sdp_media_deactivate(pool, m); 
     1471 
     1472    return m; 
     1473} 
Note: See TracChangeset for help on using the changeset viewer.