Changeset 3160


Ignore:
Timestamp:
May 7, 2010 7:09:16 AM (14 years ago)
Author:
nanang
Message:

Fixed #1066:

  • Added check if the negotiation result of local-offer/remote-answer has no matching format.
  • Added routine to remove any unmatching formats in the remote-answer.
File:
1 edited

Legend:

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

    r2926 r3160  
    912912        } 
    913913 
     914        if (0 == offer->desc.fmt_count) { 
     915            /* No common codec in the answer! */ 
     916            return PJMEDIA_SDPNEG_EANSNOMEDIA; 
     917        } 
     918 
    914919        /* Arrange format in the offer so the order match the priority 
    915920         * in the answer 
     
    924929                    break; 
    925930                } 
     931            } 
     932 
     933            /* If this answer format has no matching format, let's remove it 
     934             * from the answer. 
     935             */ 
     936            if (j >= offer->desc.fmt_count) { 
     937                pjmedia_sdp_attr *a; 
     938 
     939                /* Remove rtpmap associated with this format */ 
     940                a = pjmedia_sdp_media_find_attr2(answer, "rtpmap", fmt); 
     941                if (a) 
     942                    pjmedia_sdp_media_remove_attr(answer, a); 
     943 
     944                /* Remove fmtp associated with this format */ 
     945                a = pjmedia_sdp_media_find_attr2(answer, "fmtp", fmt); 
     946                if (a) 
     947                    pjmedia_sdp_media_remove_attr(answer, a); 
     948 
     949                /* Remove this format from answer's array */ 
     950                pj_array_erase(answer->desc.fmt, sizeof(answer->desc.fmt[0]), 
     951                               answer->desc.fmt_count, i); 
     952                --answer->desc.fmt_count; 
    926953            } 
    927954        } 
Note: See TracChangeset for help on using the changeset viewer.