Exemplo n.º 1
0
/*
 * sip_config_local_supported_codecs_get()
 *
 * Get the locally supported codec list.
 */
uint16_t
sip_config_video_supported_codecs_get (rtp_ptype aSupportedCodecs[],
                          uint16_t supportedCodecsLen, boolean isOffer)
{
    uint16_t count = 0;
    int codec_mask;
    int hw_codec_mask = vcmGetVideoCodecList(VCM_DSP_FULLDUPLEX_HW);
    int gmp_codec_mask = vcmGetVideoCodecList(VCM_DSP_FULLDUPLEX_GMP);

    if ( isOffer ) {
        codec_mask = vcmGetVideoCodecList(VCM_DSP_FULLDUPLEX);
    } else {
        /* we are trying to match the answer then we
           already have the rx stream open */
        //codec_mask = vcmGetVideoCodecList(DSP_ENCODEONLY);
        codec_mask = vcmGetVideoCodecList(VCM_DSP_IGNORE);
    }
    // prefer HW codecs over SW
    count = sip_config_video_add_codecs(aSupportedCodecs,
                                        supportedCodecsLen, hw_codec_mask);
    // Now add any codecs that weren't in the initial list
    codec_mask &= ~hw_codec_mask;
    count += sip_config_video_add_codecs(&aSupportedCodecs[count],
                                         supportedCodecsLen, codec_mask);
    // Now add any GMP codecs that aren't already in
    gmp_codec_mask &= ~(hw_codec_mask | codec_mask);
    count += sip_config_video_add_codecs(&aSupportedCodecs[count],
                                         supportedCodecsLen, gmp_codec_mask);

    return count;
}
Exemplo n.º 2
0
/*
 * sip_config_local_supported_codecs_get()
 *
 * Get the locally supported codec list.
 */
uint16_t
sip_config_video_supported_codecs_get (rtp_ptype aSupportedCodecs[],
                          uint16_t supportedCodecsLen, boolean isOffer)
{
    uint16_t count = 0;
    rtp_ptype pref_codec;
    int codec_mask;
    int hw_codec_mask = vcmGetVideoCodecList(VCM_DSP_FULLDUPLEX_HW);
    int gmp_codec_mask = vcmGetVideoCodecList(VCM_DSP_FULLDUPLEX_GMP);

    if ( isOffer ) {
        codec_mask = vcmGetVideoCodecList(VCM_DSP_FULLDUPLEX);
    } else {
        /* we are trying to match the answer then we
           already have the rx stream open */
        //codec_mask = vcmGetVideoCodecList(DSP_ENCODEONLY);
        codec_mask = vcmGetVideoCodecList(VCM_DSP_IGNORE);
    }
    // prefer HW codecs over SW
    count = sip_config_video_add_codecs(aSupportedCodecs,
                                        supportedCodecsLen, hw_codec_mask);
    // Now add any codecs that weren't in the initial list
    codec_mask &= ~hw_codec_mask;
    count += sip_config_video_add_codecs(&aSupportedCodecs[count],
                                         supportedCodecsLen, codec_mask);
    // Now add any GMP codecs that aren't already in
    gmp_codec_mask &= ~(hw_codec_mask | codec_mask);
    count += sip_config_video_add_codecs(&aSupportedCodecs[count],
                                         supportedCodecsLen, gmp_codec_mask);

    // Now promote the preferred codec if any
    pref_codec = sip_config_preferred_codec();
    if (pref_codec != RTP_NONE) {
      int i,j;
      for (i = 1; i < count; i++) {
        if (aSupportedCodecs[i] == pref_codec) {
          // bump it to the front; bump all the rest down
          for (j = i; j > 0; j--) {
            aSupportedCodecs[j] = aSupportedCodecs[j-1];
          }
          aSupportedCodecs[0] = pref_codec;
          return count;
        }
      }
      // preferred not found, oh well
    }
    return count;
}