Example #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;
}
Example #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;
}
Example #3
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;
    cc_uint32_t major_ver, minor_ver;

    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);
    }
    if ( codec_mask & VCM_CODEC_RESOURCE_H264) {
      /*
       * include payload type for packetization mode 1 only if ucm sis version
       * is equal to or greater than 5.1.0 (AngelFire).
       */
      platGetSISProtocolVer(&major_ver, &minor_ver, NULL, NULL);
      if ((major_ver > SIS_PROTOCOL_MAJOR_VERSION_ANGELFIRE) ||
          (major_ver == SIS_PROTOCOL_MAJOR_VERSION_ANGELFIRE &&
           minor_ver >= SIS_PROTOCOL_MINOR_VERSION_ANGELFIRE)) {
          if (vcmGetVideoMaxSupportedPacketizationMode() == 1) {
            aSupportedCodecs[count] = RTP_H264_P1;
            count++;
          }
      }
      aSupportedCodecs[count] = RTP_H264_P0;
      count++;
    }
    if ( codec_mask & VCM_CODEC_RESOURCE_VP8) {
      aSupportedCodecs[count] = RTP_VP8;
      count++;
    }
    if ( codec_mask & VCM_CODEC_RESOURCE_H263) {
      aSupportedCodecs[count] = RTP_H263;
      count++;
    }

    return count;
}
Example #4
0
static int
thread_init ()
{
    gStopTickTask = FALSE;
    /*
     * This will have already been called for CPR CNU code,
     * but may be called here for Windows emulation.
     */
    (void) cprPreInit();


    PHNChangeState(STATE_FILE_CFG);

    /* initialize message queues */
    sip_msgq = cprCreateMessageQueue("SIPQ", SIPQSZ);
    gsm_msgq = cprCreateMessageQueue("GSMQ", GSMQSZ);

    if (FALSE == gHardCodeSDPMode) {
        misc_app_msgq = cprCreateMessageQueue("MISCAPPQ", DEFQSZ);
    }
    ccapp_msgq = cprCreateMessageQueue("CCAPPQ", DEFQSZ);
#ifdef JINDO_DEBUG_SUPPORTED
    debug_msgq = cprCreateMessageQueue("DEBUGAPPQ", DEFQSZ);
#endif
#ifdef EXTERNAL_TICK_REQUIRED
    ticker_msgq = cprCreateMessageQueue("Ticker", DEFQSZ);
#endif


    /*
     * Initialize the command parser and debug infrastructure
     */
    debugInit();

    /* create threads */
    ccapp_thread = cprCreateThread("CCAPP Task",
                                 (cprThreadStartRoutine) CCApp_task,
                                 GSMSTKSZ, CCPROVIDER_THREAD_RELATIVE_PRIORITY /* pri */, ccapp_msgq);
    if (ccapp_thread == NULL) {
        err_msg("failed to create CCAPP task \n");
    }

#ifdef JINDO_DEBUG_SUPPORTED
#ifndef VENDOR_BUILD
    debug_thread = cprCreateThread("Debug Task",
                                   (cprThreadStartRoutine) debug_task, STKSZ,
                                   0 /*pri */ , debug_msgq);

    if (debug_thread == NULL) {
        err_msg("failed to create debug task\n");
    }
#endif
#endif
	
    /* SIP main thread */
    sip_thread = cprCreateThread("SIPStack task",
                                 (cprThreadStartRoutine) sip_platform_task_loop,
                                 STKSZ, SIP_THREAD_RELATIVE_PRIORITY /* pri */, sip_msgq);
    if (sip_thread == NULL) {
        err_msg("failed to create sip task \n");
    }

#ifdef NO_SOCKET_POLLING
    /* SIP message wait queue task */
    sip_msgqwait_thread = cprCreateThread("SIP MsgQueueWait task",
                                          (cprThreadStartRoutine)
                                          sip_platform_task_msgqwait,
                                          STKSZ, SIP_THREAD_RELATIVE_PRIORITY /* pri */, sip_msgq);
    if (sip_msgqwait_thread == NULL) {
        err_msg("failed to create sip message queue wait task\n");
    }
#endif

    gsm_thread = cprCreateThread("GSM Task",
                                 (cprThreadStartRoutine) GSMTask,
                                 GSMSTKSZ, GSM_THREAD_RELATIVE_PRIORITY /* pri */, gsm_msgq);
    if (gsm_thread == NULL) {
        err_msg("failed to create gsm task \n");
    }

    if (FALSE == gHardCodeSDPMode) {
    	misc_app_thread = cprCreateThread("MiscApp Task",
    			(cprThreadStartRoutine) MiscAppTask,
    			STKSZ, 0 /* pri */, misc_app_msgq);
    	if (misc_app_thread == NULL) {
    		err_msg("failed to create MiscApp task \n");
    	}
    }

#ifdef EXTERNAL_TICK_REQUIRED
    ticker_thread = cprCreateThread("Ticker task",
                                    (cprThreadStartRoutine) TickerTask,
                                    STKSZ, 0, ticker_msgq);
    if (ticker_thread == NULL) {
        err_msg("failed to create ticker task \n");
    }
#endif

    /* Associate the threads with the message queues */
    (void) cprSetMessageQueueThread(sip_msgq, sip_thread);  
    (void) cprSetMessageQueueThread(gsm_msgq, gsm_thread);

    if (FALSE == gHardCodeSDPMode) {
    	(void) cprSetMessageQueueThread(misc_app_msgq, misc_app_thread);
    }

    (void) cprSetMessageQueueThread(ccapp_msgq, ccapp_thread);
#ifdef JINDO_DEBUG_SUPPORTED
    (void) cprSetMessageQueueThread(debug_msgq, debug_thread);
#endif
#ifdef EXTERNAL_TICK_REQUIRED
    (void) cprSetMessageQueueThread(ticker_msgq, ticker_thread);
#endif

    /*
     * initialize debugs of other modules.
     *
     * dp_init needs the gsm_msgq id. This
     * is set in a global variable by the
     * GSM task running. However due to timing
     * issues dp_init is sometimes run before
     * the GSM task has set this variable resulting
     * in a NULL msgqueue ptr being passed to CPR
     * which returns an error and does not create
     * the dialplan timer. Thus pass is the same
     * data to dp_init that is passed into the
     * cprCreateThread call for GSM above.
     */
    config_init();
    vcmInit();
    dp_init(gsm_msgq);

    if (sip_minimum_config_check() != 0) {
        PHNChangeState(STATE_UNPROVISIONED);
    } else {
        PHNChangeState(STATE_CONNECTED);
    }

    (void) cprPostInit();

    if ( vcmGetVideoCodecList(VCM_DSP_FULLDUPLEX) ) {
        cc_media_update_native_video_support(TRUE);
    }

    return (0);
}