Ignore:
Timestamp:
Apr 6, 2011 1:55:01 PM (11 years ago)
Author:
nanang
Message:

Re #1186:

  • Added custom negotiation callback mechanism in SDP negotiator, mainly for specific formats that require SDP fmtp negotiation.
  • Modified video codec ID string to use encoding name+payload type (was encoding name+clock rate), also added encoding description in video codec info, so duplicated codecs (e.g: multiple H264 configurations) can be differentiated.
  • Few enhancements for H264 in ffmpeg wrapper (e.g: added proper profile-id & packetization-mode setup).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia/sdp_neg.h

    r3217 r3500  
    664664 
    665665 
     666/** 
     667 * Enumeration of customized SDP format matching option flags. See 
     668 * #pjmedia_sdp_neg_register_fmt_match_cb() for more info. 
     669 */ 
     670typedef enum pjmedia_sdp_neg_fmt_match_flag 
     671{ 
     672    /** 
     673     * In generating answer, the SDP fmtp in the answer candidate may need 
     674     * to be modified by the customized SDP format matching callback to 
     675     * achieve flexible SDP negotiation, e.g: AMR fmtp 'octet-align' field 
     676     * can be adjusted with the offer when the codec implementation support 
     677     * both packetization modes octet-aligned and bandwidth-efficient. 
     678     */ 
     679    PJMEDIA_SDP_NEG_FMT_MATCH_ALLOW_MODIFY_ANSWER = 1, 
     680 
     681} pjmedia_sdp_neg_fmt_match_flag; 
     682 
     683 
     684/** 
     685 * The declaration of customized SDP format matching callback. See 
     686 * #pjmedia_sdp_neg_register_fmt_match_cb() for more info. 
     687 * 
     688 * @param pool          The memory pool. 
     689 * @param offer         The SDP media offer. 
     690 * @param o_fmt_idx     Index of the format in the SDP media offer. 
     691 * @param answer        The SDP media answer. 
     692 * @param a_fmt_idx     Index of the format in the SDP media answer. 
     693 * @param option        The format matching option, see 
     694 *                      #pjmedia_sdp_neg_fmt_match_flag. 
     695 * 
     696 * @return              PJ_SUCCESS when the formats in offer and answer match. 
     697 */ 
     698typedef pj_status_t (*pjmedia_sdp_neg_fmt_match_cb)(pj_pool_t *pool, 
     699                                                    pjmedia_sdp_media *offer, 
     700                                                    unsigned o_fmt_idx, 
     701                                                    pjmedia_sdp_media *answer, 
     702                                                    unsigned a_fmt_idx, 
     703                                                    unsigned option); 
     704 
     705 
     706/** 
     707 * Register customized SDP format matching callback function for the specified 
     708 * format. The customized SDP format matching is needed when the format 
     709 * identification in a media stream session cannot be simply determined by 
     710 * encoding name and clock rate, but also involves one or more format specific 
     711 * parameters, which are specified in SDP fmtp attribute. For example, 
     712 * an H.264 video stream is also identified by profile, level, and 
     713 * packetization-mode parameters. As those parameters are format specifics, 
     714 * the negotiation must be done by the format or codec implementation. 
     715 * 
     716 * To unregister the callback of specific format, just call this function with 
     717 * parameter #cb set to NULL. 
     718 * 
     719 * @param fmt_name      The format name, e.g: "H.264", "AMR", "G7221". Note 
     720 *                      that the string buffer must remain valid until the 
     721 *                      callback is unregistered. 
     722 * @param cb            The customized SDP format negotiation callback or 
     723 *                      NULL to unregister the specified format callback. 
     724 * 
     725 * @return              PJ_SUCCESS on success. 
     726 */ 
     727PJ_DECL(pj_status_t) pjmedia_sdp_neg_register_fmt_match_cb( 
     728                                        const pj_str_t *fmt_name, 
     729                                        pjmedia_sdp_neg_fmt_match_cb cb); 
     730 
     731 
     732/** 
     733 * Match format in the SDP media offer and answer. The matching mechanism 
     734 * will be done by comparing the encoding name and clock rate, and if the 
     735 * custom format matching callback for the specified format is registered, 
     736 * see #pjmedia_sdp_neg_register_fmt_match_cb(), it will be called for more 
     737 * detail verification, e.g: format parameters specified in SDP fmtp. 
     738 * 
     739 * @param pool          The memory pool. 
     740 * @param offer         The SDP media offer. 
     741 * @param o_fmt_idx     Index of the format in the SDP media offer. 
     742 * @param answer        The SDP media answer. 
     743 * @param a_fmt_idx     Index of the format in the SDP media answer. 
     744 * @param option        The format matching option, see 
     745 *                      #pjmedia_sdp_neg_fmt_match_flag. 
     746 * 
     747 * @return              PJ_SUCCESS when the formats in offer and answer match. 
     748 */ 
     749PJ_DECL(pj_status_t) pjmedia_sdp_neg_fmt_match( pj_pool_t *pool, 
     750                                                pjmedia_sdp_media *offer, 
     751                                                unsigned o_fmt_idx, 
     752                                                pjmedia_sdp_media *answer, 
     753                                                unsigned a_fmt_idx, 
     754                                                unsigned option); 
    666755 
    667756 
Note: See TracChangeset for help on using the changeset viewer.