Ignore:
Timestamp:
Feb 18, 2009 2:28:49 PM (15 years ago)
Author:
nanang
Message:
  • Added APS-direct sound device management into pjsua-lib (and removed it from apps).
  • Fixed bug in conf_switch.c to always update ts_rx (even if port is not transmitting).
  • Minor updates: 'fmt_id' to 'id', added transmitter_Cnt in conf port info, explicit mapping in Symbian audio APS impl from pjmedia_format_id to Symbian APS fourcc.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia/symbian_sound_aps.cpp

    r2456 r2460  
    708708    pjmedia_frame_ext *frame = (pjmedia_frame_ext*) strm->rec_buf; 
    709709     
    710     switch(strm->setting.format.u32) { 
     710    switch(strm->setting.format.id) { 
    711711    case PJMEDIA_FORMAT_AMR: 
    712712        { 
     
    757757            unsigned samples_got; 
    758758             
    759             samples_got = strm->setting.mode == 30? 240 : 160; 
     759            samples_got = strm->setting.format.bitrate == 15200? 160 : 240; 
    760760             
    761761            /* Check if we got a normal frame. */ 
     
    836836    buf.iBuffer.Zero(); 
    837837 
    838     switch(strm->setting.format.u32) { 
     838    switch(strm->setting.format.id) { 
    839839    case PJMEDIA_FORMAT_AMR: 
    840840        { 
     
    949949                sf = pjmedia_frame_ext_get_subframe(frame, 0); 
    950950                samples_cnt = frame->samples_cnt / frame->subframe_cnt; 
    951                 pj_assert((strm->setting.mode == 30 && samples_cnt == 240) || 
    952                           (strm->setting.mode == 20 && samples_cnt == 160)); 
     951                 
     952                pj_assert((strm->setting.format.bitrate == 15200 &&  
     953                           samples_cnt == 160) || 
     954                          (strm->setting.format.bitrate != 15200 && 
     955                           samples_cnt == 240)); 
    953956                 
    954957                if (sf->data && sf->bitlen) { 
     
    10061009                    } else { 
    10071010                        pj_uint8_t silc; 
    1008                         silc = (strm->setting.format.u32==PJMEDIA_FORMAT_PCMU)? 
     1011                        silc = (strm->setting.format.id==PJMEDIA_FORMAT_PCMU)? 
    10091012                                pjmedia_linear2ulaw(0) : pjmedia_linear2alaw(0); 
    10101013                        buf.iBuffer.AppendFill(silc, samples_cnt); 
     
    10171020                    pj_uint8_t silc; 
    10181021                     
    1019                     silc = (strm->setting.format.u32==PJMEDIA_FORMAT_PCMU)? 
     1022                    silc = (strm->setting.format.id==PJMEDIA_FORMAT_PCMU)? 
    10201023                            pjmedia_linear2ulaw(0) : pjmedia_linear2alaw(0); 
    10211024                    buf.iBuffer.AppendFill(silc, samples_req - samples_ready); 
     
    11061109 
    11071110    /* Set audio engine fourcc. */ 
    1108     if (strm->setting.format.u32 == PJMEDIA_FORMAT_PCMU || 
    1109         strm->setting.format.u32 == PJMEDIA_FORMAT_PCMA || 
    1110         strm->setting.format.u32 == PJMEDIA_FORMAT_L16) 
     1111    switch(strm->setting.format.id) { 
     1112    case PJMEDIA_FORMAT_L16: 
     1113    case PJMEDIA_FORMAT_PCMU: 
     1114    case PJMEDIA_FORMAT_PCMA: 
     1115        aps_setting.fourcc = TFourCC(KMCPFourCCIdG711); 
     1116        break; 
     1117    case PJMEDIA_FORMAT_AMR: 
     1118        aps_setting.fourcc = TFourCC(KMCPFourCCIdAMRNB); 
     1119        break; 
     1120    case PJMEDIA_FORMAT_G729: 
     1121        aps_setting.fourcc = TFourCC(KMCPFourCCIdG729); 
     1122        break; 
     1123    case PJMEDIA_FORMAT_ILBC: 
     1124        aps_setting.fourcc = TFourCC(KMCPFourCCIdILBC); 
     1125        break; 
     1126    default: 
     1127        aps_setting.fourcc = 0; 
     1128        break; 
     1129    } 
     1130 
     1131    /* Set audio engine mode. */ 
     1132    if (strm->setting.format.id == PJMEDIA_FORMAT_AMR) 
    11111133    { 
    1112         aps_setting.fourcc = TFourCC(KMCPFourCCIdG711); 
    1113     } else { 
    1114         aps_setting.fourcc = TFourCC(strm->setting.format.u32); 
    1115     } 
    1116  
    1117     /* Set audio engine mode. */ 
    1118     if (strm->setting.format.u32 == PJMEDIA_FORMAT_AMR) 
    1119     { 
    1120         aps_setting.mode = (TAPSCodecMode)strm->setting.bitrate; 
     1134        aps_setting.mode = (TAPSCodecMode)strm->setting.format.bitrate; 
    11211135    }  
    1122     else if (strm->setting.format.u32 == PJMEDIA_FORMAT_PCMU || 
    1123              strm->setting.format.u32 == PJMEDIA_FORMAT_L16 || 
    1124             (strm->setting.format.u32 == PJMEDIA_FORMAT_ILBC  && 
    1125              strm->setting.mode == 30)) 
     1136    else if (strm->setting.format.id == PJMEDIA_FORMAT_PCMU || 
     1137             strm->setting.format.id == PJMEDIA_FORMAT_L16 || 
     1138            (strm->setting.format.id == PJMEDIA_FORMAT_ILBC  && 
     1139             strm->setting.format.bitrate != 15200)) 
    11261140    { 
    11271141        aps_setting.mode = EULawOr30ms; 
    11281142    }  
    1129     else if (strm->setting.format.u32 == PJMEDIA_FORMAT_PCMA || 
    1130             (strm->setting.format.u32 == PJMEDIA_FORMAT_ILBC && 
    1131              strm->setting.mode == 20)) 
     1143    else if (strm->setting.format.id == PJMEDIA_FORMAT_PCMA || 
     1144            (strm->setting.format.id == PJMEDIA_FORMAT_ILBC && 
     1145             strm->setting.format.bitrate == 15200)) 
    11321146    { 
    11331147        aps_setting.mode = EALawOr20ms; 
     
    11351149 
    11361150    /* Disable VAD on L16 and G711. */ 
    1137     if (strm->setting.format.u32 == PJMEDIA_FORMAT_PCMU || 
    1138         strm->setting.format.u32 == PJMEDIA_FORMAT_PCMA || 
    1139         strm->setting.format.u32 == PJMEDIA_FORMAT_L16) 
     1151    if (strm->setting.format.id == PJMEDIA_FORMAT_PCMU || 
     1152        strm->setting.format.id == PJMEDIA_FORMAT_PCMA || 
     1153        strm->setting.format.id == PJMEDIA_FORMAT_L16) 
    11401154    { 
    11411155        aps_setting.vad = EFalse; 
    11421156    } else { 
    1143         aps_setting.vad = strm->setting.vad; 
     1157        aps_setting.vad = strm->setting.format.vad; 
    11441158    } 
    11451159     
    11461160    /* Set other audio engine attributes. */ 
    11471161    aps_setting.plc = strm->setting.plc; 
    1148     aps_setting.cng = strm->setting.cng; 
    1149     aps_setting.loudspk = strm->setting.loudspk; 
     1162    aps_setting.cng = aps_setting.vad; 
     1163    aps_setting.loudspk = strm->setting.route == PJMEDIA_SND_ROUTE_LOUDSPEAKER; 
    11501164 
    11511165    /* Set audio engine callbacks. */ 
    1152     if (strm->setting.format.u32 == PJMEDIA_FORMAT_L16) { 
     1166    if (strm->setting.format.id == PJMEDIA_FORMAT_L16) { 
    11531167        aps_play_cb = &PlayCbPcm; 
    11541168        aps_rec_cb  = &RecCbPcm; 
     
    11801194    strm->rec_buf_len = 0; 
    11811195 
    1182     if (strm->setting.format.u32 == PJMEDIA_FORMAT_G729) { 
     1196    if (strm->setting.format.id == PJMEDIA_FORMAT_G729) { 
    11831197        TBitStream *g729_bitstream = new TBitStream; 
    11841198         
     
    12121226 
    12131227    pj_bzero(&setting, sizeof(setting)); 
    1214     setting.format.u32 = PJMEDIA_FORMAT_L16; 
     1228    setting.format.id = PJMEDIA_FORMAT_L16; 
    12151229     
    12161230    return sound_open(PJMEDIA_DIR_CAPTURE, clock_rate, channel_count, 
     
    12341248 
    12351249    pj_bzero(&setting, sizeof(setting)); 
    1236     setting.format.u32 = PJMEDIA_FORMAT_L16; 
     1250    setting.format.id = PJMEDIA_FORMAT_L16; 
    12371251 
    12381252    return sound_open(PJMEDIA_DIR_PLAYBACK, clock_rate, channel_count, 
     
    12591273 
    12601274    pj_bzero(&setting, sizeof(setting)); 
    1261     setting.format.u32 = PJMEDIA_FORMAT_L16; 
     1275    setting.format.id = PJMEDIA_FORMAT_L16; 
    12621276 
    12631277    return sound_open(PJMEDIA_DIR_CAPTURE_PLAYBACK, clock_rate, channel_count, 
     
    13471361    stream->engine = NULL; 
    13481362 
    1349     if (stream->setting.format.u32 == PJMEDIA_FORMAT_G729) { 
     1363    if (stream->setting.format.id == PJMEDIA_FORMAT_G729) { 
    13501364        TBitStream *g729_bitstream = (TBitStream*)stream->strm_data; 
    13511365        stream->strm_data = NULL; 
Note: See TracChangeset for help on using the changeset viewer.