Changeset 2506 for pjproject/trunk


Ignore:
Timestamp:
Mar 12, 2009 6:11:37 PM (15 years ago)
Author:
bennylp
Message:

(Major) Task #737 and #738: integration of APS-Direct and Audiodev from aps-direct branch to trunk.

Location:
pjproject/trunk
Files:
9 deleted
68 edited
27 copied

Legend:

Unmodified
Added
Removed
  • pjproject/trunk

  • pjproject/trunk/Makefile

    r2037 r2506  
    3434        pjnath/lib/libpjnath-$(TARGET_NAME).a \ 
    3535        pjmedia/lib/libpjmedia-$(TARGET_NAME).a \ 
     36        pjmedia/lib/libpjmedia-audiodev-$(TARGET_NAME).a \ 
    3637        pjmedia/lib/libpjmedia-codec-$(TARGET_NAME).a \ 
    3738        pjsip/lib/libpjsip-$(TARGET_NAME).a \ 
  • pjproject/trunk/build.mak.in

    r2232 r2506  
    6161        -lpjmedia-codec-$(TARGET_NAME)\ 
    6262        -lpjmedia-$(TARGET_NAME)\ 
     63        -lpjmedia-audiodev-$(TARGET_NAME)\ 
    6364        -lpjnath-$(TARGET_NAME)\ 
    6465        -lpjlib-util-$(TARGET_NAME)\ 
  • pjproject/trunk/build.symbian/bld.inf

    r2174 r2506  
    1 #define SND_USE_NULL    0 
    2 #define SND_USE_APS     0 
    3  
    41prj_platforms 
    52winscw 
     
    2421libgsmcodec.mmp 
    2522libspeexcodec.mmp 
     23libpassthroughcodec.mmp 
    2624 
    27 /* Sound device impl */ 
    28 #if SND_USE_NULL 
    29         null_audio.mmp 
    30 #elif SND_USE_APS 
    31         symbian_audio_aps.mmp 
    32 #else 
    33         symbian_audio.mmp 
    34 #endif 
     25/* Audio device. */ 
     26pjmedia_audiodev.mmp 
    3527 
    3628/* Applications */ 
  • pjproject/trunk/build.symbian/pjlib.mmp

    r1962 r2506  
    1919 
    2020SOURCEPATH      ..\pjlib\src\pj 
    21  
    22 OPTION          CW -lang c++ 
    23 OPTION          ARMCC --cpp 
    24 OPTION          GCC     -x c++ 
    2521 
    2622MACRO           PJ_M_I386=1 
  • pjproject/trunk/build.symbian/pjlib_test.mmp

    r2139 r2506  
    1515STATICLIBRARY   pjlib.lib  
    1616#endif 
    17  
    18 OPTION          CW -lang c++ 
    19 OPTION          ARMCC --cpp 
    20 OPTION          GCC     -x c++ 
    2117 
    2218// Test files 
  • pjproject/trunk/build.symbian/pjlib_util.mmp

    r1987 r2506  
    2222MACRO           PJ_M_I386=1 
    2323MACRO           PJ_SYMBIAN=1 
    24  
    25 OPTION          CW -lang c++ 
    26 OPTION          ARMCC --cpp 
    27 OPTION          GCC     -x c++ 
    2824 
    2925// 
  • pjproject/trunk/build.symbian/pjmedia.mmp

    r2262 r2506  
    4141SOURCE          codec.c 
    4242SOURCE          conference.c 
     43SOURCE          conf_switch.c 
    4344SOURCE          echo_common.c 
    4445SOURCE          echo_port.c 
  • pjproject/trunk/build.symbian/pjnath.mmp

    r1988 r2506  
    2222MACRO           PJ_M_I386=1 
    2323MACRO           PJ_SYMBIAN=1 
    24  
    25 OPTION          CW -lang c++ 
    26 OPTION          ARMCC --cpp 
    27 OPTION          GCC     -x c++ 
    2824 
    2925// 
  • pjproject/trunk/build.symbian/pjsdp.mmp

    r1640 r2506  
    2020SOURCEPATH      ..\pjmedia\src\pjmedia 
    2121 
    22 OPTION          CW -lang c++ 
    23 OPTION          ARMCC --cpp 
    24 OPTION          GCC     -x c++ 
    25  
    2622MACRO           PJ_M_I386=1 
    2723MACRO           PJ_SYMBIAN=1 
  • pjproject/trunk/build.symbian/pjsip.mmp

    r1818 r2506  
    2525MACRO           PJ_M_I386=1 
    2626MACRO           PJ_SYMBIAN=1 
    27  
    28 OPTION          CW -lang c++ 
    29 OPTION          ARMCC --cpp 
    30 OPTION          GCC     -x c++ 
    3127 
    3228// PJSIP-CORE files 
  • pjproject/trunk/build.symbian/pjsip_simple.mmp

    r1640 r2506  
    2626MACRO           PJ_SYMBIAN=1 
    2727 
    28 OPTION          CW -lang c++ 
    29 OPTION          ARMCC --cpp 
    30 OPTION          GCC     -x c++ 
    31  
    32  
    3328// PJSIP-SIMPLE files 
    3429 
  • pjproject/trunk/build.symbian/pjstun_client.mmp

    r1640 r2506  
    77MACRO           PJ_M_I386=1 
    88MACRO           PJ_SYMBIAN=1 
    9  
    10 OPTION          CW -lang c++ 
    11 OPTION          ARMCC --cpp 
    12 OPTION          GCC     -x c++ 
    139 
    1410// PJSTUN-CLIENT files 
  • pjproject/trunk/build.symbian/symbian_audio.mmp

    r1965 r2506  
    2525 
    2626OPTION          CW -lang c++ 
    27  
    28 // 
    29 // GCCE optimization setting 
    30 // 
    3127OPTION          GCCE -O2 -fno-unit-at-a-time 
    3228 
     
    3430MACRO           PJ_SYMBIAN=1 
    3531 
     32SOURCE          nullsound.c 
    3633SOURCE          symbian_sound.cpp 
     34SOURCE          symbian_sound_aps.cpp 
    3735 
    3836SYSTEMINCLUDE   ..\pjlib\include 
     
    4139SYSTEMINCLUDE   \epoc32\include 
    4240SYSTEMINCLUDE   \epoc32\include\libc 
     41SYSTEMINCLUDE   \epoc32\include\mmf\server  
     42SYSTEMINCLUDE   \epoc32\include\mmf\common  
     43SYSTEMINCLUDE   \epoc32\include\mda\common  
    4344 
    4445SYSTEMINCLUDE   \epoc32\include\mmf\plugin  
  • pjproject/trunk/build.symbian/symbian_ua.mmp

    r2384 r2506  
    1 #define SND_USE_NULL    0 
    2 #define SND_USE_APS     0 
     1#define SND_HAS_APS     0 
     2#define SND_HAS_VAS     0 
     3#define SND_HAS_MDA     1 
    34 
    4 TARGET          symbian_ua.exe 
    5 TARGETTYPE      exe 
    6 UID             0x0 0xA000000D 
     5TARGET                  symbian_ua.exe 
     6TARGETTYPE              exe 
     7UID                     0x0 0x200235D3 
    78 
    8 SOURCEPATH      ..\pjsip-apps\src\symbian_ua 
     9SOURCEPATH              ..\pjsip-apps\src\symbian_ua 
    910 
    10 MACRO           PJ_M_I386=1 
    11 MACRO           PJ_SYMBIAN=1 
     11MACRO                   PJ_M_I386=1 
     12MACRO                   PJ_SYMBIAN=1 
    1213 
    1314// Source files 
    1415 
    15 SOURCE  ua.cpp 
    16 SOURCE  main_symbian.cpp 
     16SOURCE                  ua.cpp 
     17SOURCE                  main_symbian.cpp 
    1718 
    18 DOCUMENT ua.h 
     19DOCUMENT                ua.h 
    1920 
    20 START RESOURCE  symbian_ua_reg.rss 
     21START RESOURCE          symbian_ua_reg.rss 
    2122        TARGETPATH      \private\10003a3f\apps 
    2223END 
    2324 
    24 SYSTEMINCLUDE   ..\pjlib\include 
    25 SYSTEMINCLUDE   ..\pjlib-util\include 
    26 SYSTEMINCLUDE   ..\pjnath\include 
    27 SYSTEMINCLUDE   ..\pjmedia\include 
    28 SYSTEMINCLUDE   ..\pjsip\include 
     25SYSTEMINCLUDE           ..\pjlib\include 
     26SYSTEMINCLUDE           ..\pjlib-util\include 
     27SYSTEMINCLUDE           ..\pjnath\include 
     28SYSTEMINCLUDE           ..\pjmedia\include 
     29SYSTEMINCLUDE           ..\pjsip\include 
    2930 
    30 SYSTEMINCLUDE   \epoc32\include 
    31 SYSTEMINCLUDE   \epoc32\include\libc 
     31SYSTEMINCLUDE           \epoc32\include 
     32SYSTEMINCLUDE           \epoc32\include\libc 
    3233 
    33 STATICLIBRARY   pjsua_lib.lib pjsip_ua.lib 
    34 STATICLIBRARY   pjsip_simple.lib pjsip.lib pjsdp.lib pjmedia.lib 
    35 STATICLIBRARY   pjnath.lib pjlib_util.lib pjlib.lib 
    36 STATICLIBRARY   libsrtp.lib 
    37 STATICLIBRARY   libgsmcodec.lib libspeexcodec.lib 
     34STATICLIBRARY           pjsua_lib.lib pjsip_ua.lib 
     35STATICLIBRARY           pjsip_simple.lib pjsip.lib pjsdp.lib pjmedia.lib 
     36STATICLIBRARY           pjnath.lib pjlib_util.lib pjlib.lib 
     37STATICLIBRARY           libsrtp.lib 
     38STATICLIBRARY           libgsmcodec.lib libspeexcodec.lib 
     39STATICLIBRARY           libpassthroughcodec.lib 
     40STATICLIBRARY           pjmedia_audiodev.lib  
    3841 
    39 #if SND_USE_NULL 
    40     STATICLIBRARY       null_audio.lib 
    41     CAPABILITY          NetworkServices LocalServices ReadUserData WriteUserData UserEnvironment  
    42 #elif SND_USE_APS 
    43     STATICLIBRARY       symbian_audio_aps.lib 
    44     LIBRARY             APSSession2.lib 
    45     CAPABILITY          NetworkServices LocalServices ReadUserData WriteUserData UserEnvironment MultimediaDD 
    46     MACRO               PJMEDIA_SYM_SND_USE_APS=1 
    47 #else 
    48     STATICLIBRARY       symbian_audio.lib 
    49     LIBRARY             mediaclientaudiostream.lib 
    50     LIBRARY             mediaclientaudioinputstream.lib 
    51     CAPABILITY          NetworkServices LocalServices ReadUserData WriteUserData UserEnvironment  
     42#if SND_HAS_APS 
     43        LIBRARY         APSSession2.lib 
    5244#endif 
    5345 
     46#if SND_HAS_VAS 
     47//      LIBRARY          
     48#endif 
     49 
     50#if SND_HAS_MDA 
     51        LIBRARY         mediaclientaudiostream.lib 
     52        LIBRARY         mediaclientaudioinputstream.lib 
     53#endif 
     54 
     55#if SND_HAS_APS || SND_HAS_VAS 
     56        CAPABILITY      NetworkServices LocalServices ReadUserData WriteUserData UserEnvironment MultimediaDD 
     57#else 
     58        CAPABILITY      NetworkServices LocalServices ReadUserData WriteUserData UserEnvironment 
     59#endif 
     60         
    5461#ifdef WINSCW 
    5562        STATICLIBRARY   eexe.lib ecrt0.lib 
    5663#endif 
    5764 
    58 LIBRARY         esock.lib insock.lib charconv.lib euser.lib estlib.lib commdb.lib apengine.lib  
     65LIBRARY                 esock.lib insock.lib charconv.lib euser.lib estlib.lib commdb.lib apengine.lib  
    5966 
    6067// The default 8KB seems to be insufficient with all bells and 
    6168// whistles turned on 
    62 EPOCSTACKSIZE   12288 
     69EPOCSTACKSIZE           12288 
    6370 
  • pjproject/trunk/build.symbian/symbian_ua_udeb.pkg

    r1687 r2506  
    1 ; symbian_ua.pkg 
     1; symbian_ua_udeb.pkg 
     2 
     3; for Carbide development, please use symbian_ua.pkg for comfortness 
     4; (epoc32 path, platform, and target are set automatically using env vars) 
    25 
    36; Languages 
     
    58 
    69; Header 
    7 #{"symbian_ua"},(0xA000000D), 0, 1, 1 
     10#{"symbian_ua"},(0x200235D3), 0, 1, 1 
    811 
    912; Platform compatibility 
     
    1518 
    1619; Target 
    17 "C:\Symbian\9.1\S60_3rd_MR\epoc32\release\gcce\UDEB\symbian_ua.exe"-"!:\sys\bin\symbian_ua.exe" 
    18 "C:\Symbian\9.1\S60_3rd_MR\epoc32\data\z\private\10003a3f\apps\symbian_ua_reg.rSC"-"!:\private\10003a3f\import\apps\symbian_ua_reg.rSC" 
     20"C:\Symbian\9.2\S60_3rd_FP1\epoc32\release\gcce\UDEB\symbian_ua.exe"-"!:\sys\bin\symbian_ua.exe" 
     21"C:\Symbian\9.2\S60_3rd_FP1\epoc32\data\z\private\10003a3f\apps\symbian_ua_reg.rSC"-"!:\private\10003a3f\import\apps\symbian_ua_reg.rSC" 
  • pjproject/trunk/build.symbian/symbian_ua_urel.pkg

    r1687 r2506  
    11; symbian_ua.pkg 
     2 
     3; for Carbide development, please use symbian_ua.pkg for comfortness 
     4; (epoc32 path, platform, and target are set automatically using env vars) 
    25 
    36; Languages 
     
    58 
    69; Header 
    7 #{"symbian_ua"},(0xA000000D), 0, 1, 1 
     10#{"symbian_ua"},(0x200235D3), 0, 1, 1 
    811 
    912; Platform compatibility 
  • pjproject/trunk/build.symbian/symsndtest.mmp

    r2257 r2506  
    1 #define SND_USE_NULL    0 
    2 #define SND_USE_APS     0 
     1#define SND_USE_APS     1 
     2#define SND_USE_VAS     0 
    33 
    4 TARGET          symsndtest.exe 
    5 TARGETTYPE      exe 
    6 UID             0x0 0xA000000E 
     4TARGET                  symsndtest.exe 
     5TARGETTYPE              exe 
     6UID                     0x0 0xA000000E 
    77 
    8 SOURCEPATH      ..\pjsip-apps\src\symsndtest 
     8SOURCEPATH              ..\pjsip-apps\src\symsndtest 
    99 
    10 MACRO           PJ_M_I386=1 
    11 MACRO           PJ_SYMBIAN=1 
     10MACRO                   PJ_M_I386=1 
     11MACRO                   PJ_SYMBIAN=1 
    1212 
    1313// Test files 
    1414 
    15 SOURCE  app_main.cpp 
    16 SOURCE  main_symbian.cpp 
     15SOURCE                  app_main.cpp 
     16SOURCE                  main_symbian.cpp 
    1717 
    18 START RESOURCE  symsndtest_reg.rss 
     18START RESOURCE          symsndtest_reg.rss 
    1919        TARGETPATH      \private\10003a3f\apps 
    2020END 
    2121 
    22 SYSTEMINCLUDE   ..\pjlib\include 
    23 SYSTEMINCLUDE   ..\pjmedia\include 
     22SYSTEMINCLUDE           ..\pjlib\include 
     23SYSTEMINCLUDE           ..\pjmedia\include 
    2424 
    25 SYSTEMINCLUDE   \epoc32\include 
    26 SYSTEMINCLUDE   \epoc32\include\libc 
     25SYSTEMINCLUDE           \epoc32\include 
     26SYSTEMINCLUDE           \epoc32\include\libc 
    2727 
    28 LIBRARY         charconv.lib euser.lib estlib.lib 
    29 LIBRARY         esock.lib insock.lib 
    30 STATICLIBRARY   pjlib.lib pjmedia.lib 
     28LIBRARY                 charconv.lib euser.lib estlib.lib 
     29LIBRARY                 esock.lib insock.lib 
     30STATICLIBRARY           pjlib.lib pjmedia.lib 
     31STATICLIBRARY           symbian_audio.lib 
    3132 
    32 #if SND_USE_NULL 
    33     STATICLIBRARY       null_audio.lib 
    34     CAPABILITY          NetworkServices LocalServices ReadUserData WriteUserData UserEnvironment  
    35 #elif SND_USE_APS 
    36     SOURCEPATH                              ..\pjmedia\src\pjmedia  
    37     SOURCE                                  symbian_sound_aps.cpp  
    38  
    39     SYSTEMINCLUDE                           \epoc32\include\mmf\server  
    40     SYSTEMINCLUDE                           \epoc32\include\mmf\common  
    41     SYSTEMINCLUDE                           \epoc32\include\mda\common  
    42  
    43     //STATICLIBRARY     symbian_audio_aps.lib 
    44     LIBRARY             APSSession2.lib 
    45     CAPABILITY          NetworkServices LocalServices ReadUserData WriteUserData UserEnvironment MultimediaDD 
     33#if SND_USE_APS 
     34        LIBRARY         APSSession2.lib 
     35        CAPABILITY      NetworkServices LocalServices ReadUserData WriteUserData UserEnvironment MultimediaDD 
     36#elif SND_USE_VAS 
     37//      LIBRARY          
     38        CAPABILITY      NetworkServices LocalServices ReadUserData WriteUserData UserEnvironment MultimediaDD 
    4639#else 
    47     STATICLIBRARY       symbian_audio.lib 
    48     LIBRARY             mediaclientaudiostream.lib 
    49     LIBRARY             mediaclientaudioinputstream.lib 
    50     CAPABILITY          NetworkServices LocalServices ReadUserData WriteUserData UserEnvironment  
     40        LIBRARY         mediaclientaudiostream.lib 
     41        LIBRARY         mediaclientaudioinputstream.lib 
     42        CAPABILITY      NetworkServices LocalServices ReadUserData WriteUserData UserEnvironment 
    5143#endif 
    5244 
  • pjproject/trunk/pjlib/include/pj/compat/os_symbian.h

    r2394 r2506  
    115115 * Override features. 
    116116 */ 
    117 #define PJ_HAS_FLOATING_POINT       1 
     117#define PJ_HAS_FLOATING_POINT       0 
    118118#define PJ_HAS_MALLOC               0 
    119119#define PJ_HAS_SEMAPHORE            1 
  • pjproject/trunk/pjlib/include/pj/config_site_sample.h

    r2381 r2506  
    1  
    2  
    3 //#define PJ_CONFIG_MINIMAL_SIZE 
    4 //#define PJ_CONFIG_MAXIMUM_SPEED 
    5  
    6  
    7 /* 
    8  * This file (config_site_sample.h) contains various configuration 
    9  * settings that I use for certain settings.  
     1/* 
     2 * This file contains several sample settings especially for Windows 
     3 * Mobile and Symbian targets. You can include this file in your 
     4 * <pj/config_site.h> file. 
     5 * 
     6 * The Windows Mobile and Symbian settings will be activated 
     7 * automatically if you include this file. 
     8 * 
     9 * In addition, you may specify one of these macros (before including 
     10 * this file) to activate additional settings: 
     11 * 
     12 * #define PJ_CONFIG_NOKIA_APS_DIRECT 
     13 *   Use this macro to activate the APS-Direct feature. Please see 
     14 *   http://trac.pjsip.org/repos/wiki/Nokia_APS_VAS_Direct for more  
     15 *   info. 
     16 * 
     17 * #define PJ_CONFIG_WIN32_WMME_DIRECT 
     18 *   Configuration to activate "APS-Direct" media mode on Windows or 
     19 *   Windows Mobile, useful for testing purposes only. 
    1020 */ 
    1121 
     
    1525 */ 
    1626#if defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE!=0 
    17 #   define PJ_HAS_FLOATING_POINT        0 
    18  
    19 #   define PJMEDIA_HAS_G711_PLC         0 
    20 //#   define PJMEDIA_HAS_SMALL_FILTER   1 
    21 //#   define PJMEDIA_HAS_LARGE_FILTER   0 
    22 #   define PJMEDIA_HAS_L16_CODEC        0 
    23 /*#   define PJMEDIA_HAS_GSM_CODEC      0*/ 
    24 /*#   define PJMEDIA_HAS_ILBC_CODEC     0*/ 
    25 /*#   define PJMEDIA_HAS_SPEEX_CODEC    0*/ 
    26 #   define PJMEDIA_HAS_SPEEX_AEC        0 
    27 #   undef PJMEDIA_RESAMPLE_IMP 
    28 #   define PJMEDIA_RESAMPLE_IMP         PJMEDIA_RESAMPLE_LIBRESAMPLE 
    29 #   define PJMEDIA_WSOLA_IMP            PJMEDIA_WSOLA_IMP_WSOLA_LITE 
    30  
    31     /* Speex default quality settings */ 
    32 #   define PJSUA_DEFAULT_CODEC_QUALITY  5 
    33 #   define PJMEDIA_CODEC_SPEEX_DEFAULT_QUALITY  5 
    34  
    35 #   define PJMEDIA_SDP_NEG_PREFER_REMOTE_CODEC_ORDER    0 
    36 #endif 
     27 
     28    /* 
     29     * PJLIB settings. 
     30     */ 
     31 
     32    /* Disable floating point support */ 
     33    #define PJ_HAS_FLOATING_POINT               0 
     34 
     35    /* 
     36     * PJMEDIA settings 
     37     */ 
     38 
     39    /* Select codecs to disable */ 
     40    #define PJMEDIA_HAS_L16_CODEC               0 
     41    #define PJMEDIA_HAS_ILBC_CODEC              0 
     42 
     43    /* We probably need more buffers on WM, so increase the limit */ 
     44    #define PJMEDIA_SOUND_BUFFER_COUNT          32 
     45 
     46    /* Fine tune Speex's default settings for best performance/quality */ 
     47    #define PJMEDIA_CODEC_SPEEX_DEFAULT_QUALITY 5 
     48 
     49    /* For CPU reason, disable speex AEC and use the echo suppressor. */ 
     50    #define PJMEDIA_HAS_SPEEX_AEC               0 
     51 
     52    /* Shouldn't use resampling for performance reason too. */ 
     53    #define PJMEDIA_RESAMPLE_IMP                PJMEDIA_RESAMPLE_NONE 
     54 
     55    /* Use the lighter WSOLA implementation */ 
     56    #define PJMEDIA_WSOLA_IMP                   PJMEDIA_WSOLA_IMP_WSOLA_LITE 
     57 
     58    /* 
     59     * PJSIP settings. 
     60     */ 
     61 
     62    /* Set maximum number of dialog/transaction/calls to minimum to reduce 
     63     * memory usage  
     64     */ 
     65    #define PJSIP_MAX_TSX_COUNT                 31 
     66    #define PJSIP_MAX_DIALOG_COUNT              31 
     67    #define PJSUA_MAX_CALLS                     4 
     68 
     69    /* 
     70     * PJSUA settings 
     71     */ 
     72 
     73    /* Default codec (Speex) quality */ 
     74    #define PJSUA_DEFAULT_CODEC_QUALITY         5 
     75 
     76    /* Set maximum number of objects to minimum to reduce memory usage */ 
     77    #define PJSUA_MAX_ACC                       4 
     78    #define PJSUA_MAX_PLAYERS                   4 
     79    #define PJSUA_MAX_RECORDERS                 4 
     80    #define PJSUA_MAX_CONF_PORTS                (PJSUA_MAX_CALLS+2*PJSUA_MAX_PLAYERS) 
     81    #define PJSUA_MAX_BUDDIES                   32 
     82 
     83#endif  /* PJ_WIN32_WINCE */ 
    3784 
    3885 
     
    4289#if defined(PJ_SYMBIAN) && PJ_SYMBIAN!=0 
    4390 
    44     /* We don't want to use float, for now */ 
    45 #   undef PJ_HAS_FLOATING_POINT 
    46 #   define PJ_HAS_FLOATING_POINT        0 
    47  
    48 #   define PJMEDIA_SOUND_IMPLEMENTATION PJMEDIA_SOUND_NULL_SOUND 
     91    /* 
     92     * PJLIB settings. 
     93     */ 
     94 
     95    /* Disable floating point support */ 
     96    #define PJ_HAS_FLOATING_POINT               0 
    4997 
    5098    /* Misc PJLIB setting */ 
    51 #   define PJ_MAXPATH                   80 
    52  
    53         /* SRTP has not been ported to Symbian yet */ 
    54 #   define PJMEDIA_HAS_SRTP                     1 
    55  
    56     /* Disable these */ 
    57 #   define PJMEDIA_RESAMPLE_IMP         PJMEDIA_RESAMPLE_NONE 
    58 #   define PJMEDIA_HAS_SPEEX_AEC        0 
    59 #   define PJMEDIA_WSOLA_IMP            PJMEDIA_WSOLA_IMP_WSOLA_LITE 
    60  
    61     /* Disable all codecs but G.711 and GSM, for now */ 
    62 #   define PJMEDIA_HAS_GSM_CODEC        1 
    63 #   define PJMEDIA_HAS_L16_CODEC        0 
    64 #   define PJMEDIA_HAS_ILBC_CODEC       0 
    65 #   define PJMEDIA_HAS_SPEEX_CODEC      1 
    66 #   define PJMEDIA_HAS_G722_CODEC       0 
    67  
    68     /* Need larger sound buffers */ 
    69 #   define PJMEDIA_SOUND_BUFFER_COUNT   16 
    70  
    71     /* Disable safe module access */ 
    72 #   define PJSIP_SAFE_MODULE            0 
    73  
    74 #   define PJSIP_MAX_PKT_LEN            2000 
     99    #define PJ_MAXPATH                          80 
    75100 
    76101    /* This is important for Symbian. Symbian lacks vsnprintf(), so 
     
    79104     * to log the packet. 
    80105     */ 
    81 #   define PJ_LOG_MAX_SIZE              (PJSIP_MAX_PKT_LEN+500) 
    82  
    83     /* Since we don't have threads, log buffer can use static buffer */ 
    84 #   define PJ_LOG_USE_STACK_BUFFER      0 
    85  
    86         /* Disable check stack since it increases footprint */ 
    87 #   undef PJ_OS_HAS_CHECK_STACK 
    88 #   define PJ_OS_HAS_CHECK_STACK        0 
     106    #define PJ_LOG_MAX_SIZE                     (PJSIP_MAX_PKT_LEN+500) 
     107 
     108    /* Since we don't have threads, log buffer can use static buffer 
     109     * rather than stack 
     110     */ 
     111    #define PJ_LOG_USE_STACK_BUFFER             0 
     112 
     113    /* Disable check stack since it increases footprint */ 
     114    #define PJ_OS_HAS_CHECK_STACK               0 
     115 
     116 
     117    /* 
     118     * PJMEDIA settings 
     119     */ 
     120 
     121    /* Disable non-Symbian audio devices */ 
     122    #define PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO     0 
     123    #define PJMEDIA_AUDIO_DEV_HAS_WMME          0 
     124 
     125    /* Select codecs to disable */ 
     126    #define PJMEDIA_HAS_L16_CODEC               0 
     127    #define PJMEDIA_HAS_ILBC_CODEC              0 
     128    #define PJMEDIA_HAS_G722_CODEC              0 
     129 
     130    /* Fine tune Speex's default settings for best performance/quality */ 
     131    #define PJMEDIA_CODEC_SPEEX_DEFAULT_QUALITY 5 
     132 
     133    /* For CPU reason, disable speex AEC and use the echo suppressor. */ 
     134    #define PJMEDIA_HAS_SPEEX_AEC               0 
     135 
     136    /* Shouldn't use resampling for performance reason too. */ 
     137    #define PJMEDIA_RESAMPLE_IMP                PJMEDIA_RESAMPLE_NONE 
     138 
     139    /* Use the lighter WSOLA implementation */ 
     140    #define PJMEDIA_WSOLA_IMP                   PJMEDIA_WSOLA_IMP_WSOLA_LITE 
     141 
     142    /* We probably need more buffers especially if MDA audio backend  
     143     * is used, so increase the limit  
     144     */ 
     145    #define PJMEDIA_SOUND_BUFFER_COUNT          32 
     146 
     147    /* 
     148     * PJSIP settings. 
     149     */ 
     150 
     151    /* Disable safe module access, since we don't use multithreading */ 
     152    #define PJSIP_SAFE_MODULE                   0 
     153 
     154    /* Increase allowable packet size, just in case */ 
     155    #define PJSIP_MAX_PKT_LEN                   2000 
    89156 
    90157    /* Symbian has problem with too many large blocks */ 
    91 #   define PJSIP_POOL_LEN_ENDPT         1000 
    92 #   define PJSIP_POOL_INC_ENDPT         1000 
    93 #   define PJSIP_POOL_RDATA_LEN         2000 
    94 #   define PJSIP_POOL_RDATA_INC         2000 
    95 #   define PJSIP_POOL_LEN_TDATA         2000 
    96 #   define PJSIP_POOL_INC_TDATA         512 
    97 #   define PJSIP_POOL_LEN_UA            2000 
    98 #   define PJSIP_POOL_INC_UA            1000 
    99 #   define PJSIP_POOL_TSX_LAYER_LEN     256 
    100 #   define PJSIP_POOL_TSX_LAYER_INC     256 
    101 #   define PJSIP_POOL_TSX_LEN           512 
    102 #   define PJSIP_POOL_TSX_INC           128 
     158    #define PJSIP_POOL_LEN_ENDPT                1000 
     159    #define PJSIP_POOL_INC_ENDPT                1000 
     160    #define PJSIP_POOL_RDATA_LEN                2000 
     161    #define PJSIP_POOL_RDATA_INC                2000 
     162    #define PJSIP_POOL_LEN_TDATA                2000 
     163    #define PJSIP_POOL_INC_TDATA                512 
     164    #define PJSIP_POOL_LEN_UA                   2000 
     165    #define PJSIP_POOL_INC_UA                   1000 
     166    #define PJSIP_POOL_TSX_LAYER_LEN            256 
     167    #define PJSIP_POOL_TSX_LAYER_INC            256 
     168    #define PJSIP_POOL_TSX_LEN                  512 
     169    #define PJSIP_POOL_TSX_INC                  128 
     170 
     171    /* 
     172     * PJSUA settings. 
     173     */ 
     174 
     175    /* Default codec quality */ 
     176    #define PJSUA_DEFAULT_CODEC_QUALITY         5 
    103177 
    104178    /* Set maximum number of dialog/transaction/calls to minimum */ 
    105 #   define PJSIP_MAX_TSX_COUNT          31 
    106 #   define PJSIP_MAX_DIALOG_COUNT       31 
    107 #   define PJSUA_MAX_CALLS              4 
     179    #define PJSIP_MAX_TSX_COUNT                 31 
     180    #define PJSIP_MAX_DIALOG_COUNT              31 
     181    #define PJSUA_MAX_CALLS                     4 
    108182 
    109183    /* Other pjsua settings */ 
    110 #   define PJSUA_MAX_ACC                4 
    111 #   define PJSUA_MAX_PLAYERS            4 
    112 #   define PJSUA_MAX_RECORDERS          4 
    113 #   define PJSUA_MAX_CONF_PORTS         (PJSUA_MAX_CALLS+2*PJSUA_MAX_PLAYERS) 
    114 #   define PJSUA_MAX_BUDDIES            32 
    115  
    116     /* Speex default quality settings */ 
    117 #   define PJSUA_DEFAULT_CODEC_QUALITY  5 
    118 #   define PJMEDIA_CODEC_SPEEX_DEFAULT_QUALITY  5 
     184    #define PJSUA_MAX_ACC                       4 
     185    #define PJSUA_MAX_PLAYERS                   4 
     186    #define PJSUA_MAX_RECORDERS                 4 
     187    #define PJSUA_MAX_CONF_PORTS                (PJSUA_MAX_CALLS+2*PJSUA_MAX_PLAYERS) 
     188    #define PJSUA_MAX_BUDDIES                   32 
     189#endif 
     190 
     191 
     192/* 
     193 * Additional configuration to activate APS-Direct feature for 
     194 * Nokia S60 target 
     195 * 
     196 * Please see http://trac.pjsip.org/repos/wiki/Nokia_APS_VAS_Direct 
     197 */ 
     198#ifdef PJ_CONFIG_NOKIA_APS_DIRECT 
     199 
     200    /* MUST use switchboard rather than the conference bridge */ 
     201    #define PJMEDIA_CONF_USE_SWITCH_BOARD       1 
     202 
     203    /* Enable APS sound device backend and disable MDA */ 
     204    #define PJMEDIA_AUDIO_DEV_HAS_SYMB_MDA      0 
     205    #define PJMEDIA_AUDIO_DEV_HAS_SYMB_APS      1 
     206 
     207    /* Enable passthrough codec framework */ 
     208    #define PJMEDIA_HAS_PASSTHROUGH_CODECS      1 
     209 
     210    /* And selectively enable which codecs are supported by the handset */ 
     211    #define PJMEDIA_HAS_PASSTHROUGH_CODEC_PCMU  1 
     212    #define PJMEDIA_HAS_PASSTHROUGH_CODEC_PCMA  1 
     213    #define PJMEDIA_HAS_PASSTHROUGH_CODEC_AMR   1 
     214    #define PJMEDIA_HAS_PASSTHROUGH_CODEC_G729  1 
     215    #define PJMEDIA_HAS_PASSTHROUGH_CODEC_ILBC  1 
     216 
     217#endif 
     218 
     219 
     220/* 
     221 * Configuration to activate "APS-Direct" media mode on Windows, 
     222 * useful for testing purposes only. 
     223 */ 
     224#ifdef PJ_CONFIG_WIN32_WMME_DIRECT 
     225 
     226    /* MUST use switchboard rather than the conference bridge */ 
     227    #define PJMEDIA_CONF_USE_SWITCH_BOARD       1 
     228 
     229    /* Only WMME supports the "direct" feature */ 
     230    #define PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO     0 
     231    #define PJMEDIA_AUDIO_DEV_HAS_WMME          1 
     232 
     233    /* Enable passthrough codec framework */ 
     234    #define PJMEDIA_HAS_PASSTHROUGH_CODECS      1 
     235 
     236    /* Only PCMA and PCMU are supported by WMME-direct */ 
     237    #define PJMEDIA_HAS_PASSTHROUGH_CODEC_PCMU  1 
     238    #define PJMEDIA_HAS_PASSTHROUGH_CODEC_PCMA  1 
     239    #define PJMEDIA_HAS_PASSTHROUGH_CODEC_AMR   0 
     240    #define PJMEDIA_HAS_PASSTHROUGH_CODEC_G729  0 
     241    #define PJMEDIA_HAS_PASSTHROUGH_CODEC_ILBC  0 
     242 
    119243#endif 
    120244 
  • pjproject/trunk/pjlib/include/pj/errno.h

    r2394 r2506  
    376376 *  - PJLIB_UTIL_ERRNO_START    (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*3) 
    377377 *  - PJNATH_ERRNO_START        (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*4) 
     378 *  - PJMEDIA_AUDIODEV_ERRNO_START (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*5) 
    378379 */ 
    379380 
  • pjproject/trunk/pjmedia/build/Makefile

    r2344 r2506  
    1919export PJMEDIA_CODEC_LIB:=../lib/libpjmedia-codec-$(TARGET_NAME)$(LIBEXT) 
    2020export PJSDP_LIB:=../lib/libpjsdp-$(TARGET_NAME)$(LIBEXT) 
     21export PJMEDIA_AUDIODEV_LIB:=../lib/libpjmedia-audiodev-$(TARGET_NAME)$(LIBEXT) 
    2122 
    22 NULLSOUND_OBJS := nullsound.o 
    2323 
    2424############################################################################### 
     
    3535                   $(HOST_CXXFLAGS) $(CXXFLAGS) 
    3636export _LDFLAGS := $(subst /,$(HOST_PSEP),$(PJMEDIA_LIB)) \ 
     37                   $(subst /,$(HOST_PSEP),$(PJMEDIA_AUDIODEV_LIB)) \ 
    3738                   $(subst /,$(HOST_PSEP),$(PJMEDIA_CODEC_LIB)) \ 
    3839                   $(subst /,$(HOST_PSEP),$(PJLIB_LIB)) \ 
     
    5051export PJMEDIA_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \ 
    5152                        alaw_ulaw.o alaw_ulaw_table.o clock_thread.o codec.o \ 
    52                         conference.o delaybuf.o echo_common.o echo_port.o \ 
    53                         echo_suppress.o endpoint.o errno.o \ 
     53                        conference.o conf_switch.o delaybuf.o echo_common.o \ 
     54                        echo_port.o echo_suppress.o endpoint.o errno.o \ 
    5455                        g711.o jbuf.o master_port.o mem_capture.o mem_player.o \ 
    5556                        null_port.o plc_common.o port.o splitcomb.o \ 
    5657                        resample_resample.o resample_libsamplerate.o \ 
    5758                        resample_port.o rtcp.o rtcp_xr.o rtp.o \ 
    58                         sdp.o sdp_cmp.o sdp_neg.o \ 
    59                         session.o silencedet.o sound_port.o stereo_port.o \ 
     59                        sdp.o sdp_cmp.o sdp_neg.o session.o silencedet.o \ 
     60                        sound_legacy.o sound_port.o stereo_port.o \ 
    6061                        stream.o tonegen.o transport_adapter_sample.o \ 
    6162                        transport_ice.o transport_loop.o \ 
    6263                        transport_srtp.o transport_udp.o \ 
    6364                        wav_player.o wav_playlist.o wav_writer.o wave.o \ 
    64                         wsola.o $(SOUND_OBJS) $(NULLSOUND_OBJS) 
     65                        wsola.o 
    6566 
    6667export PJMEDIA_CFLAGS += $(_CFLAGS) 
     68 
     69 
     70############################################################################### 
     71# Defines for building PJMEDIA-AUDIODEV library 
     72# 
     73export PJMEDIA_AUDIODEV_SRCDIR = ../src/pjmedia-audiodev 
     74export PJMEDIA_AUDIODEV_OBJS +=  audiodev.o audiotest.o errno.o legacy_dev.o pa_dev.o \ 
     75                                 wmme_dev.o 
     76export PJMEDIA_AUDIODEV_CFLAGS += $(_CFLAGS) 
    6777 
    6878 
     
    107117# $(TARGET) is defined in os-$(OS_NAME).mak file in current directory. 
    108118# 
    109 TARGETS := pjmedia pjmedia-codec pjsdp pjmedia-test 
     119TARGETS := pjmedia pjmedia-audiodev pjmedia-codec pjsdp pjmedia-test 
    110120 
    111121all: $(TARGETS) 
     
    122132distclean: realclean 
    123133 
    124 .PHONY: dep depend pjmedia pjmedia-codec pjmedia-test clean realclean distclean 
     134.PHONY: dep depend pjmedia pjmedia-codec pjmedia-audiodev pjmedia-test clean realclean distclean 
    125135 
    126136pjmedia: 
     
    129139pjmedia-codec: 
    130140        $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_CODEC app=pjmedia-codec $(PJMEDIA_CODEC_LIB) 
     141 
     142pjmedia-audiodev: 
     143        $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_AUDIODEV app=pjmedia-audiodev $(PJMEDIA_AUDIODEV_LIB) 
    131144 
    132145pjsdp: 
     
    153166        $(MAKE) -f $(RULES_MAK) APP=PJMEDIA app=pjmedia $@ 
    154167        $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_CODEC app=pjmedia-codec $@ 
     168        $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_AUDIODEV app=pjmedia-audiodev $@ 
    155169        $(MAKE) -f $(RULES_MAK) APP=PJSDP app=pjsdp $@ 
    156170        $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_TEST app=pjmedia-test $@ 
     
    158172realclean: 
    159173        $(subst @@,$(subst /,$(HOST_PSEP),.pjmedia-$(TARGET_NAME).depend),$(HOST_RMR)) 
     174        $(subst @@,$(subst /,$(HOST_PSEP),.pjmedia-audiodev-$(TARGET_NAME).depend),$(HOST_RMR)) 
    160175        $(subst @@,$(subst /,$(HOST_PSEP),.pjmedia-codec-$(TARGET_NAME).depend),$(HOST_RMR)) 
    161176        $(subst @@,$(subst /,$(HOST_PSEP),.pjmedia-test-$(TARGET_NAME).depend),$(HOST_RMR)) 
     
    163178         
    164179        $(MAKE) -f $(RULES_MAK) APP=PJMEDIA app=pjmedia $@ 
     180        $(MAKE) -f $(RULES_MAK) APP=PJMEDIA app=pjmedia-audiodev $@ 
    165181        $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_CODEC app=pjmedia-codec $@ 
    166182        $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_TEST app=pjmedia-test $@ 
     
    169185depend: 
    170186        $(MAKE) -f $(RULES_MAK) APP=PJMEDIA app=pjmedia $@ 
     187        $(MAKE) -f $(RULES_MAK) APP=PJMEDIA app=pjmedia-audiodev $@ 
    171188        $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_CODEC app=pjmedia-codec $@ 
    172189        $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_TEST app=pjmedia-test $@ 
  • pjproject/trunk/pjmedia/build/os-auto.mak.in

    r2182 r2506  
    7979# 
    8080ifneq ($(findstring pa,$(AC_PJMEDIA_SND)),) 
    81 export CFLAGS += -I$(THIRD_PARTY)/build/portaudio -I$(THIRD_PARTY)/portaudio/include -DPJMEDIA_SOUND_IMPLEMENTATION=PJMEDIA_SOUND_PORTAUDIO_SOUND 
    82 export SOUND_OBJS = pasound.o 
     81export CFLAGS += -I$(THIRD_PARTY)/build/portaudio -I$(THIRD_PARTY)/portaudio/include -DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=1 
    8382endif 
    8483 
    8584# 
    86 # Win32 DirectSound 
     85# Windows specific 
    8786# 
    88 ifeq ($(AC_PJMEDIA_SND),ds) 
    89 export SOUND_OBJS = dsound.o 
    90 export CFLAGS += -DPJMEDIA_SOUND_IMPLEMENTATION=PJMEDIA_SOUND_WIN32_DIRECT_SOUND 
     87ifneq ($(findstring win32,$(AC_PJMEDIA_SND)),) 
     88export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_WMME=1 
     89else 
     90export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_WMME=0 
    9191endif 
    9292 
     
    9595# 
    9696ifeq ($(AC_PJMEDIA_SND),null) 
    97 export SOUND_OBJS = nullsound.o 
     97# ***** Error ****** 
     98# This will not work either with the new Audiodev 
    9899export CFLAGS += -DPJMEDIA_SOUND_IMPLEMENTATION=PJMEDIA_SOUND_NULL_SOUND 
    99100endif 
     
    103104# 
    104105ifeq ($(AC_PJMEDIA_SND),external) 
    105 export SOUND_OBJS =  
    106 export CFLAGS += -DPJMEDIA_SOUND_IMPLEMENTATION=PJMEDIA_SOUND_EXTERNAL 
     106export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=0 -DPJMEDIA_AUDIO_DEV_HAS_WMME=0 
    107107endif 
    108108 
  • pjproject/trunk/pjmedia/build/pjmedia.dsp

    r2290 r2506  
    110110# Begin Source File 
    111111 
     112SOURCE=..\src\pjmedia\conf_switch.c 
     113# End Source File 
     114# Begin Source File 
     115 
    112116SOURCE=..\src\pjmedia\conference.c 
    113117# End Source File 
     
    118122# Begin Source File 
    119123 
    120 SOURCE=..\src\pjmedia\dsound.c 
    121 # End Source File 
    122 # Begin Source File 
    123  
    124124SOURCE=..\src\pjmedia\echo_common.c 
    125125# End Source File 
     
    174174# Begin Source File 
    175175 
    176 SOURCE=..\src\pjmedia\nullsound.c 
    177 # End Source File 
    178 # Begin Source File 
    179  
    180 SOURCE=..\src\pjmedia\pasound.c 
    181 # End Source File 
    182 # Begin Source File 
    183  
    184176SOURCE=..\src\pjmedia\plc_common.c 
    185177# End Source File 
     
    238230# Begin Source File 
    239231 
     232SOURCE=..\src\pjmedia\sound_legacy.c 
     233# End Source File 
     234# Begin Source File 
     235 
    240236SOURCE=..\src\pjmedia\sound_port.c 
    241237# End Source File 
     
    291287 
    292288SOURCE=..\src\pjmedia\wave.c 
    293 # End Source File 
    294 # Begin Source File 
    295  
    296 SOURCE=..\src\pjmedia\wmme_sound.c 
    297289# End Source File 
    298290# Begin Source File 
     
    307299 
    308300SOURCE=..\include\pjmedia\alaw_ulaw.h 
     301# End Source File 
     302# Begin Source File 
     303 
     304SOURCE=..\include\pjmedia\audio_dev.h 
    309305# End Source File 
    310306# Begin Source File 
  • pjproject/trunk/pjmedia/build/pjmedia.vcproj

    r2430 r2506  
    435435                        </File> 
    436436                        <File 
     437                                RelativePath="..\src\pjmedia\conf_switch.c" 
     438                                > 
     439                        </File> 
     440                        <File 
    437441                                RelativePath="..\src\pjmedia\conference.c" 
    438442                                > 
     
    461465                        </File> 
    462466                        <File 
    463                                 RelativePath="..\src\pjmedia\dsound.c" 
    464                                 > 
    465                                 <FileConfiguration 
    466                                         Name="Release|Win32" 
    467                                         > 
    468                                         <Tool 
    469                                                 Name="VCCLCompilerTool" 
    470                                                 AdditionalIncludeDirectories="" 
    471                                                 PreprocessorDefinitions="" 
    472                                         /> 
    473                                 </FileConfiguration> 
    474                                 <FileConfiguration 
    475                                         Name="Debug|Win32" 
    476                                         > 
    477                                         <Tool 
    478                                                 Name="VCCLCompilerTool" 
    479                                                 AdditionalIncludeDirectories="" 
    480                                                 PreprocessorDefinitions="" 
    481                                         /> 
    482                                 </FileConfiguration> 
    483                         </File> 
    484                         <File 
    485467                                RelativePath="..\src\pjmedia\echo_common.c" 
    486468                                > 
     
    747729                        </File> 
    748730                        <File 
    749                                 RelativePath="..\src\pjmedia\nullsound.c" 
    750                                 > 
    751                                 <FileConfiguration 
    752                                         Name="Release|Win32" 
    753                                         > 
    754                                         <Tool 
    755                                                 Name="VCCLCompilerTool" 
    756                                                 AdditionalIncludeDirectories="" 
    757                                                 PreprocessorDefinitions="" 
    758                                         /> 
    759                                 </FileConfiguration> 
    760                                 <FileConfiguration 
    761                                         Name="Debug|Win32" 
    762                                         > 
    763                                         <Tool 
    764                                                 Name="VCCLCompilerTool" 
    765                                                 AdditionalIncludeDirectories="" 
    766                                                 PreprocessorDefinitions="" 
    767                                         /> 
    768                                 </FileConfiguration> 
    769                         </File> 
    770                         <File 
    771                                 RelativePath="..\src\pjmedia\pasound.c" 
    772                                 > 
    773                                 <FileConfiguration 
    774                                         Name="Release|Win32" 
    775                                         > 
    776                                         <Tool 
    777                                                 Name="VCCLCompilerTool" 
    778                                                 AdditionalIncludeDirectories="" 
    779                                                 PreprocessorDefinitions="" 
    780                                         /> 
    781                                 </FileConfiguration> 
    782                                 <FileConfiguration 
    783                                         Name="Debug|Win32" 
    784                                         > 
    785                                         <Tool 
    786                                                 Name="VCCLCompilerTool" 
    787                                                 AdditionalIncludeDirectories="" 
    788                                                 PreprocessorDefinitions="" 
    789                                         /> 
    790                                 </FileConfiguration> 
    791                         </File> 
    792                         <File 
    793731                                RelativePath="..\src\pjmedia\plc_common.c" 
    794732                                > 
     
    1027965                        </File> 
    1028966                        <File 
     967                                RelativePath="..\src\pjmedia\sound_legacy.c" 
     968                                > 
     969                        </File> 
     970                        <File 
    1029971                                RelativePath="..\src\pjmedia\sound_port.c" 
    1030972                                > 
     
    12431185                                        /> 
    12441186                                </FileConfiguration> 
    1245                         </File> 
    1246                         <File 
    1247                                 RelativePath="..\src\pjmedia\wmme_sound.c" 
    1248                                 > 
    12491187                        </File> 
    12501188                        <File 
  • pjproject/trunk/pjmedia/build/pjmedia_codec.dsp

    r2358 r2506  
    148148# Begin Source File 
    149149 
     150SOURCE="..\src\pjmedia-codec\passthrough.c" 
     151# End Source File 
     152# Begin Source File 
     153 
    150154SOURCE="..\src\pjmedia-codec\speex_codec.c" 
    151155 
     
    190194 
    191195SOURCE="..\include\pjmedia-codec\l16.h" 
     196# End Source File 
     197# Begin Source File 
     198 
     199SOURCE="..\include\pjmedia-codec\passthrough.h" 
    192200# End Source File 
    193201# Begin Source File 
  • pjproject/trunk/pjmedia/build/pjmedia_codec.vcproj

    r2430 r2506  
    399399                        </File> 
    400400                        <File 
     401                                RelativePath="..\src\pjmedia-codec\passthrough.c" 
     402                                > 
     403                        </File> 
     404                        <File 
    401405                                RelativePath="..\src\pjmedia-codec\speex_codec.c" 
    402406                                > 
  • pjproject/trunk/pjmedia/include/pjmedia-codec.h

    r2394 r2506  
    3232#include <pjmedia-codec/g722.h> 
    3333#include <pjmedia-codec/ipp_codecs.h> 
     34#include <pjmedia-codec/passthrough.h> 
    3435 
    3536 
  • pjproject/trunk/pjmedia/include/pjmedia-codec/amr_helper.h

    r2394 r2506  
    633633 * @return          AMR mode. 
    634634 */ 
    635  
    636635PJ_INLINE(pj_int8_t) pjmedia_codec_amr_get_mode(unsigned bitrate) 
    637636{ 
     
    679678 
    680679/** 
     680 * Get AMR mode based on frame length. 
     681 * 
     682 * @param amrnb     Set to PJ_TRUE for AMR-NB domain or PJ_FALSE for AMR-WB. 
     683 * @param frame_len The frame length. 
     684 * 
     685 * @return          AMR mode. 
     686 */ 
     687 
     688PJ_INLINE(pj_int8_t) pjmedia_codec_amr_get_mode2(pj_bool_t amrnb, 
     689                                                 unsigned frame_len) 
     690{ 
     691    int i; 
     692 
     693    if (amrnb) { 
     694        for (i = 0; i < 9; ++i) 
     695            if (frame_len == pjmedia_codec_amrnb_framelen[i]) 
     696                return (pj_int8_t)i; 
     697    } else { 
     698        for (i = 0; i < 10; ++i) { 
     699            if (frame_len == pjmedia_codec_amrwb_framelen[i]) 
     700                return (pj_int8_t)i; 
     701        } 
     702    } 
     703     
     704    pj_assert(!"Invalid AMR frame length"); 
     705    return -1; 
     706} 
     707 
     708/** 
    681709 * Prepare a frame before pass it to decoder. This function will do: 
    682710 * - reorder AMR bitstream from descending sensitivity order into  
     
    795823        out_info->mode = FT_; 
    796824        out->size = 5; 
    797         PJ_ASSERT_RETURN(out->size <= in->size, PJMEDIA_CODEC_EFRMINLEN); 
    798825 
    799826        pj_bzero(out->buf, out->size); 
  • pjproject/trunk/pjmedia/include/pjmedia-codec/config.h

    r2394 r2506  
    195195#endif 
    196196 
     197/** 
     198 * Enable Passthrough codecs. 
     199 * 
     200 * Default: 0 
     201 */ 
     202#ifndef PJMEDIA_HAS_PASSTHROUGH_CODECS 
     203#   define PJMEDIA_HAS_PASSTHROUGH_CODECS       0 
     204#endif 
     205 
     206#ifndef PJMEDIA_HAS_PASSTHROUGH_CODEC_AMR 
     207#   define PJMEDIA_HAS_PASSTHROUGH_CODEC_AMR    1 
     208#endif 
     209 
     210#ifndef PJMEDIA_HAS_PASSTHROUGH_CODEC_G729 
     211#   define PJMEDIA_HAS_PASSTHROUGH_CODEC_G729   1 
     212#endif 
     213 
     214#ifndef PJMEDIA_HAS_PASSTHROUGH_CODEC_ILBC 
     215#   define PJMEDIA_HAS_PASSTHROUGH_CODEC_ILBC   1 
     216#endif 
     217 
     218#ifndef PJMEDIA_HAS_PASSTHROUGH_CODEC_PCMU 
     219#   define PJMEDIA_HAS_PASSTHROUGH_CODEC_PCMU   1 
     220#   undef PJMEDIA_HAS_G711_CODEC 
     221#endif 
     222 
     223#ifndef PJMEDIA_HAS_PASSTHROUGH_CODEC_PCMA 
     224#   define PJMEDIA_HAS_PASSTHROUGH_CODEC_PCMA   1 
     225#   undef PJMEDIA_HAS_G711_CODEC 
     226#endif 
    197227 
    198228#endif  /* __PJMEDIA_CODEC_CONFIG_H__ */ 
  • pjproject/trunk/pjmedia/include/pjmedia/alaw_ulaw.h

    r2416 r2506  
    145145 * @param dst       Destination buffer for 8-bit U-Law data. 
    146146 * @param src       Source, 16-bit linear PCM data. 
    147  * @param len       Number of samples. 
     147 * @param count     Number of samples. 
    148148 */ 
    149149PJ_INLINE(void) pjmedia_ulaw_encode(pj_uint8_t *dst, const pj_int16_t *src,  
    150                                     pj_size_t len) 
    151 { 
    152     const pj_int16_t *end = src + len; 
     150                                    pj_size_t count) 
     151{ 
     152    const pj_int16_t *end = src + count; 
    153153     
    154154    while (src < end) { 
     
    162162 * @param dst       Destination buffer for 8-bit A-Law data. 
    163163 * @param src       Source, 16-bit linear PCM data. 
    164  * @param len       Number of samples. 
     164 * @param count     Number of samples. 
    165165 */ 
    166166PJ_INLINE(void) pjmedia_alaw_encode(pj_uint8_t *dst, const pj_int16_t *src,  
    167                                     pj_size_t len) 
    168 { 
    169     const pj_int16_t *end = src + len; 
     167                                    pj_size_t count) 
     168{ 
     169    const pj_int16_t *end = src + count; 
    170170     
    171171    while (src < end) { 
     
    179179 * @param dst       Destination buffer for 16-bit PCM data. 
    180180 * @param src       Source, 8-bit U-Law data. 
    181  * @param len       Number of samples. 
     181 * @param len       Encoded frame/source length in bytes. 
    182182 */ 
    183183PJ_INLINE(void) pjmedia_ulaw_decode(pj_int16_t *dst, const pj_uint8_t *src,  
     
    196196 * @param dst       Destination buffer for 16-bit PCM data. 
    197197 * @param src       Source, 8-bit A-Law data. 
    198  * @param len       Number of samples. 
     198 * @param len       Encoded frame/source length in bytes. 
    199199 */ 
    200200PJ_INLINE(void) pjmedia_alaw_decode(pj_int16_t *dst, const pj_uint8_t *src,  
  • pjproject/trunk/pjmedia/include/pjmedia/codec.h

    r2394 r2506  
    276276       pj_uint8_t  pcm_bits_per_sample; /**< Bits/sample in the PCM side    */ 
    277277       pj_uint8_t  pt;                  /**< Payload type.                  */ 
     278       pjmedia_format_id fmt_id;        /**< Source format, it's format of 
     279                                             encoder input and decoder  
     280                                             output.                        */ 
    278281    } info; 
    279282 
  • pjproject/trunk/pjmedia/include/pjmedia/conference.h

    r2394 r2506  
    4444PJ_BEGIN_DECL 
    4545 
     46/** 
     47 * The conference bridge signature in pjmedia_port_info. 
     48 */ 
     49#define PJMEDIA_CONF_BRIDGE_SIGNATURE   \ 
     50                    PJMEDIA_PORT_SIGNATURE('C', 'O', 'N', 'F') 
     51 
     52/** 
     53 * The audio switchboard signature in pjmedia_port_info. 
     54 */ 
     55#define PJMEDIA_CONF_SWITCH_SIGNATURE   \ 
     56                    PJMEDIA_PORT_SIGNATURE('A', 'S', 'W', 'I') 
     57 
    4658 
    4759/** 
     
    5769    unsigned            slot;               /**< Slot number.               */ 
    5870    pj_str_t            name;               /**< Port name.                 */ 
     71    pjmedia_format      format;             /**< Format.                    */ 
    5972    pjmedia_port_op     tx_setting;         /**< Transmit settings.         */ 
    6073    pjmedia_port_op     rx_setting;         /**< Receive settings.          */ 
    6174    unsigned            listener_cnt;       /**< Number of listeners.       */ 
    6275    unsigned           *listener_slots;     /**< Array of listeners.        */ 
     76    unsigned            transmitter_cnt;    /**< Number of transmitter.     */ 
    6377    unsigned            clock_rate;         /**< Clock rate of the port.    */ 
    6478    unsigned            channel_count;      /**< Number of channels.        */ 
  • pjproject/trunk/pjmedia/include/pjmedia/config.h

    r2394 r2506  
    4545#endif 
    4646 
     47/** 
     48 * Specify whether we prefer to use audio switch board rather than  
     49 * conference bridge. 
     50 * 
     51 * Audio switch board is a kind of simplified version of conference  
     52 * bridge, but not really the subset of conference bridge. It has  
     53 * stricter rules on audio routing among the pjmedia ports and has 
     54 * no audio mixing capability. The power of it is it could work with 
     55 * encoded audio frames where conference brigde couldn't. 
     56 * 
     57 * Default: 0 
     58 */ 
     59#ifndef PJMEDIA_CONF_USE_SWITCH_BOARD 
     60#   define PJMEDIA_CONF_USE_SWITCH_BOARD    0 
     61#endif 
     62 
    4763/* 
    4864 * Types of sound stream backends. 
    4965 */ 
    5066 
    51 /** Constant for NULL sound backend. */ 
    52 #define PJMEDIA_SOUND_NULL_SOUND            0 
    53  
    54 /** Constant for PortAudio sound backend. */ 
    55 #define PJMEDIA_SOUND_PORTAUDIO_SOUND       1 
    56  
    57 /** Constant for Win32 DirectSound sound backend. */ 
    58 #define PJMEDIA_SOUND_WIN32_DIRECT_SOUND    2 
    59  
    60 /** Constant for Win32 MME sound backend. */ 
    61 #define PJMEDIA_SOUND_WIN32_MME_SOUND       3 
    62  
    63 /** When this is set, pjmedia will not provide any sound device backend.  
    64  *  Application will have to provide its own sound device backend 
    65  *  and link the application with it. 
    66  */ 
    67 #define PJMEDIA_SOUND_EXTERNAL              255 
    68  
    69  
    70 /** 
    71  * Unless specified otherwise, sound device uses PortAudio implementation 
    72  * by default. 
    73  */ 
    74 #ifndef PJMEDIA_SOUND_IMPLEMENTATION 
    75 #  if defined(PJ_WIN32) && PJ_WIN32!=0 
    76 /*#   define PJMEDIA_SOUND_IMPLEMENTATION   PJMEDIA_SOUND_WIN32_DIRECT_SOUND*/ 
    77 /*#   define PJMEDIA_SOUND_IMPLEMENTATION   PJMEDIA_SOUND_WIN32_MME_SOUND*/ 
    78 #   define PJMEDIA_SOUND_IMPLEMENTATION     PJMEDIA_SOUND_PORTAUDIO_SOUND 
    79 #  else 
    80 #   define PJMEDIA_SOUND_IMPLEMENTATION     PJMEDIA_SOUND_PORTAUDIO_SOUND 
    81 #  endif 
    82 #endif 
    83  
    84  
    85 /** 
    86  * Specify whether we prefer to use DirectSound on Windows. 
    87  * 
    88  * Default: 0 
    89  */ 
    90 #ifndef PJMEDIA_PREFER_DIRECT_SOUND 
    91 #   define PJMEDIA_PREFER_DIRECT_SOUND      0 
    92 #endif 
    93  
    94  
    95 /** 
    96  * Specify sound device latency default, in milisecond. 
     67/** 
     68 * This macro has been deprecated in releasee 1.1. Please see 
     69 * http://trac.pjsip.org/repos/wiki/Audio_Dev_API for more information. 
     70 */ 
     71#if defined(PJMEDIA_SOUND_IMPLEMENTATION) 
     72#   error PJMEDIA_SOUND_IMPLEMENTATION has been deprecated 
     73#endif 
     74 
     75/** 
     76 * This macro has been deprecated in releasee 1.1. Please see 
     77 * http://trac.pjsip.org/repos/wiki/Audio_Dev_API for more information. 
     78 */ 
     79#if defined(PJMEDIA_PREFER_DIRECT_SOUND) 
     80#   error PJMEDIA_PREFER_DIRECT_SOUND has been deprecated 
     81#endif 
     82 
     83/** 
     84 * This macro controls whether the legacy sound device API is to be 
     85 * implemented, for applications that still use the old sound device 
     86 * API (sound.h). If this macro is set to non-zero, the sound_legacy.c 
     87 * will be included in the compilation. The sound_legacy.c is an 
     88 * implementation of old sound device (sound.h) using the new Audio 
     89 * Device API. 
     90 * 
     91 * Please see http://trac.pjsip.org/repos/wiki/Audio_Dev_API for more 
     92 * info. 
     93 */ 
     94#ifndef PJMEDIA_HAS_LEGACY_SOUND_API 
     95#   define PJMEDIA_HAS_LEGACY_SOUND_API     1 
     96#endif 
     97 
     98/** 
     99 * Specify default sound device latency, in milisecond. 
    97100 */ 
    98101#ifndef PJMEDIA_SND_DEFAULT_REC_LATENCY 
     
    100103#endif 
    101104 
     105/** 
     106 * Specify default sound device latency, in milisecond. 
     107 */ 
    102108#ifndef PJMEDIA_SND_DEFAULT_PLAY_LATENCY 
    103109#   define PJMEDIA_SND_DEFAULT_PLAY_LATENCY 100 
    104 #endif 
    105  
    106  
    107 /** 
    108  * Specify whether delay buffer is used for sound device. 
    109  * When delay buffer is enabled, the sound device callback  
    110  * will be called one after another evenly. 
    111  * The delay buffer also performs the best delay calculation 
    112  * for the sound device, and will try to limit the delay caused 
    113  * by uneven callback calls to this delay. 
    114  * 
    115  * When this setting is enabled, the PJMEDIA_SOUND_BUFFER_COUNT 
    116  * macro will specify the maximum size of the delay buffer. 
    117  */ 
    118 #ifndef PJMEDIA_SOUND_USE_DELAYBUF 
    119 #   define PJMEDIA_SOUND_USE_DELAYBUF       0 
    120110#endif 
    121111 
     
    286276 */ 
    287277#ifndef PJMEDIA_FILE_PORT_BUFSIZE 
    288 #   define PJMEDIA_FILE_PORT_BUFSIZE    4000 
     278#   define PJMEDIA_FILE_PORT_BUFSIZE            4000 
    289279#endif 
    290280 
  • pjproject/trunk/pjmedia/include/pjmedia/endpoint.h

    r2394 r2506  
    3838 */ 
    3939 
    40 #include <pjmedia/sound.h> 
    4140#include <pjmedia/codec.h> 
    4241#include <pjmedia/sdp.h> 
  • pjproject/trunk/pjmedia/include/pjmedia/port.h

    r2394 r2506  
    2626 */ 
    2727#include <pjmedia/types.h> 
     28#include <pj/assert.h> 
    2829#include <pj/os.h> 
    2930 
     
    212213    pj_bool_t       need_info;          /**< Need info on connect?          */ 
    213214    unsigned        pt;                 /**< Payload type (can be dynamic). */ 
     215    pjmedia_format  format;             /**< Format.                        */ 
    214216    pj_str_t        encoding_name;      /**< Encoding name.                 */ 
    215217    unsigned        clock_rate;         /**< Sampling rate.                 */ 
     
    221223 
    222224 
    223 /**  
    224  * Types of media frame.  
    225  */ 
    226 typedef enum pjmedia_frame_type 
    227 { 
    228     PJMEDIA_FRAME_TYPE_NONE,        /**< No frame.              */ 
    229     PJMEDIA_FRAME_TYPE_AUDIO        /**< Normal audio frame.    */ 
    230  
    231 } pjmedia_frame_type; 
    232  
    233  
    234 /**  
    235  * This structure describes a media frame.  
    236  */ 
    237 typedef struct pjmedia_frame 
    238 { 
    239     pjmedia_frame_type   type;      /**< Frame type.                        */ 
    240     void                *buf;       /**< Pointer to buffer.                 */ 
    241     pj_size_t            size;      /**< Frame size in bytes.               */ 
    242     pj_timestamp         timestamp; /**< Frame timestamp.                   */ 
    243     pj_uint32_t          bit_info;  /**< Bit info of the frame, sample case: 
    244                                          a frame may not exactly start and end 
    245                                          at the octet boundary, so this field  
    246                                          may be used for specifying start &  
    247                                          end bit offset.                    */ 
    248 } pjmedia_frame; 
    249  
    250  
    251225/** 
    252226 * Port interface. 
  • pjproject/trunk/pjmedia/include/pjmedia/sound.h

    r2394 r2506  
    2424/** 
    2525 * @file sound.h 
    26  * @brief Sound player and recorder device framework. 
    27  */ 
     26 * @brief Legacy sound device API 
     27 */ 
     28#include <pjmedia-audiodev/audiodev.h> 
    2829#include <pjmedia/types.h> 
    29 #include <pj/pool.h> 
     30 
    3031 
    3132PJ_BEGIN_DECL 
     
    3637 * @brief PJMEDIA abstraction for sound device hardware 
    3738 * @{ 
     39 * 
     40 * <strong>Warning: this sound device API has been deprecated 
     41 * and replaced by PJMEDIA Audio Device API. Please see 
     42 * http://trac.pjsip.org/repos/wiki/Audio_Dev_API for more 
     43 * information.</strong> 
    3844 * 
    3945 * This section describes lower level abstraction for sound device 
     
    6268 */ 
    6369 
    64 /** Opaque data type for audio stream. */ 
     70/** Opaque declaration for pjmedia_snd_stream. */ 
    6571typedef struct pjmedia_snd_stream pjmedia_snd_stream; 
    6672 
     
    9298    unsigned    play_latency;       /**< Playback latency, in samples.      */ 
    9399} pjmedia_snd_stream_info; 
    94  
    95100 
    96101/**  
  • pjproject/trunk/pjmedia/include/pjmedia/sound_port.h

    r2394 r2506  
    2525 * @brief Media port connection abstraction to sound device. 
    2626 */ 
    27 #include <pjmedia/sound.h> 
     27#include <pjmedia-audiodev/audiodev.h> 
    2828#include <pjmedia/port.h> 
    2929 
     
    160160                                                    unsigned options, 
    161161                                                    pjmedia_snd_port **p_port); 
    162                                                
     162 
     163 
     164/** 
     165 * Create sound device port according to the specified parameters. 
     166 * 
     167 * @param pool              Pool to allocate sound port structure. 
     168 * @param prm               Sound device settings. 
     169 * @param p_port            Pointer to receive the sound device port instance. 
     170 * 
     171 * @return                  PJ_SUCCESS on success, or the appropriate error 
     172 *                          code. 
     173 */ 
     174PJ_DECL(pj_status_t) pjmedia_snd_port_create2(pj_pool_t *pool, 
     175                                              const pjmedia_aud_param *prm, 
     176                                              pjmedia_snd_port **p_port); 
     177 
    163178 
    164179/** 
     
    180195 * @return                  The sound stream instance. 
    181196 */ 
    182 PJ_DECL(pjmedia_snd_stream*) pjmedia_snd_port_get_snd_stream( 
     197PJ_DECL(pjmedia_aud_stream*) pjmedia_snd_port_get_snd_stream( 
    183198                                                pjmedia_snd_port *snd_port); 
    184199 
    185200 
    186201/** 
    187  * Configure the echo cancellation tail length. By default, echo canceller 
    188  * is enabled in the sound device with the default tail length. After the 
    189  * sound port is created, application can query the current echo canceller 
    190  * tail length by calling #pjmedia_snd_port_get_ec_tail. 
    191  * 
    192  * Note that you should only change the EC settings when the sound port 
    193  * is not connected to any downstream ports, otherwise race condition may 
    194  * occur. 
     202 * Change the echo cancellation settings. The echo cancellation settings  
     203 * should have been specified when this sound port was created, by setting 
     204 * the appropriate fields in the pjmedia_aud_param, because not all sound 
     205 * device implementation supports changing the EC setting once the device 
     206 * has been opened. 
     207 * 
     208 * The behavior of this function depends on whether device or software AEC 
     209 * is being used. If the device supports AEC, this function will forward 
     210 * the change request to the device and it will be up to the device whether 
     211 * to support the request. If software AEC is being used (the software EC 
     212 * will be used if the device does not support AEC), this function will 
     213 * change the software EC settings. 
    195214 * 
    196215 * @param snd_port          The sound device port. 
     
    200219 *                          be disabled. 
    201220 * @param options           The options to be passed to #pjmedia_echo_create(). 
     221 *                          This is only used if software EC is being used. 
    202222 * 
    203223 * @return                  PJ_SUCCESS on success. 
  • pjproject/trunk/pjmedia/include/pjmedia/stream.h

    r2394 r2506  
    2727 */ 
    2828 
    29 #include <pjmedia/sound.h> 
    3029#include <pjmedia/codec.h> 
    3130#include <pjmedia/endpoint.h> 
  • pjproject/trunk/pjmedia/include/pjmedia/symbian_sound_aps.h

    r2394 r2506  
    3232 
    3333/** 
    34  * Activate/deactivate loudspeaker, when loudspeaker is inactive, audio 
    35  * will be routed to earpiece. 
     34 * Set audio routing for APS sound device. 
    3635 * 
    3736 * @param stream        The sound device stream, the stream should be started  
    38  *                      before calling this function. This param can be NULL 
    39  *                      to set the behaviour of next opened stream. 
    40  * @param active        Specify PJ_TRUE to activate loudspeaker, and PJ_FALSE 
    41  *                      otherwise. 
     37 *                      before calling this function. 
     38 * @param route         Audio routing to be set. 
    4239 * 
    4340 * @return              PJ_SUCCESS on success. 
    4441 */ 
    45 PJ_DECL(pj_status_t) pjmedia_snd_aps_activate_loudspeaker( 
    46                                                 pjmedia_snd_stream *stream, 
    47                                                 pj_bool_t active); 
    48  
     42PJ_DECL(pj_status_t) pjmedia_snd_aps_set_route( pjmedia_snd_stream *stream, 
     43                                                pjmedia_snd_route route); 
    4944 
    5045PJ_END_DECL 
  • pjproject/trunk/pjmedia/include/pjmedia/types.h

    r2394 r2506  
    4848 */ 
    4949 
    50 /**  
    51  * Top most media type.  
     50/** 
     51 * Top most media type. 
    5252 */ 
    5353typedef enum pjmedia_type 
     
    6262    PJMEDIA_TYPE_VIDEO = 2, 
    6363 
    64     /** Unknown media type, in this case the name will be specified in  
     64    /** Unknown media type, in this case the name will be specified in 
    6565     *  encoding_name. 
    6666     */ 
     
    7373 
    7474 
    75 /**  
    76  * Media transport protocol.  
     75/** 
     76 * Media transport protocol. 
    7777 */ 
    7878typedef enum pjmedia_tp_proto 
     
    9393 
    9494 
    95 /**  
    96  * Media direction.  
     95/** 
     96 * Media direction. 
    9797 */ 
    9898typedef enum pjmedia_dir 
     
    139139 
    140140 
    141 /**  
    142  * Opague declaration of media endpoint.  
     141/** 
     142 * Opaque declaration of media endpoint. 
    143143 */ 
    144144typedef struct pjmedia_endpt pjmedia_endpt; 
     
    151151 
    152152 
    153 /**  
     153/** 
    154154 * Media socket info is used to describe the underlying sockets 
    155155 * to be used as media transport. 
     
    181181 
    182182/** 
     183 * Macro for packing format. 
     184 */ 
     185#define PJMEDIA_FORMAT_PACK(C1, C2, C3, C4) ( C4<<24 | C3<<16 | C2<<8 | C1 ) 
     186 
     187/** 
     188 * This enumeration describes format ID.  
     189 */ 
     190typedef enum pjmedia_format_id 
     191{ 
     192    /** 
     193     * 16bit linear 
     194     */ 
     195    PJMEDIA_FORMAT_L16      = 0, 
     196     
     197    /** 
     198     * Alias for PJMEDIA_FORMAT_L16 
     199     */ 
     200    PJMEDIA_FORMAT_PCM      = PJMEDIA_FORMAT_L16, 
     201 
     202    /** 
     203     * G.711 ALAW 
     204     */ 
     205    PJMEDIA_FORMAT_PCMA     = PJMEDIA_FORMAT_PACK('A', 'L', 'A', 'W'), 
     206 
     207    /** 
     208     * Alias for PJMEDIA_FORMAT_PCMA 
     209     */ 
     210    PJMEDIA_FORMAT_ALAW     = PJMEDIA_FORMAT_PCMA, 
     211 
     212    /** 
     213     * G.711 ULAW 
     214     */ 
     215    PJMEDIA_FORMAT_PCMU     = PJMEDIA_FORMAT_PACK('u', 'L', 'A', 'W'), 
     216 
     217    /** 
     218     * Aliaw for PJMEDIA_FORMAT_PCMU 
     219     */ 
     220    PJMEDIA_FORMAT_ULAW     = PJMEDIA_FORMAT_PCMU, 
     221 
     222    /** 
     223     * AMR narrowband 
     224     */ 
     225    PJMEDIA_FORMAT_AMR      = PJMEDIA_FORMAT_PACK(' ', 'A', 'M', 'R'), 
     226 
     227    /** 
     228     * ITU G.729 
     229     */ 
     230    PJMEDIA_FORMAT_G729     = PJMEDIA_FORMAT_PACK('G', '7', '2', '9'), 
     231 
     232    /** 
     233     * Internet Low Bit-Rate Codec (ILBC) 
     234     */ 
     235    PJMEDIA_FORMAT_ILBC     = PJMEDIA_FORMAT_PACK('I', 'L', 'B', 'C') 
     236 
     237} pjmedia_format_id; 
     238 
     239 
     240/** 
     241 * Media format information. 
     242 */ 
     243typedef struct pjmedia_format 
     244{ 
     245    /** Format ID */ 
     246    pjmedia_format_id   id; 
     247 
     248    /** Bitrate. */ 
     249    pj_uint32_t         bitrate; 
     250 
     251    /** Flag to indicate whether VAD is enabled */ 
     252    pj_bool_t           vad; 
     253 
     254} pjmedia_format; 
     255 
     256 
     257 
     258/** 
    183259 * This is a general purpose function set PCM samples to zero. 
    184  * Since this function is needed by many parts of the library,  
     260 * Since this function is needed by many parts of the library, 
    185261 * by putting this functionality in one place, it enables some. 
    186262 * clever people to optimize this function. 
     
    206282/** 
    207283 * This is a general purpose function to copy samples from/to buffers with 
    208  * equal size. Since this function is needed by many parts of the library,  
     284 * equal size. Since this function is needed by many parts of the library, 
    209285 * by putting this functionality in one place, it enables some. 
    210286 * clever people to optimize this function. 
     
    221297    unsigned i; 
    222298    count >>= 1; 
    223     for (i=0; i<count; ++i)  
     299    for (i=0; i<count; ++i) 
    224300        ((pj_int32_t*)dst)[i] = ((pj_int32_t*)src)[i]; 
    225301#endif 
     
    229305/** 
    230306 * This is a general purpose function to copy samples from/to buffers with 
    231  * equal size. Since this function is needed by many parts of the library,  
     307 * equal size. Since this function is needed by many parts of the library, 
    232308 * by putting this functionality in one place, it enables some. 
    233309 * clever people to optimize this function. 
     
    244320    unsigned i; 
    245321    count >>= 1; 
    246     for (i=0; i<count; ++i)  
     322    for (i=0; i<count; ++i) 
    247323        ((pj_int32_t*)dst)[i] = ((pj_int32_t*)src)[i]; 
    248324#endif 
    249325} 
    250326 
     327/**  
     328 * Types of media frame.  
     329 */ 
     330typedef enum pjmedia_frame_type 
     331{ 
     332    PJMEDIA_FRAME_TYPE_NONE,        /**< No frame.              */ 
     333    PJMEDIA_FRAME_TYPE_AUDIO,       /**< Normal audio frame.    */ 
     334    PJMEDIA_FRAME_TYPE_EXTENDED     /**< Extended audio frame.  */ 
     335 
     336} pjmedia_frame_type; 
     337 
     338 
     339/**  
     340 * This structure describes a media frame.  
     341 */ 
     342typedef struct pjmedia_frame 
     343{ 
     344    pjmedia_frame_type   type;      /**< Frame type.                        */ 
     345    void                *buf;       /**< Pointer to buffer.                 */ 
     346    pj_size_t            size;      /**< Frame size in bytes.               */ 
     347    pj_timestamp         timestamp; /**< Frame timestamp.                   */ 
     348    pj_uint32_t          bit_info;  /**< Bit info of the frame, sample case: 
     349                                         a frame may not exactly start and end 
     350                                         at the octet boundary, so this field  
     351                                         may be used for specifying start &  
     352                                         end bit offset.                    */ 
     353} pjmedia_frame; 
     354 
     355 
     356/** 
     357 * The pjmedia_frame_ext is used to carry a more complex audio frames than 
     358 * the typical PCM audio frames, and it is signaled by setting the "type" 
     359 * field of a pjmedia_frame to PJMEDIA_FRAME_TYPE_EXTENDED. With this set, 
     360 * application may typecast pjmedia_frame to pjmedia_frame_ext. 
     361 * 
     362 * This structure may contain more than one audio frames, which subsequently 
     363 * will be called subframes in this structure. The subframes section 
     364 * immediately follows the end of this structure, and each subframe is 
     365 * represented by pjmedia_frame_ext_subframe structure. Every next 
     366 * subframe immediately follows the previous subframe, and all subframes 
     367 * are byte-aligned although its payload may not be byte-aligned. 
     368 */ 
     369 
     370#pragma pack(1) 
     371typedef struct pjmedia_frame_ext { 
     372    pjmedia_frame   base;           /**< Base frame info */ 
     373    pj_uint16_t     samples_cnt;    /**< Number of samples in this frame */ 
     374    pj_uint16_t     subframe_cnt;   /**< Number of (sub)frames in this frame */ 
     375 
     376    /* Zero or more (sub)frames follows immediately after this, 
     377     * each will be represented by pjmedia_frame_ext_subframe 
     378     */ 
     379} pjmedia_frame_ext; 
     380#pragma pack() 
     381 
     382/** 
     383 * This structure represents the individual subframes in the 
     384 * pjmedia_frame_ext structure. 
     385 */ 
     386#pragma pack(1) 
     387typedef struct pjmedia_frame_ext_subframe { 
     388    pj_uint16_t     bitlen;         /**< Number of bits in the data */ 
     389    pj_uint8_t      data[1];        /**< Start of encoded data */ 
     390} pjmedia_frame_ext_subframe; 
     391 
     392#pragma pack() 
     393 
     394 
     395/** 
     396 * Append one subframe to #pjmedia_frame_ext. 
     397 * 
     398 * @param frm               The #pjmedia_frame_ext. 
     399 * @param src               Subframe data. 
     400 * @param bitlen            Lenght of subframe, in bits. 
     401 * @param samples_cnt       Number of audio samples in subframe. 
     402 */ 
     403PJ_INLINE(void) pjmedia_frame_ext_append_subframe(pjmedia_frame_ext *frm, 
     404                                                  const void *src, 
     405                                                  unsigned bitlen, 
     406                                                  unsigned samples_cnt) 
     407{ 
     408    pjmedia_frame_ext_subframe *fsub; 
     409    pj_uint8_t *p; 
     410    unsigned i; 
     411 
     412    p = (pj_uint8_t*)frm + sizeof(pjmedia_frame_ext); 
     413    for (i = 0; i < frm->subframe_cnt; ++i) { 
     414        fsub = (pjmedia_frame_ext_subframe*) p; 
     415        p += sizeof(fsub->bitlen) + ((fsub->bitlen+7) >> 3); 
     416    } 
     417 
     418    fsub = (pjmedia_frame_ext_subframe*) p; 
     419    fsub->bitlen = (pj_uint16_t)bitlen; 
     420    if (bitlen) 
     421        pj_memcpy(fsub->data, src, (bitlen+7) >> 3); 
     422 
     423    frm->subframe_cnt++; 
     424    frm->samples_cnt = (pj_uint16_t)(frm->samples_cnt + samples_cnt); 
     425} 
     426 
     427/** 
     428 * Get a subframe from #pjmedia_frame_ext. 
     429 * 
     430 * @param frm               The #pjmedia_frame_ext. 
     431 * @param n                 Subframe index, zero based. 
     432 * 
     433 * @return                  The n-th subframe, or NULL if n is out-of-range. 
     434 */ 
     435PJ_INLINE(pjmedia_frame_ext_subframe*)  
     436pjmedia_frame_ext_get_subframe(const pjmedia_frame_ext *frm, unsigned n) 
     437{ 
     438    pjmedia_frame_ext_subframe *sf = NULL; 
     439 
     440    if (n < frm->subframe_cnt) { 
     441        pj_uint8_t *p; 
     442        unsigned i; 
     443 
     444        p = (pj_uint8_t*)frm + sizeof(pjmedia_frame_ext); 
     445        for (i = 0; i < n; ++i) {        
     446            sf = (pjmedia_frame_ext_subframe*) p; 
     447            p += sizeof(sf->bitlen) + ((sf->bitlen+7) >> 3); 
     448        } 
     449         
     450        sf = (pjmedia_frame_ext_subframe*) p; 
     451    } 
     452 
     453    return sf; 
     454} 
     455         
     456/** 
     457 * Extract all frame payload to the specified buffer.  
     458 * 
     459 * @param frm               The frame. 
     460 * @param dst               Destination buffer. 
     461 * @param maxsize           Maximum size to copy (i.e. the size of the 
     462 *                          destination buffer). 
     463 * 
     464 * @return                  Total size of payload copied. 
     465 */ 
     466PJ_INLINE(unsigned)  
     467pjmedia_frame_ext_copy_payload(const pjmedia_frame_ext *frm, 
     468                               void *dst,  
     469                               unsigned maxlen) 
     470{ 
     471    unsigned i, copied=0; 
     472    for (i=0; i<frm->subframe_cnt; ++i) { 
     473        pjmedia_frame_ext_subframe *sf; 
     474        unsigned sz; 
     475 
     476        sf = pjmedia_frame_ext_get_subframe(frm, i); 
     477        if (!sf) 
     478            continue; 
     479 
     480        sz = ((sf->bitlen + 7) >> 3); 
     481        if (sz + copied > maxlen) 
     482            break; 
     483 
     484        pj_memcpy(((pj_uint8_t*)dst) + copied, sf->data, sz); 
     485        copied += sz; 
     486    } 
     487    return copied; 
     488} 
     489 
     490 
     491/** 
     492 * Pop out first n subframes from #pjmedia_frame_ext. 
     493 * 
     494 * @param frm               The #pjmedia_frame_ext. 
     495 * @param n                 Number of first subframes to be popped out. 
     496 * 
     497 * @return                  PJ_SUCCESS when successful. 
     498 */ 
     499PJ_INLINE(pj_status_t)  
     500pjmedia_frame_ext_pop_subframes(pjmedia_frame_ext *frm, unsigned n) 
     501{ 
     502    pjmedia_frame_ext_subframe *sf; 
     503    pj_uint8_t *move_src; 
     504    unsigned move_len; 
     505 
     506    if (frm->subframe_cnt <= n) { 
     507        frm->subframe_cnt = 0; 
     508        frm->samples_cnt = 0; 
     509        return PJ_SUCCESS; 
     510    } 
     511 
     512    move_src = (pj_uint8_t*)pjmedia_frame_ext_get_subframe(frm, n); 
     513    sf = pjmedia_frame_ext_get_subframe(frm, frm->subframe_cnt-1); 
     514    move_len = (pj_uint8_t*)sf - move_src + sizeof(sf->bitlen) +  
     515               ((sf->bitlen+7) >> 3); 
     516    pj_memmove((pj_uint8_t*)frm+sizeof(pjmedia_frame_ext),  
     517               move_src, move_len); 
     518             
     519    frm->samples_cnt = (pj_uint16_t) 
     520                   (frm->samples_cnt - n*frm->samples_cnt/frm->subframe_cnt); 
     521    frm->subframe_cnt = (pj_uint16_t) (frm->subframe_cnt - n); 
     522 
     523    return PJ_SUCCESS; 
     524} 
     525 
     526 
    251527/** 
    252528 * @} 
  • pjproject/trunk/pjmedia/src/pjmedia-audiodev/wmme_dev.c

    r2504 r2506  
    3737#ifdef _MSC_VER 
    3838#   pragma warning(pop) 
     39#endif 
     40 
     41/* mingw lacks WAVE_FORMAT_ALAW/MULAW */ 
     42#ifndef WAVE_FORMAT_ALAW 
     43#   define  WAVE_FORMAT_ALAW       0x0006 
     44#endif 
     45#ifndef WAVE_FORMAT_MULAW 
     46#   define  WAVE_FORMAT_MULAW      0x0007 
    3947#endif 
    4048 
  • pjproject/trunk/pjmedia/src/pjmedia/conference.c

    r2394 r2506  
    3434#include <pj/string.h> 
    3535 
     36#if !defined(PJMEDIA_CONF_USE_SWITCH_BOARD) || PJMEDIA_CONF_USE_SWITCH_BOARD==0 
    3637 
    3738/* CONF_DEBUG enables detailed operation of the conference bridge. 
     
    6465#define BYTES_PER_SAMPLE    2 
    6566 
    66 #define SIGNATURE           PJMEDIA_PORT_SIGNATURE('C', 'O', 'N', 'F') 
     67#define SIGNATURE           PJMEDIA_CONF_BRIDGE_SIGNATURE 
    6768#define SIGNATURE_PORT      PJMEDIA_PORT_SIGNATURE('C', 'O', 'N', 'P') 
    6869/* Normal level is hardcodec to 128 in all over places */ 
     
    465466 
    466467    if ((conf->options & PJMEDIA_CONF_NO_DEVICE) == 0) { 
    467         pjmedia_snd_stream *strm; 
    468         pjmedia_snd_stream_info si; 
     468        pjmedia_aud_stream *strm; 
     469        pjmedia_aud_param param; 
    469470 
    470471        /* 
     
    494495 
    495496        strm = pjmedia_snd_port_get_snd_stream(conf->snd_dev_port); 
    496         status = pjmedia_snd_stream_get_info(strm, &si); 
     497        status = pjmedia_aud_stream_get_param(strm, &param); 
    497498        if (status == PJ_SUCCESS) { 
    498             const pjmedia_snd_dev_info *snd_dev_info; 
     499            pjmedia_aud_dev_info snd_dev_info; 
    499500            if (conf->options & PJMEDIA_CONF_NO_MIC) 
    500                 snd_dev_info = pjmedia_snd_get_dev_info(si.play_id); 
     501                pjmedia_aud_dev_get_info(param.play_id, &snd_dev_info); 
    501502            else 
    502                 snd_dev_info = pjmedia_snd_get_dev_info(si.rec_id); 
    503             pj_strdup2_with_null(pool, &conf_port->name, snd_dev_info->name); 
     503                pjmedia_aud_dev_get_info(param.rec_id, &snd_dev_info); 
     504            pj_strdup2_with_null(pool, &conf_port->name, snd_dev_info.name); 
    504505        } 
    505506    } 
     
    11711172    info->listener_cnt = conf_port->listener_cnt; 
    11721173    info->listener_slots = conf_port->listener_slots; 
     1174    info->transmitter_cnt = conf_port->transmitter_cnt; 
    11731175    info->clock_rate = conf_port->clock_rate; 
    11741176    info->channel_count = conf_port->channel_count; 
     
    19881990} 
    19891991 
     1992#endif 
  • pjproject/trunk/pjmedia/src/pjmedia/endpoint.c

    r2394 r2506  
    2121#include <pjmedia/errno.h> 
    2222#include <pjmedia/sdp.h> 
     23#include <pjmedia-audiodev/audiodev.h> 
    2324#include <pj/assert.h> 
    2425#include <pj/ioqueue.h> 
     
    122123 
    123124    /* Sound */ 
    124     status = pjmedia_snd_init(pf); 
     125    status = pjmedia_aud_subsys_init(pf); 
    125126    if (status != PJ_SUCCESS) 
    126127        goto on_error; 
     
    172173        pj_ioqueue_destroy(endpt->ioqueue); 
    173174 
    174     pjmedia_snd_deinit(); 
     175    pjmedia_aud_subsys_shutdown(); 
    175176    pj_pool_release(pool); 
    176177    return status; 
     
    213214    endpt->pf = NULL; 
    214215 
    215     pjmedia_snd_deinit(); 
     216    pjmedia_aud_subsys_shutdown(); 
    216217    pj_pool_release (endpt->pool); 
    217218 
  • pjproject/trunk/pjmedia/src/pjmedia/errno.c

    r2394 r2506  
    2121#include <pjmedia/types.h> 
    2222#include <pj/string.h> 
    23 #if PJMEDIA_SOUND_IMPLEMENTATION == PJMEDIA_SOUND_PORTAUDIO_SOUND 
     23#if defined(PJMEDIA_SOUND_IMPLEMENTATION) && \ 
     24    PJMEDIA_SOUND_IMPLEMENTATION == PJMEDIA_SOUND_PORTAUDIO_SOUND 
    2425#   include <portaudio.h> 
    2526#endif 
     
    180181 
    181182    /* See if the error comes from PortAudio. */ 
    182 #if PJMEDIA_SOUND_IMPLEMENTATION==PJMEDIA_SOUND_PORTAUDIO_SOUND 
     183#if defined(PJMEDIA_SOUND_IMPLEMENTATION) && \ 
     184    PJMEDIA_SOUND_IMPLEMENTATION == PJMEDIA_SOUND_PORTAUDIO_SOUND 
    183185    if (statcode >= PJMEDIA_PORTAUDIO_ERRNO_START && 
    184186        statcode <= PJMEDIA_PORTAUDIO_ERRNO_END) 
  • pjproject/trunk/pjmedia/src/pjmedia/sound_port.c

    r2394 r2506  
    1919 */ 
    2020#include <pjmedia/sound_port.h> 
     21#include <pjmedia/alaw_ulaw.h> 
    2122#include <pjmedia/delaybuf.h> 
    2223#include <pjmedia/echo.h> 
    2324#include <pjmedia/errno.h> 
    24 #include <pjmedia/plc.h> 
    2525#include <pj/assert.h> 
    2626#include <pj/log.h> 
     
    2828#include <pj/string.h>      /* pj_memset() */ 
    2929 
    30 //#define SIMULATE_LOST_PCT   20 
    3130#define AEC_TAIL            128     /* default AEC length in ms */ 
    3231#define AEC_SUSPEND_LIMIT   5       /* seconds of no activity   */ 
     
    3635//#define TEST_OVERFLOW_UNDERFLOW 
    3736 
    38 enum 
    39 { 
    40     PJMEDIA_PLC_ENABLED     = 1, 
    41 }; 
    42  
    43 //#define DEFAULT_OPTIONS       PJMEDIA_PLC_ENABLED 
    44 #define DEFAULT_OPTIONS     0 
    45  
    46  
    4737struct pjmedia_snd_port 
    4838{ 
    4939    int                  rec_id; 
    5040    int                  play_id; 
    51     pjmedia_snd_stream  *snd_stream; 
     41    pj_uint32_t          aud_caps; 
     42    pjmedia_aud_param    aud_param; 
     43    pjmedia_aud_stream  *aud_stream; 
    5244    pjmedia_dir          dir; 
    5345    pjmedia_port        *port; 
    54     unsigned             options; 
    55  
    56     pjmedia_echo_state  *ec_state; 
    57     unsigned             aec_tail_len; 
    58  
    59     pj_bool_t            ec_suspended; 
    60     unsigned             ec_suspend_count; 
    61     unsigned             ec_suspend_limit; 
    62  
    63     pjmedia_plc         *plc; 
    6446 
    6547    unsigned             clock_rate; 
     
    6850    unsigned             bits_per_sample; 
    6951 
    70 #if PJMEDIA_SOUND_USE_DELAYBUF 
    71     pjmedia_delay_buf   *delay_buf; 
    72 #endif 
     52    /* software ec */ 
     53    pjmedia_echo_state  *ec_state; 
     54    unsigned             ec_options; 
     55    unsigned             ec_tail_len; 
     56    pj_bool_t            ec_suspended; 
     57    unsigned             ec_suspend_count; 
     58    unsigned             ec_suspend_limit; 
    7359}; 
    7460 
     
    7763 * played. 
    7864 */ 
    79 static pj_status_t play_cb(/* in */   void *user_data, 
    80                            /* in */   pj_uint32_t timestamp, 
    81                            /* out */  void *output, 
    82                            /* out */  unsigned size) 
     65static pj_status_t play_cb(void *user_data, pjmedia_frame *frame) 
    8366{ 
    8467    pjmedia_snd_port *snd_port = (pjmedia_snd_port*) user_data; 
    8568    pjmedia_port *port; 
    86     pjmedia_frame frame; 
     69    unsigned required_size = frame->size; 
    8770    pj_status_t status; 
    8871 
    89     /* We're risking accessing the port without holding any mutex. 
    90      * It's possible that port is disconnected then destroyed while 
    91      * we're trying to access it. 
    92      * But in the name of performance, we'll try this approach until 
    93      * someone complains when it crashes. 
    94      */ 
    9572    port = snd_port->port; 
    9673    if (port == NULL) 
    9774        goto no_frame; 
    9875 
    99     frame.buf = output; 
    100     frame.size = size; 
    101     frame.timestamp.u32.hi = 0; 
    102     frame.timestamp.u32.lo = timestamp; 
    103  
    104 #if PJMEDIA_SOUND_USE_DELAYBUF 
    105     if (snd_port->delay_buf) { 
    106         status = pjmedia_delay_buf_get(snd_port->delay_buf, (pj_int16_t*)output); 
    107         if (status != PJ_SUCCESS) 
    108             pj_bzero(output, size); 
    109  
    110         frame.type = PJMEDIA_FRAME_TYPE_AUDIO; 
    111         pjmedia_port_put_frame(port, &frame); 
    112  
    113 #ifdef TEST_OVERFLOW_UNDERFLOW 
    114         { 
    115             static int count = 1; 
    116             if (++count % 10 == 0) { 
    117                 status = pjmedia_delay_buf_get(snd_port->delay_buf,  
    118                                                (pj_int16_t*)output); 
    119                 if (status != PJ_SUCCESS) 
    120                     pj_bzero(output, size); 
    121  
    122                 frame.type = PJMEDIA_FRAME_TYPE_AUDIO; 
    123                 pjmedia_port_put_frame(port, &frame); 
    124             } 
    125         } 
    126 #endif 
    127  
    128     } 
    129 #endif 
    130  
    131     status = pjmedia_port_get_frame(port, &frame); 
     76    status = pjmedia_port_get_frame(port, frame); 
    13277    if (status != PJ_SUCCESS) 
    13378        goto no_frame; 
    13479 
    135     if (frame.type != PJMEDIA_FRAME_TYPE_AUDIO) 
     80    if (frame->type != PJMEDIA_FRAME_TYPE_AUDIO) 
    13681        goto no_frame; 
    13782 
    13883    /* Must supply the required samples */ 
    139     pj_assert(frame.size == size); 
    140  
    141 #ifdef SIMULATE_LOST_PCT 
    142     /* Simulate packet lost */ 
    143     if (pj_rand() % 100 < SIMULATE_LOST_PCT) { 
    144         PJ_LOG(4,(THIS_FILE, "Frame dropped")); 
    145         goto no_frame; 
    146     } 
    147 #endif 
    148  
    149     if (snd_port->plc) 
    150         pjmedia_plc_save(snd_port->plc, (pj_int16_t*) output); 
     84    PJ_UNUSED_ARG(required_size); 
     85    pj_assert(frame->size == required_size); 
    15186 
    15287    if (snd_port->ec_state) { 
     
    15792        } 
    15893        snd_port->ec_suspend_count = 0; 
    159         pjmedia_echo_playback(snd_port->ec_state, (pj_int16_t*)output); 
     94        pjmedia_echo_playback(snd_port->ec_state, (pj_int16_t*)frame->buf); 
    16095    } 
    16196 
     
    173108        if (snd_port->ec_state) { 
    174109            /* To maintain correct delay in EC */ 
    175             pjmedia_echo_playback(snd_port->ec_state, (pj_int16_t*)output); 
    176         } 
    177     } 
    178  
    179     /* Apply PLC */ 
    180     if (snd_port->plc) { 
    181  
    182         pjmedia_plc_generate(snd_port->plc, (pj_int16_t*) output); 
    183 #ifdef SIMULATE_LOST_PCT 
    184         PJ_LOG(4,(THIS_FILE, "Lost frame generated")); 
    185 #endif 
    186     } else { 
    187         pj_bzero(output, size); 
    188     } 
    189  
     110            pjmedia_echo_playback(snd_port->ec_state, (pj_int16_t*)frame->buf); 
     111        } 
     112    } 
    190113 
    191114    return PJ_SUCCESS; 
     
    197120 * frame. 
    198121 */ 
    199 static pj_status_t rec_cb(/* in */   void *user_data, 
    200                           /* in */   pj_uint32_t timestamp, 
    201                           /* in */   void *input, 
    202                           /* in*/    unsigned size) 
     122static pj_status_t rec_cb(void *user_data, pjmedia_frame *frame) 
    203123{ 
    204124    pjmedia_snd_port *snd_port = (pjmedia_snd_port*) user_data; 
    205125    pjmedia_port *port; 
    206     pjmedia_frame frame; 
    207  
    208     /* We're risking accessing the port without holding any mutex. 
    209      * It's possible that port is disconnected then destroyed while 
    210      * we're trying to access it. 
    211      * But in the name of performance, we'll try this approach until 
    212      * someone complains when it crashes. 
    213      */ 
     126 
    214127    port = snd_port->port; 
    215128    if (port == NULL) 
     
    218131    /* Cancel echo */ 
    219132    if (snd_port->ec_state && !snd_port->ec_suspended) { 
    220         pjmedia_echo_capture(snd_port->ec_state, (pj_int16_t*) input, 0); 
    221     } 
    222  
    223 #if PJMEDIA_SOUND_USE_DELAYBUF 
    224     if (snd_port->delay_buf) { 
    225         pjmedia_delay_buf_put(snd_port->delay_buf, (pj_int16_t*)input); 
    226     } else { 
    227         frame.buf = (void*)input; 
    228         frame.size = size; 
    229         frame.type = PJMEDIA_FRAME_TYPE_AUDIO; 
    230         frame.timestamp.u32.lo = timestamp; 
    231  
    232         pjmedia_port_put_frame(port, &frame); 
    233     } 
    234 #else 
    235     frame.buf = (void*)input; 
    236     frame.size = size; 
    237     frame.type = PJMEDIA_FRAME_TYPE_AUDIO; 
    238     frame.timestamp.u32.lo = timestamp; 
    239  
    240     pjmedia_port_put_frame(port, &frame); 
    241 #endif 
     133        pjmedia_echo_capture(snd_port->ec_state, (pj_int16_t*) frame->buf, 0); 
     134    } 
     135 
     136    pjmedia_port_put_frame(port, frame); 
     137 
     138    return PJ_SUCCESS; 
     139} 
     140 
     141/* 
     142 * The callback called by sound player when it needs more samples to be 
     143 * played. This version is for non-PCM data. 
     144 */ 
     145static pj_status_t play_cb_ext(void *user_data, pjmedia_frame *frame) 
     146{ 
     147    pjmedia_snd_port *snd_port = (pjmedia_snd_port*) user_data; 
     148    pjmedia_port *port = snd_port->port; 
     149 
     150    if (port == NULL) { 
     151        frame->type = PJMEDIA_FRAME_TYPE_NONE; 
     152        return PJ_SUCCESS; 
     153    } 
     154 
     155    pjmedia_port_get_frame(port, frame); 
     156 
     157    return PJ_SUCCESS; 
     158} 
     159 
     160 
     161/* 
     162 * The callback called by sound recorder when it has finished capturing a 
     163 * frame. This version is for non-PCM data. 
     164 */ 
     165static pj_status_t rec_cb_ext(void *user_data, pjmedia_frame *frame) 
     166{ 
     167    pjmedia_snd_port *snd_port = (pjmedia_snd_port*) user_data; 
     168    pjmedia_port *port; 
     169 
     170    port = snd_port->port; 
     171    if (port == NULL) 
     172        return PJ_SUCCESS; 
     173 
     174    pjmedia_port_put_frame(port, frame); 
    242175 
    243176    return PJ_SUCCESS; 
     
    251184                                       pjmedia_snd_port *snd_port ) 
    252185{ 
     186    pjmedia_aud_rec_cb snd_rec_cb; 
     187    pjmedia_aud_play_cb snd_play_cb; 
     188    pjmedia_aud_param param_copy; 
    253189    pj_status_t status; 
    254190 
    255191    /* Check if sound has been started. */ 
    256     if (snd_port->snd_stream != NULL) 
     192    if (snd_port->aud_stream != NULL) 
    257193        return PJ_SUCCESS; 
    258194 
    259     /* Open sound stream. */ 
    260     if (snd_port->dir == PJMEDIA_DIR_CAPTURE) { 
    261         status = pjmedia_snd_open_rec( snd_port->rec_id,  
    262                                        snd_port->clock_rate, 
    263                                        snd_port->channel_count, 
    264                                        snd_port->samples_per_frame, 
    265                                        snd_port->bits_per_sample, 
    266                                        &rec_cb, 
     195    PJ_ASSERT_RETURN(snd_port->dir == PJMEDIA_DIR_CAPTURE || 
     196                     snd_port->dir == PJMEDIA_DIR_PLAYBACK || 
     197                     snd_port->dir == PJMEDIA_DIR_CAPTURE_PLAYBACK, 
     198                     PJ_EBUG); 
     199 
     200    /* Get device caps */ 
     201    if (snd_port->aud_param.dir & PJMEDIA_DIR_CAPTURE) { 
     202        pjmedia_aud_dev_info dev_info; 
     203 
     204        status = pjmedia_aud_dev_get_info(snd_port->aud_param.rec_id,  
     205                                          &dev_info); 
     206        if (status != PJ_SUCCESS) 
     207            return status; 
     208 
     209        snd_port->aud_caps = dev_info.caps; 
     210    } else { 
     211        snd_port->aud_caps = 0; 
     212    } 
     213 
     214    /* Process EC settings */ 
     215    pj_memcpy(&param_copy, &snd_port->aud_param, sizeof(param_copy)); 
     216    if (param_copy.flags & PJMEDIA_AUD_DEV_CAP_EC) { 
     217        /* EC is wanted */ 
     218        if (snd_port->aud_caps & PJMEDIA_AUD_DEV_CAP_EC) { 
     219            /* Device supports EC */ 
     220            /* Nothing to do */ 
     221        } else { 
     222            /* Device doesn't support EC, remove EC settings from 
     223             * device parameters 
     224             */ 
     225            param_copy.flags &= ~(PJMEDIA_AUD_DEV_CAP_EC | 
     226                                  PJMEDIA_AUD_DEV_CAP_EC_TAIL); 
     227        } 
     228    } 
     229 
     230    /* Use different callback if format is not PCM */ 
     231    if (snd_port->aud_param.ext_fmt.id == PJMEDIA_FORMAT_L16) { 
     232        snd_rec_cb = &rec_cb; 
     233        snd_play_cb = &play_cb; 
     234    } else { 
     235        snd_rec_cb = &rec_cb_ext; 
     236        snd_play_cb = &play_cb_ext; 
     237    } 
     238 
     239    /* Open the device */ 
     240    status = pjmedia_aud_stream_create(&param_copy, 
     241                                       snd_rec_cb, 
     242                                       snd_play_cb, 
    267243                                       snd_port, 
    268                                        &snd_port->snd_stream); 
    269  
    270     } else if (snd_port->dir == PJMEDIA_DIR_PLAYBACK) { 
    271         status = pjmedia_snd_open_player( snd_port->play_id,  
    272                                           snd_port->clock_rate, 
    273                                           snd_port->channel_count, 
    274                                           snd_port->samples_per_frame, 
    275                                           snd_port->bits_per_sample, 
    276                                           &play_cb, 
    277                                           snd_port, 
    278                                           &snd_port->snd_stream); 
    279  
    280     } else if (snd_port->dir == PJMEDIA_DIR_CAPTURE_PLAYBACK) { 
    281         status = pjmedia_snd_open( snd_port->rec_id,  
    282                                    snd_port->play_id, 
    283                                    snd_port->clock_rate, 
    284                                    snd_port->channel_count, 
    285                                    snd_port->samples_per_frame, 
    286                                    snd_port->bits_per_sample, 
    287                                    &rec_cb, 
    288                                    &play_cb, 
    289                                    snd_port, 
    290                                    &snd_port->snd_stream); 
    291     } else { 
    292         pj_assert(!"Invalid dir"); 
    293         status = PJ_EBUG; 
    294     } 
     244                                       &snd_port->aud_stream); 
    295245 
    296246    if (status != PJ_SUCCESS) 
    297247        return status; 
    298  
    299  
    300 #ifdef SIMULATE_LOST_PCT 
    301     snd_port->options |= PJMEDIA_PLC_ENABLED; 
    302 #endif 
    303  
    304     /* If we have player components, allocate buffer to save the last 
    305      * frame played to the speaker. The last frame is used for packet 
    306      * lost concealment (PLC) algorithm. 
    307      */ 
    308     if ((snd_port->dir & PJMEDIA_DIR_PLAYBACK) && 
    309         (snd_port->options & PJMEDIA_PLC_ENABLED))  
    310     { 
    311         status = pjmedia_plc_create(pool, snd_port->clock_rate,  
    312                                     snd_port->samples_per_frame *  
    313                                         snd_port->channel_count, 
    314                                     0, &snd_port->plc); 
    315         if (status != PJ_SUCCESS) { 
    316             PJ_LOG(4,(THIS_FILE, "Unable to create PLC")); 
    317             snd_port->plc = NULL; 
    318         } 
    319     } 
    320248 
    321249    /* Inactivity limit before EC is suspended. */ 
     
    324252                                  snd_port->samples_per_frame); 
    325253 
     254    /* Create software EC if parameter specifies EC but device  
     255     * doesn't support EC. Only do this if the format is PCM! 
     256     */ 
     257    if ((snd_port->aud_param.flags & PJMEDIA_AUD_DEV_CAP_EC) && 
     258        (snd_port->aud_caps & PJMEDIA_AUD_DEV_CAP_EC)==0 && 
     259        param_copy.ext_fmt.id == PJMEDIA_FORMAT_PCM) 
     260    { 
     261        if ((snd_port->aud_param.flags & PJMEDIA_AUD_DEV_CAP_EC_TAIL)==0) { 
     262            snd_port->aud_param.flags |= PJMEDIA_AUD_DEV_CAP_EC_TAIL; 
     263            snd_port->aud_param.ec_tail_ms = AEC_TAIL; 
     264            PJ_LOG(4,(THIS_FILE, "AEC tail is set to default %u ms", 
     265                                 snd_port->aud_param.ec_tail_ms)); 
     266        } 
     267             
     268        status = pjmedia_snd_port_set_ec(snd_port, pool,  
     269                                         snd_port->aud_param.ec_tail_ms, 0); 
     270        if (status != PJ_SUCCESS) { 
     271            pjmedia_aud_stream_destroy(snd_port->aud_stream); 
     272            snd_port->aud_stream = NULL; 
     273            return status; 
     274        } 
     275    } 
     276 
    326277    /* Start sound stream. */ 
    327     status = pjmedia_snd_stream_start(snd_port->snd_stream); 
     278    status = pjmedia_aud_stream_start(snd_port->aud_stream); 
    328279    if (status != PJ_SUCCESS) { 
    329         pjmedia_snd_stream_close(snd_port->snd_stream); 
    330         snd_port->snd_stream = NULL; 
     280        pjmedia_aud_stream_destroy(snd_port->aud_stream); 
     281        snd_port->aud_stream = NULL; 
    331282        return status; 
    332283    } 
     
    343294{ 
    344295    /* Check if we have sound stream device. */ 
    345     if (snd_port->snd_stream) { 
    346         pjmedia_snd_stream_stop(snd_port->snd_stream); 
    347         pjmedia_snd_stream_close(snd_port->snd_stream); 
    348         snd_port->snd_stream = NULL; 
     296    if (snd_port->aud_stream) { 
     297        pjmedia_aud_stream_stop(snd_port->aud_stream); 
     298        pjmedia_aud_stream_destroy(snd_port->aud_stream); 
     299        snd_port->aud_stream = NULL; 
    349300    } 
    350301 
     
    372323                                             pjmedia_snd_port **p_port) 
    373324{ 
    374     pjmedia_snd_port *snd_port; 
    375  
    376     PJ_ASSERT_RETURN(pool && p_port, PJ_EINVAL); 
    377  
    378     snd_port = PJ_POOL_ZALLOC_T(pool, pjmedia_snd_port); 
    379     PJ_ASSERT_RETURN(snd_port, PJ_ENOMEM); 
    380  
    381     snd_port->rec_id = rec_id; 
    382     snd_port->play_id = play_id; 
    383     snd_port->dir = PJMEDIA_DIR_CAPTURE_PLAYBACK; 
    384     snd_port->options = options | DEFAULT_OPTIONS; 
    385     snd_port->clock_rate = clock_rate; 
    386     snd_port->channel_count = channel_count; 
    387     snd_port->samples_per_frame = samples_per_frame; 
    388     snd_port->bits_per_sample = bits_per_sample; 
    389      
    390 #if PJMEDIA_SOUND_USE_DELAYBUF 
    391     do { 
    392         pj_status_t status; 
    393         unsigned ptime; 
    394      
    395         ptime = samples_per_frame * 1000 / (clock_rate * channel_count); 
    396      
    397         status = pjmedia_delay_buf_create(pool, "snd_buff",  
    398                                           clock_rate, samples_per_frame, 
    399                                           channel_count, 
    400                                           PJMEDIA_SOUND_BUFFER_COUNT * ptime, 
    401                                           0, &snd_port->delay_buf); 
    402         PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 
    403     } while (0); 
    404 #endif 
    405  
    406     *p_port = snd_port; 
    407  
    408  
    409     /* Start sound device immediately. 
    410      * If there's no port connected, the sound callback will return 
    411      * empty signal. 
    412      */ 
    413     return start_sound_device( pool, snd_port ); 
    414  
     325    pjmedia_aud_param param; 
     326    pj_status_t status; 
     327 
     328    PJ_UNUSED_ARG(options); 
     329 
     330    status = pjmedia_aud_dev_default_param(rec_id, &param); 
     331    if (status != PJ_SUCCESS) 
     332        return status; 
     333 
     334    param.dir = PJMEDIA_DIR_CAPTURE_PLAYBACK; 
     335    param.rec_id = rec_id; 
     336    param.play_id = play_id; 
     337    param.clock_rate = clock_rate; 
     338    param.channel_count = channel_count; 
     339    param.samples_per_frame = samples_per_frame; 
     340    param.bits_per_sample = bits_per_sample; 
     341 
     342    return pjmedia_snd_port_create2(pool, &param, p_port); 
    415343} 
    416344 
     
    427355                                                 pjmedia_snd_port **p_port) 
    428356{ 
    429     pjmedia_snd_port *snd_port; 
    430  
    431     PJ_ASSERT_RETURN(pool && p_port, PJ_EINVAL); 
    432  
    433     snd_port = PJ_POOL_ZALLOC_T(pool, pjmedia_snd_port); 
    434     PJ_ASSERT_RETURN(snd_port, PJ_ENOMEM); 
    435  
    436     snd_port->rec_id = dev_id; 
    437     snd_port->dir = PJMEDIA_DIR_CAPTURE; 
    438     snd_port->options = options | DEFAULT_OPTIONS; 
    439     snd_port->clock_rate = clock_rate; 
    440     snd_port->channel_count = channel_count; 
    441     snd_port->samples_per_frame = samples_per_frame; 
    442     snd_port->bits_per_sample = bits_per_sample; 
    443  
    444     *p_port = snd_port; 
    445  
    446     /* Start sound device immediately. 
    447      * If there's no port connected, the sound callback will return 
    448      * empty signal. 
    449      */ 
    450     return start_sound_device( pool, snd_port ); 
     357    pjmedia_aud_param param; 
     358    pj_status_t status; 
     359 
     360    PJ_UNUSED_ARG(options); 
     361 
     362    status = pjmedia_aud_dev_default_param(dev_id, &param); 
     363    if (status != PJ_SUCCESS) 
     364        return status; 
     365 
     366    param.dir = PJMEDIA_DIR_CAPTURE; 
     367    param.rec_id = dev_id; 
     368    param.clock_rate = clock_rate; 
     369    param.channel_count = channel_count; 
     370    param.samples_per_frame = samples_per_frame; 
     371    param.bits_per_sample = bits_per_sample; 
     372 
     373    return pjmedia_snd_port_create2(pool, &param, p_port); 
    451374} 
    452375 
     
    464387                                                    pjmedia_snd_port **p_port) 
    465388{ 
     389    pjmedia_aud_param param; 
     390    pj_status_t status; 
     391 
     392    PJ_UNUSED_ARG(options); 
     393 
     394    status = pjmedia_aud_dev_default_param(dev_id, &param); 
     395    if (status != PJ_SUCCESS) 
     396        return status; 
     397 
     398    param.dir = PJMEDIA_DIR_PLAYBACK; 
     399    param.play_id = dev_id; 
     400    param.clock_rate = clock_rate; 
     401    param.channel_count = channel_count; 
     402    param.samples_per_frame = samples_per_frame; 
     403    param.bits_per_sample = bits_per_sample; 
     404 
     405    return pjmedia_snd_port_create2(pool, &param, p_port); 
     406} 
     407 
     408 
     409/* 
     410 * Create sound port. 
     411 */ 
     412PJ_DEF(pj_status_t) pjmedia_snd_port_create2(pj_pool_t *pool, 
     413                                             const pjmedia_aud_param *prm, 
     414                                             pjmedia_snd_port **p_port) 
     415{ 
    466416    pjmedia_snd_port *snd_port; 
    467  
    468     PJ_ASSERT_RETURN(pool && p_port, PJ_EINVAL); 
     417    pj_status_t status; 
     418 
     419    PJ_ASSERT_RETURN(pool && prm && p_port, PJ_EINVAL); 
    469420 
    470421    snd_port = PJ_POOL_ZALLOC_T(pool, pjmedia_snd_port); 
    471422    PJ_ASSERT_RETURN(snd_port, PJ_ENOMEM); 
    472423 
    473     snd_port->play_id = dev_id; 
    474     snd_port->dir = PJMEDIA_DIR_PLAYBACK; 
    475     snd_port->options = options | DEFAULT_OPTIONS; 
    476     snd_port->clock_rate = clock_rate; 
    477     snd_port->channel_count = channel_count; 
    478     snd_port->samples_per_frame = samples_per_frame; 
    479     snd_port->bits_per_sample = bits_per_sample; 
    480  
    481     *p_port = snd_port; 
    482  
     424    snd_port->dir = prm->dir; 
     425    snd_port->rec_id = prm->rec_id; 
     426    snd_port->play_id = prm->play_id; 
     427    snd_port->dir = PJMEDIA_DIR_CAPTURE_PLAYBACK; 
     428    snd_port->clock_rate = prm->clock_rate; 
     429    snd_port->channel_count = prm->channel_count; 
     430    snd_port->samples_per_frame = prm->samples_per_frame; 
     431    snd_port->bits_per_sample = prm->bits_per_sample; 
     432    pj_memcpy(&snd_port->aud_param, prm, sizeof(*prm)); 
     433     
    483434    /* Start sound device immediately. 
    484435     * If there's no port connected, the sound callback will return 
    485436     * empty signal. 
    486437     */ 
    487     return start_sound_device( pool, snd_port ); 
     438    status = start_sound_device( pool, snd_port ); 
     439    if (status != PJ_SUCCESS) { 
     440        pjmedia_snd_port_destroy(snd_port); 
     441        return status; 
     442    } 
     443 
     444    *p_port = snd_port; 
     445    return PJ_SUCCESS; 
    488446} 
    489447 
     
    503461 * Retrieve the sound stream associated by this sound device port. 
    504462 */ 
    505 PJ_DEF(pjmedia_snd_stream*) pjmedia_snd_port_get_snd_stream( 
     463PJ_DEF(pjmedia_aud_stream*) pjmedia_snd_port_get_snd_stream( 
    506464                                                pjmedia_snd_port *snd_port) 
    507465{ 
    508466    PJ_ASSERT_RETURN(snd_port, NULL); 
    509     return snd_port->snd_stream; 
    510 } 
    511  
    512  
    513 /* 
    514  * Enable AEC 
     467    return snd_port->aud_stream; 
     468} 
     469 
     470 
     471/* 
     472 * Change EC settings. 
    515473 */ 
    516474PJ_DEF(pj_status_t) pjmedia_snd_port_set_ec( pjmedia_snd_port *snd_port, 
     
    519477                                             unsigned options) 
    520478{ 
    521     pjmedia_snd_stream_info si; 
     479    pjmedia_aud_param prm; 
    522480    pj_status_t status; 
    523481 
     
    527485                     PJ_EINVALIDOP); 
    528486 
    529     /* Sound port must have 16bits per sample */ 
    530     PJ_ASSERT_RETURN(snd_port->bits_per_sample == 16, 
    531                      PJ_EINVALIDOP); 
    532  
    533     /* Destroy AEC */ 
    534     if (snd_port->ec_state) { 
    535         pjmedia_echo_destroy(snd_port->ec_state); 
    536         snd_port->ec_state = NULL; 
    537     } 
    538  
    539     snd_port->aec_tail_len = tail_ms; 
    540  
    541     if (tail_ms != 0) { 
    542         unsigned delay_ms; 
    543  
    544         status = pjmedia_snd_stream_get_info(snd_port->snd_stream, &si); 
     487    /* Determine whether we use device or software EC */ 
     488    if (snd_port->aud_caps & PJMEDIA_AUD_DEV_CAP_EC) { 
     489        /* We use device EC */ 
     490        pj_bool_t ec_enabled; 
     491 
     492        /* Query EC status */ 
     493        status = pjmedia_aud_stream_get_cap(snd_port->aud_stream, 
     494                                            PJMEDIA_AUD_DEV_CAP_EC, 
     495                                            &ec_enabled); 
    545496        if (status != PJ_SUCCESS) 
    546             si.rec_latency = si.play_latency = 0; 
    547  
    548         //No need to add input latency in the latency calculation, 
    549         //since actual input latency should be zero. 
    550         //delay_ms = (si.rec_latency + si.play_latency) * 1000 / 
    551         //         snd_port->clock_rate; 
    552         delay_ms = si.play_latency * 1000 / snd_port->clock_rate; 
    553         status = pjmedia_echo_create2(pool, snd_port->clock_rate,  
    554                                       snd_port->channel_count, 
    555                                       snd_port->samples_per_frame,  
    556                                       tail_ms, delay_ms, 
    557                                       options, &snd_port->ec_state); 
     497            return status; 
     498 
     499        if (tail_ms != 0) { 
     500            /* Change EC setting */ 
     501 
     502            if (!ec_enabled) { 
     503                /* Enable EC first */ 
     504                pj_bool_t value = PJ_TRUE; 
     505                status = pjmedia_aud_stream_set_cap(snd_port->aud_stream,  
     506                                                    PJMEDIA_AUD_DEV_CAP_EC, 
     507                                                    &value); 
     508                if (status != PJ_SUCCESS) 
     509                    return status; 
     510            } 
     511 
     512            if ((snd_port->aud_caps & PJMEDIA_AUD_DEV_CAP_EC_TAIL)==0) { 
     513                /* Device does not support setting EC tail */ 
     514                return PJMEDIA_EAUD_INVCAP; 
     515            } 
     516 
     517            return pjmedia_aud_stream_set_cap(snd_port->aud_stream, 
     518                                              PJMEDIA_AUD_DEV_CAP_EC_TAIL, 
     519                                              &tail_ms); 
     520 
     521        } else if (ec_enabled) { 
     522            /* Disable EC */ 
     523            pj_bool_t value = PJ_FALSE; 
     524            return pjmedia_aud_stream_set_cap(snd_port->aud_stream,  
     525                                              PJMEDIA_AUD_DEV_CAP_EC, 
     526                                              &value); 
     527        } else { 
     528            /* Request to disable EC but EC has been disabled */ 
     529            /* Do nothing */ 
     530            return PJ_SUCCESS; 
     531        } 
     532 
     533    } else { 
     534        /* We use software EC */ 
     535 
     536        /* Check if there is change in parameters */ 
     537        if (tail_ms==snd_port->ec_tail_len && options==snd_port->ec_options) { 
     538            PJ_LOG(5,(THIS_FILE, "pjmedia_snd_port_set_ec() ignored, no " 
     539                                 "change in settings")); 
     540            return PJ_SUCCESS; 
     541        } 
     542 
     543        status = pjmedia_aud_stream_get_param(snd_port->aud_stream, &prm); 
    558544        if (status != PJ_SUCCESS) 
     545            return status; 
     546 
     547        /* Audio stream must be in PCM format */ 
     548        PJ_ASSERT_RETURN(prm.ext_fmt.id == PJMEDIA_FORMAT_PCM, 
     549                         PJ_EINVALIDOP); 
     550 
     551        /* Destroy AEC */ 
     552        if (snd_port->ec_state) { 
     553            pjmedia_echo_destroy(snd_port->ec_state); 
    559554            snd_port->ec_state = NULL; 
    560         else 
    561             snd_port->ec_suspended = PJ_FALSE; 
    562     } else { 
    563         PJ_LOG(4,(THIS_FILE, "Echo canceller is now disabled in the " 
    564                              "sound port")); 
    565         status = PJ_SUCCESS; 
     555        } 
     556 
     557        if (tail_ms != 0) { 
     558            unsigned delay_ms; 
     559 
     560            //No need to add input latency in the latency calculation, 
     561            //since actual input latency should be zero. 
     562            //delay_ms = (si.rec_latency + si.play_latency) * 1000 / 
     563            //     snd_port->clock_rate; 
     564            delay_ms = prm.output_latency_ms; 
     565            status = pjmedia_echo_create2(pool, snd_port->clock_rate,  
     566                                          snd_port->channel_count, 
     567                                          snd_port->samples_per_frame,  
     568                                          tail_ms, delay_ms, 
     569                                          options, &snd_port->ec_state); 
     570            if (status != PJ_SUCCESS) 
     571                snd_port->ec_state = NULL; 
     572            else 
     573                snd_port->ec_suspended = PJ_FALSE; 
     574        } else { 
     575            PJ_LOG(4,(THIS_FILE, "Echo canceller is now disabled in the " 
     576                                 "sound port")); 
     577            status = PJ_SUCCESS; 
     578        } 
     579 
     580        snd_port->ec_options = options; 
     581        snd_port->ec_tail_len = tail_ms; 
    566582    } 
    567583 
     
    575591{ 
    576592    PJ_ASSERT_RETURN(snd_port && p_length, PJ_EINVAL); 
    577     *p_length =  snd_port->ec_state ? snd_port->aec_tail_len : 0; 
    578     return PJ_SUCCESS; 
    579 } 
    580  
     593 
     594    /* Determine whether we use device or software EC */ 
     595    if (snd_port->aud_caps & PJMEDIA_AUD_DEV_CAP_EC) { 
     596        /* We use device EC */ 
     597        pj_bool_t ec_enabled; 
     598        pj_status_t status; 
     599 
     600        /* Query EC status */ 
     601        status = pjmedia_aud_stream_get_cap(snd_port->aud_stream, 
     602                                            PJMEDIA_AUD_DEV_CAP_EC, 
     603                                            &ec_enabled); 
     604        if (status != PJ_SUCCESS) 
     605            return status; 
     606 
     607        if (!ec_enabled) { 
     608            *p_length = 0; 
     609        } else if (snd_port->aud_caps & PJMEDIA_AUD_DEV_CAP_EC_TAIL) { 
     610            /* Get device EC tail */ 
     611            status = pjmedia_aud_stream_get_cap(snd_port->aud_stream, 
     612                                                PJMEDIA_AUD_DEV_CAP_EC_TAIL, 
     613                                                p_length); 
     614            if (status != PJ_SUCCESS) 
     615                return status; 
     616        } else { 
     617            /* Just use default */ 
     618            *p_length = AEC_TAIL; 
     619        } 
     620 
     621    } else { 
     622        /* We use software EC */ 
     623        *p_length =  snd_port->ec_state ? snd_port->ec_tail_len : 0; 
     624    } 
     625    return PJ_SUCCESS; 
     626} 
    581627 
    582628 
  • pjproject/trunk/pjmedia/src/pjmedia/stream.c

    r2477 r2506  
    409409 
    410410 
     411/* The other version of get_frame callback used when stream port format 
     412 * is non linear PCM. 
     413 */ 
     414static pj_status_t get_frame_ext( pjmedia_port *port, pjmedia_frame *frame) 
     415{ 
     416    pjmedia_stream *stream = (pjmedia_stream*) port->port_data.pdata; 
     417    pjmedia_channel *channel = stream->dec; 
     418    pjmedia_frame_ext *f = (pjmedia_frame_ext*)frame; 
     419    unsigned samples_per_frame, samples_required; 
     420    pj_status_t status; 
     421 
     422    /* Return no frame if channel is paused */ 
     423    if (channel->paused) { 
     424        frame->type = PJMEDIA_FRAME_TYPE_NONE; 
     425        return PJ_SUCCESS; 
     426    } 
     427 
     428    /* Repeat get frame from the jitter buffer and decode the frame 
     429     * until we have enough frames according to codec's ptime. 
     430     */ 
     431 
     432    samples_required = stream->port.info.samples_per_frame; 
     433    samples_per_frame = stream->codec_param.info.frm_ptime * 
     434                        stream->codec_param.info.clock_rate * 
     435                        stream->codec_param.info.channel_cnt /  
     436                        1000; 
     437 
     438    pj_bzero(f, sizeof(pjmedia_frame_ext)); 
     439    f->base.type = PJMEDIA_FRAME_TYPE_EXTENDED; 
     440 
     441    while (f->samples_cnt < samples_required) { 
     442        char frame_type; 
     443        pj_size_t frame_size; 
     444        pj_uint32_t bit_info; 
     445 
     446        /* Lock jitter buffer mutex first */ 
     447        pj_mutex_lock( stream->jb_mutex ); 
     448 
     449        /* Get frame from jitter buffer. */ 
     450        pjmedia_jbuf_get_frame2(stream->jb, channel->out_pkt, &frame_size, 
     451                                &frame_type, &bit_info); 
     452         
     453        /* Unlock jitter buffer mutex. */ 
     454        pj_mutex_unlock( stream->jb_mutex ); 
     455 
     456        if (frame_type == PJMEDIA_JB_NORMAL_FRAME) { 
     457            /* Got "NORMAL" frame from jitter buffer */ 
     458            pjmedia_frame frame_in; 
     459 
     460            /* Decode */ 
     461            frame_in.buf = channel->out_pkt; 
     462            frame_in.size = frame_size; 
     463            frame_in.bit_info = bit_info; 
     464            frame_in.type = PJMEDIA_FRAME_TYPE_AUDIO; 
     465 
     466            status = stream->codec->op->decode( stream->codec, &frame_in, 
     467                                                0, frame); 
     468            if (status != PJ_SUCCESS) { 
     469                LOGERR_((port->info.name.ptr, "codec decode() error",  
     470                         status)); 
     471                pjmedia_frame_ext_append_subframe(f, NULL, 0, 
     472                                            (pj_uint16_t)samples_per_frame); 
     473            } 
     474        } else { 
     475            status = (*stream->codec->op->recover)(stream->codec, 
     476                                                   0, frame); 
     477            if (status != PJ_SUCCESS) { 
     478                pjmedia_frame_ext_append_subframe(f, NULL, 0, 
     479                                            (pj_uint16_t)samples_per_frame); 
     480            } 
     481 
     482            if (frame_type == PJMEDIA_JB_MISSING_FRAME) { 
     483                PJ_LOG(5,(stream->port.info.name.ptr,  "Frame lost!")); 
     484            } else if (frame_type == PJMEDIA_JB_ZERO_EMPTY_FRAME) { 
     485                /* Jitter buffer is empty. Check if this is the first "empty"  
     486                 * state. 
     487                 */ 
     488                if (frame_type != stream->jb_last_frm) { 
     489                    pjmedia_jb_state jb_state; 
     490 
     491                    /* Report the state of jitter buffer */ 
     492                    pjmedia_jbuf_get_state(stream->jb, &jb_state); 
     493                    PJ_LOG(5,(stream->port.info.name.ptr,  
     494                              "Jitter buffer empty (prefetch=%d)",  
     495                              jb_state.prefetch)); 
     496                } 
     497            } else { 
     498                pjmedia_jb_state jb_state; 
     499 
     500                /* It can only be PJMEDIA_JB_ZERO_PREFETCH frame */ 
     501                pj_assert(frame_type == PJMEDIA_JB_ZERO_PREFETCH_FRAME); 
     502 
     503                /* Get the state of jitter buffer */ 
     504                pjmedia_jbuf_get_state(stream->jb, &jb_state); 
     505 
     506                if (stream->jb_last_frm != frame_type) { 
     507                    PJ_LOG(5,(stream->port.info.name.ptr,  
     508                              "Jitter buffer is bufferring (prefetch=%d)", 
     509                              jb_state.prefetch)); 
     510                } 
     511            } 
     512        } 
     513 
     514        stream->jb_last_frm = frame_type; 
     515    } 
     516 
     517    return PJ_SUCCESS; 
     518} 
     519 
     520 
    411521/* 
    412522 * Transmit DTMF 
     
    687797    if (frame->type == PJMEDIA_FRAME_TYPE_AUDIO) 
    688798        ts_len = (frame->size >> 1) / stream->codec_param.info.channel_cnt; 
     799    else if (frame->type == PJMEDIA_FRAME_TYPE_EXTENDED) 
     800        ts_len = stream->port.info.samples_per_frame /  
     801                 stream->port.info.channel_count; 
    689802    else 
    690803        ts_len = 0; 
     
    753866    } else if (frame->type == PJMEDIA_FRAME_TYPE_AUDIO && 
    754867               frame->buf == NULL && 
     868               stream->port.info.format.id == PJMEDIA_FORMAT_L16 && 
    755869               (stream->dir & PJMEDIA_DIR_ENCODING) && 
    756870               stream->codec_param.info.frm_ptime * 
     
    14841598    stream->port.info.clock_rate = info->fmt.clock_rate; 
    14851599    stream->port.info.channel_count = info->fmt.channel_cnt; 
     1600    stream->port.info.format.id = info->param->info.fmt_id; 
    14861601    stream->port.port_data.pdata = stream; 
    1487     stream->port.put_frame = &put_frame; 
    1488     stream->port.get_frame = &get_frame; 
     1602    if (stream->port.info.format.id == PJMEDIA_FORMAT_L16) { 
     1603        stream->port.put_frame = &put_frame; 
     1604        stream->port.get_frame = &get_frame; 
     1605    } else { 
     1606        stream->port.info.format.bitrate = info->param->info.avg_bps; 
     1607        stream->port.info.format.vad = (info->param->setting.vad != 0); 
     1608 
     1609        stream->port.put_frame = &put_frame; 
     1610        stream->port.get_frame = &get_frame_ext; 
     1611    } 
    14891612 
    14901613 
  • pjproject/trunk/pjmedia/src/pjmedia/transport_ice.c

    r2394 r2506  
    2222#include <pj/assert.h> 
    2323#include <pj/log.h> 
     24#include <pj/pool.h> 
    2425#include <pj/rand.h> 
    2526 
  • pjproject/trunk/pjmedia/src/pjmedia/transport_loop.c

    r2394 r2506  
    2323#include <pj/ioqueue.h> 
    2424#include <pj/log.h> 
     25#include <pj/pool.h> 
    2526#include <pj/rand.h> 
    2627#include <pj/string.h> 
  • pjproject/trunk/pjmedia/src/pjmedia/transport_udp.c

    r2394 r2506  
    2424#include <pj/ioqueue.h> 
    2525#include <pj/log.h> 
     26#include <pj/pool.h> 
    2627#include <pj/rand.h> 
    2728#include <pj/string.h> 
  • pjproject/trunk/pjproject-vs8.sln

    r2430 r2506  
    1313Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjlib_util_test", "pjlib-util\build\pjlib_util_test.vcproj", "{ED02BE13-8297-4770-8097-27DC2CCABF9A}" 
    1414        ProjectSection(ProjectDependencies) = postProject 
    15                 {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
    16                 {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
     15                {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
     16                {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
    1717        EndProjectSection 
    1818EndProject 
     
    2929Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjsua", "pjsip-apps\build\pjsua.vcproj", "{8310649E-A25E-4AF0-91E8-9E3CC659BB89}" 
    3030        ProjectSection(ProjectDependencies) = postProject 
     31                {4281CA5E-1D48-45D4-A991-2718A454B4BA} = {4281CA5E-1D48-45D4-A991-2718A454B4BA} 
     32                {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} = {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} 
     33                {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031} 
     34                {4BF51C21-5A30-423B-82FE-1ED410E5769D} = {4BF51C21-5A30-423B-82FE-1ED410E5769D} 
     35                {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} 
     36                {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
     37                {6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E} 
     38                {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 
     39                {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} 
     40                {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} 
     41                {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 
     42                {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} 
     43                {B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21} 
     44                {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
     45                {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} 
     46                {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} 
    3147                {E53AA5FF-B737-40AA-BD13-387EFA99023D} = {E53AA5FF-B737-40AA-BD13-387EFA99023D} 
     48        EndProjectSection 
     49EndProject 
     50Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjsua_lib", "pjsip\build\pjsua_lib.vcproj", "{9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37}" 
     51EndProject 
     52Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample_debug", "pjsip-apps\build\sample_debug.vcproj", "{A0F1AA62-0F6F-420D-B09A-AC04B6862821}" 
     53        ProjectSection(ProjectDependencies) = postProject 
     54                {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031} 
     55                {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} 
     56                {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
     57                {6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E} 
     58                {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 
     59                {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} 
     60                {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} 
     61                {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 
     62                {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} 
     63                {B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21} 
     64                {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
     65                {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} 
    3266                {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} 
     67                {E53AA5FF-B737-40AA-BD13-387EFA99023D} = {E53AA5FF-B737-40AA-BD13-387EFA99023D} 
     68                {4281CA5E-1D48-45D4-A991-2718A454B4BA} = {4281CA5E-1D48-45D4-A991-2718A454B4BA} 
     69                {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} = {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} 
     70        EndProjectSection 
     71EndProject 
     72Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "samples", "pjsip-apps\build\samples.vcproj", "{E378A1FC-0C9C-4462-860F-7E60BC1BF84E}" 
     73        ProjectSection(ProjectDependencies) = postProject 
     74                {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} = {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} 
     75                {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031} 
     76                {4BF51C21-5A30-423B-82FE-1ED410E5769D} = {4BF51C21-5A30-423B-82FE-1ED410E5769D} 
     77                {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} 
     78                {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
     79                {6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E} 
     80                {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 
     81                {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} 
     82                {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} 
     83                {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 
     84                {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} 
     85                {B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21} 
     86                {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
    3387                {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} 
    34                 {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
     88                {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} 
     89                {E53AA5FF-B737-40AA-BD13-387EFA99023D} = {E53AA5FF-B737-40AA-BD13-387EFA99023D} 
     90        EndProjectSection 
     91EndProject 
     92Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_pjsip", "pjsip\build\test_pjsip.vcproj", "{B3F7D4E9-702F-4EB4-ADA8-098D0A83D770}" 
     93        ProjectSection(ProjectDependencies) = postProject 
     94                {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031} 
     95                {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
     96                {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 
     97                {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 
     98                {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} 
    3599                {B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21} 
    36                 {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} 
     100                {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
     101                {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} 
     102        EndProjectSection 
     103EndProject 
     104Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjnath", "pjnath\build\pjnath.vcproj", "{A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4}" 
     105EndProject 
     106Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgsmcodec", "third_party\build\gsm\libgsmcodec.vcproj", "{E53AA5FF-B737-40AA-BD13-387EFA99023D}" 
     107EndProject 
     108Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libilbccodec", "third_party\build\ilbc\libilbccodec.vcproj", "{B5FE16F8-3EDB-4110-BD80-B4238CC01E8D}" 
     109EndProject 
     110Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libportaudio", "third_party\build\portaudio\libportaudio.vcproj", "{3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA}" 
     111EndProject 
     112Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libresample", "third_party\build\resample\libresample.vcproj", "{6794B975-4E84-4F49-B2DC-C31F2224E03E}" 
     113EndProject 
     114Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeex", "third_party\build\speex\libspeex.vcproj", "{4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9}" 
     115EndProject 
     116Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libresample_dll", "third_party\build\resample\libresample_dll.vcproj", "{C48EAAF5-F69E-410B-9CE4-23AB41B00E2A}" 
     117EndProject 
     118Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmilenage", "third_party\build\milenage\libmilenage.vcproj", "{4BF51C21-5A30-423B-82FE-1ED410E5769D}" 
     119EndProject 
     120Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsrtp", "third_party\build\srtp\libsrtp.vcproj", "{F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858}" 
     121EndProject 
     122Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjnath_test", "pjnath\build\pjnath_test.vcproj", "{553C094C-F581-4A80-9540-D5D7B398A2C6}" 
     123        ProjectSection(ProjectDependencies) = postProject 
     124                {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
     125                {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
     126                {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} 
     127        EndProjectSection 
     128EndProject 
     129Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjmedia_test", "pjmedia\build\pjmedia_test.vcproj", "{21C0CECF-69DD-4F70-BC2B-9B4DE7F15277}" 
     130        ProjectSection(ProjectDependencies) = postProject 
     131                {4281CA5E-1D48-45D4-A991-2718A454B4BA} = {4281CA5E-1D48-45D4-A991-2718A454B4BA} 
     132                {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} = {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} 
     133                {4BF51C21-5A30-423B-82FE-1ED410E5769D} = {4BF51C21-5A30-423B-82FE-1ED410E5769D} 
     134                {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
     135                {6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E} 
     136                {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 
     137                {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} 
     138                {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} 
    37139                {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 
    38                 {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} 
    39                 {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} 
    40                 {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 
    41                 {6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E} 
    42                 {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
    43                 {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} 
    44                 {4BF51C21-5A30-423B-82FE-1ED410E5769D} = {4BF51C21-5A30-423B-82FE-1ED410E5769D} 
    45                 {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031} 
    46                 {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} = {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} 
    47         EndProjectSection 
    48 EndProject 
    49 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjsua_lib", "pjsip\build\pjsua_lib.vcproj", "{9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37}" 
    50 EndProject 
    51 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample_debug", "pjsip-apps\build\sample_debug.vcproj", "{A0F1AA62-0F6F-420D-B09A-AC04B6862821}" 
    52         ProjectSection(ProjectDependencies) = postProject 
     140                {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
     141                {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} 
    53142                {E53AA5FF-B737-40AA-BD13-387EFA99023D} = {E53AA5FF-B737-40AA-BD13-387EFA99023D} 
    54                 {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} 
    55                 {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} 
    56                 {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
    57                 {B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21} 
    58                 {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} 
    59                 {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 
    60                 {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} 
    61                 {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} 
    62                 {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 
    63                 {6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E} 
    64                 {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
    65                 {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} 
    66                 {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031} 
    67                 {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} = {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} 
    68         EndProjectSection 
    69 EndProject 
    70 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "samples", "pjsip-apps\build\samples.vcproj", "{E378A1FC-0C9C-4462-860F-7E60BC1BF84E}" 
    71         ProjectSection(ProjectDependencies) = postProject 
    72                 {E53AA5FF-B737-40AA-BD13-387EFA99023D} = {E53AA5FF-B737-40AA-BD13-387EFA99023D} 
    73                 {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} 
    74                 {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} 
    75                 {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
    76                 {B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21} 
    77                 {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} 
    78                 {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 
    79                 {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} 
    80                 {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} 
    81                 {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 
    82                 {6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E} 
    83                 {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
    84                 {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} 
    85                 {4BF51C21-5A30-423B-82FE-1ED410E5769D} = {4BF51C21-5A30-423B-82FE-1ED410E5769D} 
    86                 {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031} 
    87                 {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} = {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} 
    88         EndProjectSection 
    89 EndProject 
    90 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_pjsip", "pjsip\build\test_pjsip.vcproj", "{B3F7D4E9-702F-4EB4-ADA8-098D0A83D770}" 
    91         ProjectSection(ProjectDependencies) = postProject 
    92                 {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} 
    93                 {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
    94                 {B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21} 
    95                 {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} 
    96                 {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 
    97                 {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 
    98                 {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
    99                 {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031} 
    100         EndProjectSection 
    101 EndProject 
    102 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjnath", "pjnath\build\pjnath.vcproj", "{A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4}" 
    103 EndProject 
    104 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgsmcodec", "third_party\build\gsm\libgsmcodec.vcproj", "{E53AA5FF-B737-40AA-BD13-387EFA99023D}" 
    105 EndProject 
    106 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libilbccodec", "third_party\build\ilbc\libilbccodec.vcproj", "{B5FE16F8-3EDB-4110-BD80-B4238CC01E8D}" 
    107 EndProject 
    108 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libportaudio", "third_party\build\portaudio\libportaudio.vcproj", "{3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA}" 
    109 EndProject 
    110 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libresample", "third_party\build\resample\libresample.vcproj", "{6794B975-4E84-4F49-B2DC-C31F2224E03E}" 
    111 EndProject 
    112 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeex", "third_party\build\speex\libspeex.vcproj", "{4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9}" 
    113 EndProject 
    114 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libresample_dll", "third_party\build\resample\libresample_dll.vcproj", "{C48EAAF5-F69E-410B-9CE4-23AB41B00E2A}" 
    115 EndProject 
    116 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmilenage", "third_party\build\milenage\libmilenage.vcproj", "{4BF51C21-5A30-423B-82FE-1ED410E5769D}" 
    117 EndProject 
    118 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsrtp", "third_party\build\srtp\libsrtp.vcproj", "{F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858}" 
    119 EndProject 
    120 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjnath_test", "pjnath\build\pjnath_test.vcproj", "{553C094C-F581-4A80-9540-D5D7B398A2C6}" 
    121         ProjectSection(ProjectDependencies) = postProject 
    122                 {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} 
    123                 {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
    124                 {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
    125         EndProjectSection 
    126 EndProject 
    127 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjmedia_test", "pjmedia\build\pjmedia_test.vcproj", "{21C0CECF-69DD-4F70-BC2B-9B4DE7F15277}" 
    128         ProjectSection(ProjectDependencies) = postProject 
    129                 {E53AA5FF-B737-40AA-BD13-387EFA99023D} = {E53AA5FF-B737-40AA-BD13-387EFA99023D} 
    130                 {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} 
    131                 {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
    132                 {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 
    133                 {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} 
    134                 {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} 
    135                 {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 
    136                 {6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E} 
    137                 {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
    138                 {4BF51C21-5A30-423B-82FE-1ED410E5769D} = {4BF51C21-5A30-423B-82FE-1ED410E5769D} 
    139                 {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} = {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} 
    140         EndProjectSection 
     143        EndProjectSection 
     144EndProject 
     145Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjmedia_audiodev", "pjmedia\build\pjmedia_audiodev.vcproj", "{4281CA5E-1D48-45D4-A991-2718A454B4BA}" 
    141146EndProject 
    142147Global 
     
    386391                {21C0CECF-69DD-4F70-BC2B-9B4DE7F15277}.Release|Windows Mobile 6 Standard SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Standard SDK (ARMV4I) 
    387392                {21C0CECF-69DD-4F70-BC2B-9B4DE7F15277}.Release|Windows Mobile 6 Standard SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Standard SDK (ARMV4I) 
     393                {4281CA5E-1D48-45D4-A991-2718A454B4BA}.Debug|Win32.ActiveCfg = Debug|Win32 
     394                {4281CA5E-1D48-45D4-A991-2718A454B4BA}.Debug|Win32.Build.0 = Debug|Win32 
     395                {4281CA5E-1D48-45D4-A991-2718A454B4BA}.Debug|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Debug|Win32 
     396                {4281CA5E-1D48-45D4-A991-2718A454B4BA}.Release|Win32.ActiveCfg = Release|Win32 
     397                {4281CA5E-1D48-45D4-A991-2718A454B4BA}.Release|Win32.Build.0 = Release|Win32 
     398                {4281CA5E-1D48-45D4-A991-2718A454B4BA}.Release|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Release|Win32 
    388399        EndGlobalSection 
    389400        GlobalSection(SolutionProperties) = preSolution 
  • pjproject/trunk/pjproject.dsw

    r2104 r2506  
    44############################################################################### 
    55 
    6 Project: "libgsmcodec"=.\THIRD_PARTY\BUILD\GSM\libgsmcodec.dsp - Package Owner=<4> 
    7  
    8 Package=<5> 
    9 {{{ 
    10 }}} 
    11  
    12 Package=<4> 
    13 {{{ 
    14 }}} 
    15  
    16 ############################################################################### 
    17  
    18 Project: "libilbccodec"=.\THIRD_PARTY\BUILD\ILBC\libilbccodec.dsp - Package Owner=<4> 
    19  
    20 Package=<5> 
    21 {{{ 
    22 }}} 
    23  
    24 Package=<4> 
    25 {{{ 
    26 }}} 
    27  
    28 ############################################################################### 
    29  
    30 Project: "libmilenage"=.\third_party\build\milenage\libmilenage.dsp - Package Owner=<4> 
    31  
    32 Package=<5> 
    33 {{{ 
    34 }}} 
    35  
    36 Package=<4> 
    37 {{{ 
    38 }}} 
    39  
    40 ############################################################################### 
    41  
    42 Project: "libportaudio"=.\THIRD_PARTY\BUILD\PORTAUDIO\libportaudio.dsp - Package Owner=<4> 
    43  
    44 Package=<5> 
    45 {{{ 
    46 }}} 
    47  
    48 Package=<4> 
    49 {{{ 
    50 }}} 
    51  
    52 ############################################################################### 
    53  
    54 Project: "libresample"=.\THIRD_PARTY\BUILD\RESAMPLE\libresample.dsp - Package Owner=<4> 
    55  
    56 Package=<5> 
    57 {{{ 
    58 }}} 
    59  
    60 Package=<4> 
    61 {{{ 
    62 }}} 
    63  
    64 ############################################################################### 
    65  
    66 Project: "libresample_dll"=.\THIRD_PARTY\BUILD\RESAMPLE\libresample_dll.dsp - Package Owner=<4> 
    67  
    68 Package=<5> 
    69 {{{ 
    70 }}} 
    71  
    72 Package=<4> 
    73 {{{ 
    74 }}} 
    75  
    76 ############################################################################### 
    77  
    78 Project: "libspeex"=.\third_party\build\speex\libspeex.dsp - Package Owner=<4> 
    79  
    80 Package=<5> 
    81 {{{ 
    82 }}} 
    83  
    84 Package=<4> 
    85 {{{ 
    86 }}} 
    87  
    88 ############################################################################### 
    89  
    90 Project: "libsrtp"=.\third_party\build\srtp\libsrtp.dsp - Package Owner=<4> 
    91  
    92 Package=<5> 
    93 {{{ 
    94 }}} 
    95  
    96 Package=<4> 
    97 {{{ 
    98 }}} 
    99  
    100 ############################################################################### 
    101  
    102 Project: "pjlib"=.\pjlib\build\pjlib.dsp - Package Owner=<4> 
    103  
    104 Package=<5> 
    105 {{{ 
    106 }}} 
    107  
    108 Package=<4> 
    109 {{{ 
    110 }}} 
    111  
    112 ############################################################################### 
    113  
    114 Project: "pjlib_test"=.\pjlib\build\pjlib_test.dsp - Package Owner=<4> 
     6Project: "libgsmcodec"=".\THIRD_PARTY\BUILD\GSM\libgsmcodec.dsp" - Package Owner=<4> 
     7 
     8Package=<5> 
     9{{{ 
     10}}} 
     11 
     12Package=<4> 
     13{{{ 
     14}}} 
     15 
     16############################################################################### 
     17 
     18Project: "libilbccodec"=".\THIRD_PARTY\BUILD\ILBC\libilbccodec.dsp" - Package Owner=<4> 
     19 
     20Package=<5> 
     21{{{ 
     22}}} 
     23 
     24Package=<4> 
     25{{{ 
     26}}} 
     27 
     28############################################################################### 
     29 
     30Project: "libmilenage"=".\third_party\build\milenage\libmilenage.dsp" - Package Owner=<4> 
     31 
     32Package=<5> 
     33{{{ 
     34}}} 
     35 
     36Package=<4> 
     37{{{ 
     38}}} 
     39 
     40############################################################################### 
     41 
     42Project: "libportaudio"=".\THIRD_PARTY\BUILD\PORTAUDIO\libportaudio.dsp" - Package Owner=<4> 
     43 
     44Package=<5> 
     45{{{ 
     46}}} 
     47 
     48Package=<4> 
     49{{{ 
     50}}} 
     51 
     52############################################################################### 
     53 
     54Project: "libresample"=".\THIRD_PARTY\BUILD\RESAMPLE\libresample.dsp" - Package Owner=<4> 
     55 
     56Package=<5> 
     57{{{ 
     58}}} 
     59 
     60Package=<4> 
     61{{{ 
     62}}} 
     63 
     64############################################################################### 
     65 
     66Project: "libresample_dll"=".\THIRD_PARTY\BUILD\RESAMPLE\libresample_dll.dsp" - Package Owner=<4> 
     67 
     68Package=<5> 
     69{{{ 
     70}}} 
     71 
     72Package=<4> 
     73{{{ 
     74}}} 
     75 
     76############################################################################### 
     77 
     78Project: "libspeex"=".\third_party\build\speex\libspeex.dsp" - Package Owner=<4> 
     79 
     80Package=<5> 
     81{{{ 
     82}}} 
     83 
     84Package=<4> 
     85{{{ 
     86}}} 
     87 
     88############################################################################### 
     89 
     90Project: "libsrtp"=".\third_party\build\srtp\libsrtp.dsp" - Package Owner=<4> 
     91 
     92Package=<5> 
     93{{{ 
     94}}} 
     95 
     96Package=<4> 
     97{{{ 
     98}}} 
     99 
     100############################################################################### 
     101 
     102Project: "pjlib"=".\pjlib\build\pjlib.dsp" - Package Owner=<4> 
     103 
     104Package=<5> 
     105{{{ 
     106}}} 
     107 
     108Package=<4> 
     109{{{ 
     110}}} 
     111 
     112############################################################################### 
     113 
     114Project: "pjlib_test"=".\pjlib\build\pjlib_test.dsp" - Package Owner=<4> 
    115115 
    116116Package=<5> 
     
    157157############################################################################### 
    158158 
    159 Project: "pjmedia"=.\pjmedia\build\pjmedia.dsp - Package Owner=<4> 
    160  
    161 Package=<5> 
    162 {{{ 
    163 }}} 
    164  
    165 Package=<4> 
    166 {{{ 
    167 }}} 
    168  
    169 ############################################################################### 
    170  
    171 Project: "pjmedia_codec"=.\pjmedia\build\pjmedia_codec.dsp - Package Owner=<4> 
    172  
    173 Package=<5> 
    174 {{{ 
    175 }}} 
    176  
    177 Package=<4> 
    178 {{{ 
    179 }}} 
    180  
    181 ############################################################################### 
    182  
    183 Project: "pjmedia_test"=.\pjmedia\build\pjmedia_test.dsp - Package Owner=<4> 
     159Project: "pjmedia"=".\pjmedia\build\pjmedia.dsp" - Package Owner=<4> 
     160 
     161Package=<5> 
     162{{{ 
     163}}} 
     164 
     165Package=<4> 
     166{{{ 
     167}}} 
     168 
     169############################################################################### 
     170 
     171Project: "pjmedia_audiodev"=".\pjmedia\build\pjmedia_audiodev.dsp" - Package Owner=<4> 
     172 
     173Package=<5> 
     174{{{ 
     175}}} 
     176 
     177Package=<4> 
     178{{{ 
     179}}} 
     180 
     181############################################################################### 
     182 
     183Project: "pjmedia_codec"=".\pjmedia\build\pjmedia_codec.dsp" - Package Owner=<4> 
     184 
     185Package=<5> 
     186{{{ 
     187}}} 
     188 
     189Package=<4> 
     190{{{ 
     191}}} 
     192 
     193############################################################################### 
     194 
     195Project: "pjmedia_test"=".\pjmedia\build\pjmedia_test.dsp" - Package Owner=<4> 
    184196 
    185197Package=<5> 
     
    222234    Project_Dep_Name pjnath 
    223235    End Project Dependency 
    224 }}} 
    225  
    226 ############################################################################### 
    227  
    228 Project: "pjnath"=.\pjnath\build\pjnath.dsp - Package Owner=<4> 
    229  
    230 Package=<5> 
    231 {{{ 
    232 }}} 
    233  
    234 Package=<4> 
    235 {{{ 
    236 }}} 
    237  
    238 ############################################################################### 
    239  
    240 Project: "pjnath_test"=.\pjnath\build\pjnath_test.dsp - Package Owner=<4> 
    241  
    242 Package=<5> 
    243 {{{ 
    244 }}} 
    245  
    246 Package=<4> 
    247 {{{ 
    248     Begin Project Dependency 
    249     Project_Dep_Name pjlib 
    250     End Project Dependency 
    251     Begin Project Dependency 
    252     Project_Dep_Name pjlib_util 
    253     End Project Dependency 
    254     Begin Project Dependency 
    255     Project_Dep_Name pjnath 
    256     End Project Dependency 
    257 }}} 
    258  
    259 ############################################################################### 
    260  
    261 Project: "pjsip_core"=.\pjsip\build\pjsip_core.dsp - Package Owner=<4> 
    262  
    263 Package=<5> 
    264 {{{ 
    265 }}} 
    266  
    267 Package=<4> 
    268 {{{ 
    269 }}} 
    270  
    271 ############################################################################### 
    272  
    273 Project: "pjsip_simple"=.\pjsip\build\pjsip_simple.dsp - Package Owner=<4> 
    274  
    275 Package=<5> 
    276 {{{ 
    277 }}} 
    278  
    279 Package=<4> 
    280 {{{ 
    281 }}} 
    282  
    283 ############################################################################### 
    284  
    285 Project: "pjsip_ua"=.\pjsip\build\pjsip_ua.dsp - Package Owner=<4> 
     236    Begin Project Dependency 
     237    Project_Dep_Name pjmedia_audiodev 
     238    End Project Dependency 
     239}}} 
     240 
     241############################################################################### 
     242 
     243Project: "pjnath"=".\pjnath\build\pjnath.dsp" - Package Owner=<4> 
     244 
     245Package=<5> 
     246{{{ 
     247}}} 
     248 
     249Package=<4> 
     250{{{ 
     251}}} 
     252 
     253############################################################################### 
     254 
     255Project: "pjnath_test"=".\pjnath\build\pjnath_test.dsp" - Package Owner=<4> 
     256 
     257Package=<5> 
     258{{{ 
     259}}} 
     260 
     261Package=<4> 
     262{{{ 
     263    Begin Project Dependency 
     264    Project_Dep_Name pjlib 
     265    End Project Dependency 
     266    Begin Project Dependency 
     267    Project_Dep_Name pjlib_util 
     268    End Project Dependency 
     269    Begin Project Dependency 
     270    Project_Dep_Name pjnath 
     271    End Project Dependency 
     272}}} 
     273 
     274############################################################################### 
     275 
     276Project: "pjsip_core"=".\pjsip\build\pjsip_core.dsp" - Package Owner=<4> 
     277 
     278Package=<5> 
     279{{{ 
     280}}} 
     281 
     282Package=<4> 
     283{{{ 
     284}}} 
     285 
     286############################################################################### 
     287 
     288Project: "pjsip_simple"=".\pjsip\build\pjsip_simple.dsp" - Package Owner=<4> 
     289 
     290Package=<5> 
     291{{{ 
     292}}} 
     293 
     294Package=<4> 
     295{{{ 
     296}}} 
     297 
     298############################################################################### 
     299 
     300Project: "pjsip_ua"=".\pjsip\build\pjsip_ua.dsp" - Package Owner=<4> 
    286301 
    287302Package=<5> 
     
    351366    Project_Dep_Name libsrtp 
    352367    End Project Dependency 
    353 }}} 
    354  
    355 ############################################################################### 
    356  
    357 Project: "pjsua_lib"=.\pjsip\build\pjsua_lib.dsp - Package Owner=<4> 
    358  
    359 Package=<5> 
    360 {{{ 
    361 }}} 
    362  
    363 Package=<4> 
    364 {{{ 
    365 }}} 
    366  
    367 ############################################################################### 
    368  
    369 Project: "pjturn_client"=.\pjnath\build\pjturn_client.dsp - Package Owner=<4> 
    370  
    371 Package=<5> 
    372 {{{ 
    373 }}} 
    374  
    375 Package=<4> 
    376 {{{ 
    377     Begin Project Dependency 
    378     Project_Dep_Name pjlib 
    379     End Project Dependency 
    380     Begin Project Dependency 
    381     Project_Dep_Name pjlib_util 
    382     End Project Dependency 
    383     Begin Project Dependency 
    384     Project_Dep_Name pjnath 
    385     End Project Dependency 
    386 }}} 
    387  
    388 ############################################################################### 
    389  
    390 Project: "pjturn_srv"=.\pjnath\build\pjturn_srv.dsp - Package Owner=<4> 
     368    Begin Project Dependency 
     369    Project_Dep_Name pjmedia_audiodev 
     370    End Project Dependency 
     371}}} 
     372 
     373############################################################################### 
     374 
     375Project: "pjsua_lib"=".\pjsip\build\pjsua_lib.dsp" - Package Owner=<4> 
     376 
     377Package=<5> 
     378{{{ 
     379}}} 
     380 
     381Package=<4> 
     382{{{ 
     383}}} 
     384 
     385############################################################################### 
     386 
     387Project: "pjturn_client"=".\pjnath\build\pjturn_client.dsp" - Package Owner=<4> 
     388 
     389Package=<5> 
     390{{{ 
     391}}} 
     392 
     393Package=<4> 
     394{{{ 
     395    Begin Project Dependency 
     396    Project_Dep_Name pjlib 
     397    End Project Dependency 
     398    Begin Project Dependency 
     399    Project_Dep_Name pjlib_util 
     400    End Project Dependency 
     401    Begin Project Dependency 
     402    Project_Dep_Name pjnath 
     403    End Project Dependency 
     404}}} 
     405 
     406############################################################################### 
     407 
     408Project: "pjturn_srv"=".\pjnath\build\pjturn_srv.dsp" - Package Owner=<4> 
    391409 
    392410Package=<5> 
     
    439457    End Project Dependency 
    440458    Begin Project Dependency 
     459    Project_Dep_Name libgsmcodec 
     460    End Project Dependency 
     461    Begin Project Dependency 
     462    Project_Dep_Name libilbccodec 
     463    End Project Dependency 
     464    Begin Project Dependency 
     465    Project_Dep_Name libportaudio 
     466    End Project Dependency 
     467    Begin Project Dependency 
     468    Project_Dep_Name libresample 
     469    End Project Dependency 
     470    Begin Project Dependency 
     471    Project_Dep_Name libspeex 
     472    End Project Dependency 
     473    Begin Project Dependency 
     474    Project_Dep_Name pjnath 
     475    End Project Dependency 
     476    Begin Project Dependency 
     477    Project_Dep_Name libsrtp 
     478    End Project Dependency 
     479    Begin Project Dependency 
     480    Project_Dep_Name pjmedia_audiodev 
     481    End Project Dependency 
     482}}} 
     483 
     484############################################################################### 
     485 
     486Project: "samples"=".\pjsip-apps\build\samples.dsp" - Package Owner=<4> 
     487 
     488Package=<5> 
     489{{{ 
     490}}} 
     491 
     492Package=<4> 
     493{{{ 
     494    Begin Project Dependency 
     495    Project_Dep_Name pjlib 
     496    End Project Dependency 
     497    Begin Project Dependency 
     498    Project_Dep_Name pjlib_util 
     499    End Project Dependency 
     500    Begin Project Dependency 
     501    Project_Dep_Name pjmedia 
     502    End Project Dependency 
     503    Begin Project Dependency 
     504    Project_Dep_Name pjmedia_codec 
     505    End Project Dependency 
     506    Begin Project Dependency 
     507    Project_Dep_Name pjsip_core 
     508    End Project Dependency 
     509    Begin Project Dependency 
     510    Project_Dep_Name pjsip_simple 
     511    End Project Dependency 
     512    Begin Project Dependency 
     513    Project_Dep_Name pjsip_ua 
     514    End Project Dependency 
     515    Begin Project Dependency 
    441516    Project_Dep_Name pjsua_lib 
    442517    End Project Dependency 
     
    462537    Project_Dep_Name libsrtp 
    463538    End Project Dependency 
    464 }}} 
    465  
    466 ############################################################################### 
    467  
    468 Project: "samples"=".\pjsip-apps\build\samples.dsp" - Package Owner=<4> 
     539    Begin Project Dependency 
     540    Project_Dep_Name pjmedia_audiodev 
     541    End Project Dependency 
     542}}} 
     543 
     544############################################################################### 
     545 
     546Project: "test_pjsip"=".\pjsip\build\test_pjsip.dsp" - Package Owner=<4> 
    469547 
    470548Package=<5> 
     
    498576    Project_Dep_Name pjsua_lib 
    499577    End Project Dependency 
    500     Begin Project Dependency 
    501     Project_Dep_Name libgsmcodec 
    502     End Project Dependency 
    503     Begin Project Dependency 
    504     Project_Dep_Name libilbccodec 
    505     End Project Dependency 
    506     Begin Project Dependency 
    507     Project_Dep_Name libportaudio 
    508     End Project Dependency 
    509     Begin Project Dependency 
    510     Project_Dep_Name libresample 
    511     End Project Dependency 
    512     Begin Project Dependency 
    513     Project_Dep_Name libspeex 
    514     End Project Dependency 
    515     Begin Project Dependency 
    516     Project_Dep_Name pjnath 
    517     End Project Dependency 
    518     Begin Project Dependency 
    519     Project_Dep_Name libsrtp 
    520     End Project Dependency 
    521 }}} 
    522  
    523 ############################################################################### 
    524  
    525 Project: "test_pjsip"=.\pjsip\build\test_pjsip.dsp - Package Owner=<4> 
    526  
    527 Package=<5> 
    528 {{{ 
    529 }}} 
    530  
    531 Package=<4> 
    532 {{{ 
    533     Begin Project Dependency 
    534     Project_Dep_Name pjlib 
    535     End Project Dependency 
    536     Begin Project Dependency 
    537     Project_Dep_Name pjlib_util 
    538     End Project Dependency 
    539     Begin Project Dependency 
    540     Project_Dep_Name pjmedia 
    541     End Project Dependency 
    542     Begin Project Dependency 
    543     Project_Dep_Name pjmedia_codec 
    544     End Project Dependency 
    545     Begin Project Dependency 
    546     Project_Dep_Name pjsip_core 
    547     End Project Dependency 
    548     Begin Project Dependency 
    549     Project_Dep_Name pjsip_simple 
    550     End Project Dependency 
    551     Begin Project Dependency 
    552     Project_Dep_Name pjsip_ua 
    553     End Project Dependency 
    554     Begin Project Dependency 
    555     Project_Dep_Name pjsua_lib 
    556     End Project Dependency 
    557578}}} 
    558579 
  • pjproject/trunk/pjsip-apps/build/Makefile

    r2183 r2506  
    99PJNATH_LIB:=../../pjnath/lib/libpjnath-$(TARGET_NAME)$(LIBEXT) 
    1010PJMEDIA_LIB:=../../pjmedia/lib/libpjmedia-$(TARGET_NAME)$(LIBEXT) 
     11PJMEDIA_AUDIODEV_LIB:=../../pjmedia/lib/libpjmedia-audiodev-$(TARGET_NAME)$(LIBEXT) 
    1112PJMEDIA_CODEC_LIB:=../../pjmedia/lib/libpjmedia-codec-$(TARGET_NAME)$(LIBEXT) 
    1213PJSIP_LIB:=../../pjsip/lib/libpjsip-$(TARGET_NAME)$(LIBEXT) 
  • pjproject/trunk/pjsip-apps/build/Samples-vc.mak

    r2178 r2506  
    1414PJMEDIA_LIB = ..\..\pjmedia\lib\pjmedia-$(TARGET)$(LIBEXT) 
    1515PJMEDIA_CODEC_LIB = ..\..\pjmedia\lib\pjmedia-codec-$(TARGET)$(LIBEXT) 
     16PJMEDIA_AUDIODEV_LIB = ..\..\pjmedia\lib\pjmedia-audiodev-$(TARGET)$(LIBEXT) 
    1617PJSIP_LIB = ..\..\pjsip\lib\pjsip-core-$(TARGET)$(LIBEXT) 
    1718PJSIP_UA_LIB = ..\..\pjsip\lib\pjsip-ua-$(TARGET)$(LIBEXT) 
     
    3031 
    3132LIBS = $(PJSUA_LIB_LIB) $(PJSIP_UA_LIB) $(PJSIP_SIMPLE_LIB) \ 
    32           $(PJSIP_LIB) $(PJMEDIA_CODEC_LIB) $(PJMEDIA_LIB) $(PJNATH_LIB) \ 
    33           $(PJLIB_UTIL_LIB) $(PJLIB_LIB) \ 
     33          $(PJSIP_LIB) $(PJMEDIA_CODEC_LIB) $(PJMEDIA_AUDIODEV_LIB) \ 
     34          $(PJMEDIA_LIB) $(PJNATH_LIB) $(PJLIB_UTIL_LIB) $(PJLIB_LIB) \ 
    3435          $(THIRD_PARTY_LIBS) 
    3536 
     
    5051 
    5152 
    52 SAMPLES = $(BINDIR)\confsample.exe \ 
     53SAMPLES = $(BINDIR)\auddemo.exe \ 
     54          $(BINDIR)\confsample.exe \ 
    5355          $(BINDIR)\confbench.exe \ 
    5456          $(BINDIR)\encdec.exe \ 
     
    6668          $(BINDIR)\siprtp.exe \ 
    6769          $(BINDIR)\sipstateless.exe \ 
    68           $(BINDIR)\sndinfo.exe \ 
    69           $(BINDIR)\sndtest.exe \ 
    7070          $(BINDIR)\stateful_proxy.exe \ 
    7171          $(BINDIR)\stateless_proxy.exe \ 
  • pjproject/trunk/pjsip-apps/build/Samples.mak

    r2183 r2506  
    1414BINDIR := ../bin/samples 
    1515 
    16 SAMPLES := confsample \ 
     16SAMPLES := auddemo \ 
     17           confsample \ 
    1718           encdec \ 
    1819           latency \ 
     
    2930           siprtp \ 
    3031           sipstateless \ 
    31            sndinfo \ 
    32            sndtest \ 
    3332           stateful_proxy \ 
    3433           stateless_proxy \ 
  • pjproject/trunk/pjsip-apps/build/sample_debug.dsp

    r1765 r2506  
    9191 
    9292SOURCE=..\src\samples\debug.c 
    93  
    94 !IF  "$(CFG)" == "sample_debug - Win32 Release" 
    95  
    96 !ELSEIF  "$(CFG)" == "sample_debug - Win32 Debug" 
    97  
    98 !ENDIF  
    99  
    10093# End Source File 
    10194# End Group 
  • pjproject/trunk/pjsip-apps/build/samples.dsp

    r2178 r2506  
    9191# Begin Source File 
    9292 
     93SOURCE=..\src\samples\auddemo.c 
     94# End Source File 
     95# Begin Source File 
     96 
    9397SOURCE=..\src\samples\confbench.c 
    9498# End Source File 
  • pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c

    r2505 r2506  
    41594159    app_config.cfg.cb.on_nat_detect = &on_nat_detect; 
    41604160 
     4161    /* Set sound device latency */ 
     4162    if (app_config.capture_lat > 0) 
     4163        app_config.media_cfg.snd_rec_latency = app_config.capture_lat; 
     4164    if (app_config.playback_lat) 
     4165        app_config.media_cfg.snd_play_latency = app_config.playback_lat; 
     4166 
    41614167    /* Initialize pjsua */ 
    41624168    status = pjsua_init(&app_config.cfg, &app_config.log_cfg, 
     
    44234429    if (status != PJ_SUCCESS) 
    44244430        goto on_error; 
    4425  
    4426     /* Set sound device latency */ 
    4427     pjmedia_snd_set_latency(app_config.capture_lat, app_config.playback_lat); 
    44284431 
    44294432    /* Use null sound device? */ 
  • pjproject/trunk/pjsip-apps/src/samples/debug.c

    r2394 r2506  
    2929 *  #include "playfile.c" 
    3030 */ 
    31 #include "aectest.c" 
     31#include "auddemo.c" 
    3232 
  • pjproject/trunk/pjsip-apps/src/symbian_ua/main_symbian.cpp

    r2394 r2506  
    3030 
    3131// Needed by APS 
    32 TPtrC APP_UID = _L("A000000D"); 
     32TPtrC APP_UID = _L("200235D3"); 
    3333 
    3434 
  • pjproject/trunk/pjsip-apps/src/symbian_ua/ua.cpp

    r2481 r2506  
    2020#include <pjsua-lib/pjsua.h> 
    2121#include <pjsua-lib/pjsua_internal.h> 
     22//#include <pjmedia/symbian_sound_aps.h> 
    2223#include "ua.h" 
    2324 
    2425#define THIS_FILE       "symbian_ua.cpp" 
    25 #define LOG_LEVEL       3 
     26#define CON_LOG_LEVEL   3 // console log level 
     27#define FILE_LOG_LEVEL  4 // logfile log level 
    2628 
    2729// 
     
    281283     
    282284    /* Set log level */ 
    283     pj_log_set_level(LOG_LEVEL); 
     285    pj_log_set_level(CON_LOG_LEVEL); 
    284286 
    285287    /* Create pjsua first! */ 
     
    329331     
    330332    pjsua_logging_config_default(&log_cfg); 
    331     log_cfg.level = LOG_LEVEL; 
    332     log_cfg.console_level = LOG_LEVEL; 
     333    log_cfg.level = FILE_LOG_LEVEL; 
     334    log_cfg.console_level = CON_LOG_LEVEL; 
    333335    log_cfg.cb = &log_writer; 
    334     //log_cfg.log_filename = pj_str("C:\\data\\symbian_ua.log"); 
     336    log_cfg.log_filename = pj_str("C:\\data\\symbian_ua.log"); 
    335337 
    336338    pjsua_media_config_default(&med_cfg); 
     
    338340    med_cfg.has_ioqueue = PJ_FALSE; 
    339341    med_cfg.clock_rate = 8000; 
    340 #if defined(PJMEDIA_SYM_SND_USE_APS) && (PJMEDIA_SYM_SND_USE_APS==1) 
    341     med_cfg.audio_frame_ptime = 20; 
    342 #else 
    343342    med_cfg.audio_frame_ptime = 40; 
    344 #endif 
    345343    med_cfg.ec_tail_len = 0; 
    346344    med_cfg.enable_ice = USE_ICE; 
    347     med_cfg.snd_auto_close_time = 5; // wait for 5 seconds idle before sound dev get auto-closed 
     345    med_cfg.snd_auto_close_time = 0; // wait for 0 seconds idle before sound dev get auto-closed 
     346    //med_cfg.no_vad = PJ_TRUE; 
    348347     
    349348    status = pjsua_init(&cfg, &log_cfg, &med_cfg); 
     
    492491} 
    493492 
    494 static void PrintMenu()  
    495 { 
    496     PJ_LOG(3, (THIS_FILE, "\n\n" 
    497             "Menu:\n" 
    498             "  d    Dump states\n" 
    499             "  D    Dump states detail\n" 
    500             "  P    Dump pool factory\n" 
    501             "  l    Start loopback audio device\n" 
    502             "  L    Stop loopback audio device\n" 
     493static void PrintMainMenu()  
     494{ 
     495    const char *menu = 
     496            "\n\n" 
     497            "Main Menu:\n" 
     498            "  d    Enable/disable codecs\n" 
    503499            "  m    Call " SIP_DST_URI "\n" 
    504500            "  a    Answer call\n" 
    505501            "  g    Hangup all calls\n" 
     502            "  t    Toggle audio route\n" 
     503#if !defined(PJMEDIA_CONF_USE_SWITCH_BOARD) || PJMEDIA_CONF_USE_SWITCH_BOARD==0 
     504            "  j    Toggle loopback audio\n" 
     505#endif 
     506            "up/dn  Increase/decrease output volume\n" 
    506507            "  s    Subscribe " SIP_DST_URI "\n" 
    507508            "  S    Unsubscribe presence\n" 
    508509            "  o    Set account online\n" 
    509510            "  O    Set account offline\n" 
    510             "  w    Quit\n")); 
     511            "  w    Quit\n"; 
     512     
     513    PJ_LOG(3, (THIS_FILE, menu)); 
     514} 
     515 
     516static void PrintCodecMenu()  
     517{ 
     518    const char *menu =  
     519            "\n\n" 
     520            "Codec Menu:\n" 
     521            "  a    Enable all codecs\n" 
     522#if PJMEDIA_HAS_PASSTHROUGH_CODEC_AMR 
     523            "  d    Enable only AMR\n" 
     524#endif 
     525#if PJMEDIA_HAS_PASSTHROUGH_CODEC_G729 
     526            "  g    Enable only G.729\n" 
     527#endif 
     528#if PJMEDIA_HAS_PASSTHROUGH_CODEC_ILBC 
     529            "  j    Enable only iLBC\n" 
     530#endif 
     531            "  m    Enable only Speex\n" 
     532            "  p    Enable only GSM\n" 
     533            "  t    Enable only PCMU\n" 
     534            "  w    Enable only PCMA\n"; 
     535     
     536    PJ_LOG(3, (THIS_FILE, menu)); 
     537} 
     538 
     539static void HandleMainMenu(TKeyCode kc) { 
     540    switch (kc) { 
     541     
     542    case EKeyUpArrow: 
     543    case EKeyDownArrow: 
     544        { 
     545            unsigned vol; 
     546            pj_status_t status; 
     547             
     548            status = pjsua_snd_get_setting( 
     549                             PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING, &vol); 
     550            if (status == PJ_SUCCESS) { 
     551                if (kc == EKeyUpArrow) 
     552                    vol = PJ_MIN(100, vol+10); 
     553                else 
     554                    vol = (vol>=10 ? vol-10 : 0); 
     555                status = pjsua_snd_set_setting( 
     556                                    PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING, 
     557                                    &vol, PJ_TRUE); 
     558            } 
     559 
     560            if (status == PJ_SUCCESS) { 
     561                PJ_LOG(3,(THIS_FILE, "Output volume set to %d", vol)); 
     562            } else { 
     563                pjsua_perror(THIS_FILE, "Error setting volume", status); 
     564            } 
     565        } 
     566        break; 
     567     
     568    case 't': 
     569        { 
     570            pjmedia_aud_dev_route route; 
     571            pj_status_t status; 
     572             
     573            status = pjsua_snd_get_setting(PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE,  
     574                                           &route); 
     575             
     576            if (status == PJ_SUCCESS) { 
     577                if (route == PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER) 
     578                    route = PJMEDIA_AUD_DEV_ROUTE_EARPIECE; 
     579                else 
     580                    route = PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER; 
     581 
     582                status = pjsua_snd_set_setting( 
     583                                    PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE, 
     584                                    &route, PJ_TRUE); 
     585            } 
     586 
     587            if (status != PJ_SUCCESS) 
     588                pjsua_perror(THIS_FILE, "Error switch audio route", status); 
     589        } 
     590        break; 
     591         
     592    case 'j': 
     593        { 
     594            static pj_bool_t loopback_active = PJ_FALSE; 
     595            if (!loopback_active) 
     596                pjsua_conf_connect(0, 0); 
     597            else 
     598                pjsua_conf_disconnect(0, 0); 
     599            loopback_active = !loopback_active; 
     600        } 
     601        break; 
     602         
     603    case 'm': 
     604        if (g_call_id != PJSUA_INVALID_ID) { 
     605                PJ_LOG(3,(THIS_FILE, "Another call is active"));         
     606                break; 
     607        } 
     608 
     609        if (pjsua_verify_sip_url(SIP_DST_URI) == PJ_SUCCESS) { 
     610                pj_str_t dst = pj_str(SIP_DST_URI); 
     611                pjsua_call_make_call(g_acc_id, &dst, 0, NULL, 
     612                                     NULL, &g_call_id); 
     613        } else { 
     614                PJ_LOG(3,(THIS_FILE, "Invalid SIP URI")); 
     615        } 
     616        break; 
     617    case 'a': 
     618        if (g_call_id != PJSUA_INVALID_ID) 
     619                pjsua_call_answer(g_call_id, 200, NULL, NULL); 
     620        break; 
     621    case 'g': 
     622        pjsua_call_hangup_all(); 
     623        break; 
     624    case 's': 
     625    case 'S': 
     626        if (g_buddy_id != PJSUA_INVALID_ID) 
     627                pjsua_buddy_subscribe_pres(g_buddy_id, kc=='s'); 
     628        break; 
     629    case 'o': 
     630    case 'O': 
     631        pjsua_acc_set_online_status(g_acc_id, kc=='o'); 
     632        break; 
     633             
     634    default: 
     635        PJ_LOG(3,(THIS_FILE, "Keycode '%c' (%d) is pressed", kc, kc)); 
     636        break; 
     637    } 
     638 
     639    PrintMainMenu(); 
     640} 
     641 
     642static void HandleCodecMenu(TKeyCode kc) { 
     643    const pj_str_t ID_ALL = {"*", 1}; 
     644    pj_str_t codec = {NULL, 0}; 
     645     
     646    if (kc == 'a') { 
     647        pjsua_codec_set_priority(&ID_ALL, PJMEDIA_CODEC_PRIO_NORMAL); 
     648        PJ_LOG(3,(THIS_FILE, "All codecs activated")); 
     649    } else { 
     650        switch (kc) { 
     651        case 'd': 
     652            codec = pj_str("AMR"); 
     653            break; 
     654        case 'g': 
     655            codec = pj_str("G729"); 
     656            break; 
     657        case 'j': 
     658            codec = pj_str("ILBC"); 
     659            break; 
     660        case 'm': 
     661            codec = pj_str("SPEEX/8000"); 
     662            break; 
     663        case 'p': 
     664            codec = pj_str("GSM"); 
     665            break; 
     666        case 't': 
     667            codec = pj_str("PCMU"); 
     668            break; 
     669        case 'w': 
     670            codec = pj_str("PCMA"); 
     671            break; 
     672        default: 
     673            PJ_LOG(3,(THIS_FILE, "Keycode '%c' (%d) is pressed", kc, kc)); 
     674            break; 
     675        } 
     676 
     677        if (codec.slen) { 
     678            pj_status_t status; 
     679             
     680            pjsua_codec_set_priority(&ID_ALL, PJMEDIA_CODEC_PRIO_DISABLED); 
     681                 
     682            status = pjsua_codec_set_priority(&codec,  
     683                                              PJMEDIA_CODEC_PRIO_NORMAL); 
     684            if (status == PJ_SUCCESS) 
     685                PJ_LOG(3,(THIS_FILE, "%s activated", codec.ptr)); 
     686            else 
     687                PJ_LOG(3,(THIS_FILE, "Failed activating %s, err=%d",  
     688                          codec.ptr, status)); 
     689        } 
     690    } 
    511691} 
    512692 
     
    514694void ConsoleUI::RunL()  
    515695{ 
     696    enum { 
     697        MENU_TYPE_MAIN = 0, 
     698        MENU_TYPE_CODEC = 1 
     699    }; 
     700    static int menu_type = MENU_TYPE_MAIN; 
    516701    TKeyCode kc = con_->KeyCode(); 
    517702    pj_bool_t reschedule = PJ_TRUE; 
    518703     
    519     switch (kc) { 
    520     case 'w': 
     704    if (menu_type == MENU_TYPE_MAIN) { 
     705        if (kc == 'w') { 
    521706            CActiveScheduler::Stop(); 
    522707            reschedule = PJ_FALSE; 
    523             break; 
    524     case 'D': 
    525     case 'd': 
    526             pjsua_dump(kc == 'D'); 
    527             break; 
    528     case 'p': 
    529     case 'P': 
    530             pj_pool_factory_dump(pjsua_get_pool_factory(), PJ_TRUE); 
    531             break; 
    532     case 'l': 
    533                 pjsua_conf_connect(0, 0); 
    534             break; 
    535     case 'L': 
    536                 pjsua_conf_disconnect(0, 0); 
    537             break; 
    538     case 'm': 
    539             if (g_call_id != PJSUA_INVALID_ID) { 
    540                     PJ_LOG(3,(THIS_FILE, "Another call is active"));     
    541                     break; 
    542             } 
    543      
    544             if (pjsua_verify_sip_url(SIP_DST_URI) == PJ_SUCCESS) { 
    545                     pj_str_t dst = pj_str(SIP_DST_URI); 
    546                     pjsua_call_make_call(g_acc_id, &dst, 0, NULL, 
    547                                          NULL, &g_call_id); 
    548             } else { 
    549                     PJ_LOG(3,(THIS_FILE, "Invalid SIP URI")); 
    550             } 
    551             break; 
    552     case 'a': 
    553             if (g_call_id != PJSUA_INVALID_ID) 
    554                     pjsua_call_answer(g_call_id, 200, NULL, NULL); 
    555             break; 
    556     case 'g': 
    557             pjsua_call_hangup_all(); 
    558             break; 
    559     case 's': 
    560     case 'S': 
    561             if (g_buddy_id != PJSUA_INVALID_ID) 
    562                     pjsua_buddy_subscribe_pres(g_buddy_id, kc=='s'); 
    563             break; 
    564     case 'o': 
    565     case 'O': 
    566             pjsua_acc_set_online_status(g_acc_id, kc=='o'); 
    567             break; 
    568     default: 
    569             PJ_LOG(3,(THIS_FILE, "Keycode '%c' (%d) is pressed", 
    570                       kc, kc)); 
    571             break; 
    572     } 
    573  
    574     PrintMenu(); 
     708        } else if (kc == 'd') { 
     709            menu_type = MENU_TYPE_CODEC; 
     710            PrintCodecMenu(); 
     711        } else { 
     712            HandleMainMenu(kc); 
     713        } 
     714    } else { 
     715        HandleCodecMenu(kc); 
     716         
     717        menu_type = MENU_TYPE_MAIN; 
     718        PrintMainMenu(); 
     719    } 
    575720     
    576721    if (reschedule) 
     
    816961             
    817962            PJ_LOG(3, (THIS_FILE, "PJSUA restarted.")); 
    818             PrintMenu(); 
     963            PrintMainMenu(); 
    819964        } 
    820965         
     
    8741019     
    8751020    con->Run(); 
    876     PrintMenu(); 
     1021    PrintMainMenu(); 
    8771022 
    8781023    // Init & start connection monitor 
     
    9111056    aConn.Close(); 
    9121057    aSocketServer.Close(); 
    913          
     1058     
    9141059    return status; 
    9151060} 
  • pjproject/trunk/pjsip-apps/src/symbian_ua_gui/group/symbian_ua_gui.mmp

    r2257 r2506  
    4040STATICLIBRARY   pjsua_lib.lib pjsip_ua.lib 
    4141STATICLIBRARY   pjsip_simple.lib pjsip.lib pjsdp.lib pjmedia.lib 
     42STATICLIBRARY   pjmedia_audiodev.lib 
    4243STATICLIBRARY   pjnath.lib pjlib_util.lib pjlib.lib 
    4344STATICLIBRARY   libsrtp.lib 
     
    5051    CAPABILITY          NetworkServices LocalServices ReadUserData WriteUserData UserEnvironment  
    5152#elif SND_USE_APS 
    52     STATICLIBRARY       symbian_audio_aps.lib 
    53     LIBRARY             APSSession2.lib 
     53    LIBRARY                     APSSession2.lib 
    5454    CAPABILITY          NetworkServices LocalServices ReadUserData WriteUserData UserEnvironment MultimediaDD 
    55     MACRO               PJMEDIA_SYM_SND_USE_APS=1 
     55    MACRO                       PJMEDIA_SYM_SND_USE_APS=1 
    5656#else 
    57     STATICLIBRARY       symbian_audio.lib 
    5857    LIBRARY             mediaclientaudiostream.lib 
    5958    LIBRARY             mediaclientaudioinputstream.lib 
  • pjproject/trunk/pjsip-apps/src/symsndtest/app_main.cpp

    r2394 r2506  
    5050 
    5151    PJ_UNUSED_ARG(level); 
    52      
     52 
    5353    pj_ansi_to_unicode(buf, len, buf16, PJ_ARRAY_SIZE(buf16)); 
    5454 
     
    5858 
    5959/* perror util */ 
    60 static void app_perror(const char *title, pj_status_t status)  
    61 { 
    62     char errmsg[PJ_ERR_MSG_SIZE];        
     60static void app_perror(const char *title, pj_status_t status) 
     61{ 
     62    char errmsg[PJ_ERR_MSG_SIZE]; 
    6363    pj_strerror(status, errmsg, sizeof(errmsg)); 
    6464    PJ_LOG(1,(THIS_FILE, "Error: %s: %s", title, errmsg)); 
     
    6666 
    6767/* Application init */ 
    68 static pj_status_t app_init()  
     68static pj_status_t app_init() 
    6969{ 
    7070    unsigned i, count; 
    7171    pj_status_t status; 
    72     
     72 
    7373    /* Redirect log */ 
    7474    pj_log_set_log_func((void (*)(int,const char*,int)) &log_writer); 
    7575    pj_log_set_decor(PJ_LOG_HAS_NEWLINE); 
    7676    pj_log_set_level(3); 
    77      
     77 
    7878    /* Init pjlib */ 
    7979    status = pj_init(); 
     
    8484 
    8585    pj_caching_pool_init(&cp, NULL, 0); 
    86      
     86 
    8787    /* Init sound subsystem */ 
    8888    status = pjmedia_snd_init(&cp.factory); 
     
    9393        return status; 
    9494    } 
    95      
     95 
    9696    count = pjmedia_snd_get_dev_count(); 
    9797    PJ_LOG(3,(THIS_FILE, "Device count: %d", count)); 
    9898    for (i=0; i<count; ++i) { 
    9999        const pjmedia_snd_dev_info *info; 
    100          
     100 
    101101        info = pjmedia_snd_get_dev_info(i); 
    102102        PJ_LOG(3, (THIS_FILE, "%d: %s %d/%d %dHz", 
    103103                   i, info->name, info->input_count, info->output_count, 
    104                    info->default_samples_per_sec));      
     104                   info->default_samples_per_sec)); 
    105105    } 
    106106 
     
    115115 
    116116    /* Init delay buffer */ 
    117     status = pjmedia_delay_buf_create(pool, THIS_FILE, CLOCK_RATE,  
    118                                       SAMPLES_PER_FRAME, CHANNEL_COUNT,  
     117    status = pjmedia_delay_buf_create(pool, THIS_FILE, CLOCK_RATE, 
     118                                      SAMPLES_PER_FRAME, CHANNEL_COUNT, 
    119119                                      0, 0, &delaybuf); 
    120120    if (status != PJ_SUCCESS) { 
     
    124124        //return status; 
    125125    } 
    126      
     126 
    127127    return PJ_SUCCESS; 
    128128} 
     
    130130 
    131131/* Sound capture callback */ 
    132 static pj_status_t rec_cb(void *user_data,  
     132static pj_status_t rec_cb(void *user_data, 
    133133                          pj_uint32_t timestamp, 
    134134                          void *input, 
    135                           unsigned size)  
     135                          unsigned size) 
    136136{ 
    137137    PJ_UNUSED_ARG(user_data); 
     
    154154                           pj_uint32_t timestamp, 
    155155                           void *output, 
    156                            unsigned size)  
     156                           unsigned size) 
    157157{ 
    158158    PJ_UNUSED_ARG(user_data); 
    159159    PJ_UNUSED_ARG(timestamp); 
    160160    PJ_UNUSED_ARG(size); 
    161      
     161 
    162162    pjmedia_delay_buf_get(delaybuf, (pj_int16_t*)output); 
    163      
     163 
    164164    ++play_cnt; 
    165     return PJ_SUCCESS;   
     165    return PJ_SUCCESS; 
    166166} 
    167167 
    168168/* Start sound */ 
    169 static pj_status_t snd_start(unsigned flag)  
     169static pj_status_t snd_start(unsigned flag) 
    170170{ 
    171171    pj_status_t status; 
    172      
     172 
    173173    if (strm != NULL) { 
    174174        app_perror("snd already open", PJ_EINVALIDOP); 
    175175        return PJ_EINVALIDOP; 
    176176    } 
    177      
     177 
    178178    if (flag==PJMEDIA_DIR_CAPTURE_PLAYBACK) 
    179179        status = pjmedia_snd_open(-1, -1, CLOCK_RATE, CHANNEL_COUNT, 
     
    188188                                         SAMPLES_PER_FRAME, BITS_PER_SAMPLE, 
    189189                                         &play_cb, NULL, &strm); 
    190                           
     190 
    191191    if (status != PJ_SUCCESS) { 
    192192        app_perror("snd open", status); 
     
    211211 
    212212/* Stop sound */ 
    213 static pj_status_t snd_stop()  
     213static pj_status_t snd_stop() 
    214214{ 
    215215    pj_time_val now; 
    216216    pj_status_t status; 
    217      
     217 
    218218    if (strm == NULL) { 
    219219        app_perror("snd not open", PJ_EINVALIDOP); 
    220220        return PJ_EINVALIDOP; 
    221221    } 
    222      
     222 
     223    status = pjmedia_snd_stream_stop(strm); 
     224    if (status != PJ_SUCCESS) { 
     225        app_perror("snd failed to stop", status); 
     226    } 
    223227    status = pjmedia_snd_stream_close(strm); 
    224228    strm = NULL; 
    225      
     229 
    226230    pj_gettimeofday(&now); 
    227231    PJ_TIME_VAL_SUB(now, t_start); 
     
    235239 
    236240/* Shutdown application */ 
    237 static void app_fini()  
     241static void app_fini() 
    238242{ 
    239243    if (strm) 
    240244        snd_stop(); 
    241      
     245 
    242246    pjmedia_snd_deinit(); 
    243247    pjmedia_delay_buf_destroy(delaybuf); 
     
    254258#include <e32base.h> 
    255259 
    256 class ConsoleUI : public CActive  
     260class ConsoleUI : public CActive 
    257261{ 
    258262public: 
    259     ConsoleUI(CActiveSchedulerWait *asw, CConsoleBase *con); 
     263    ConsoleUI(CConsoleBase *con); 
    260264 
    261265    // Run console UI 
     
    264268    // Stop 
    265269    void Stop(); 
    266      
     270 
    267271protected: 
    268272    // Cancel asynchronous read. 
     
    271275    // Implementation: called when read has completed. 
    272276    void RunL(); 
    273      
     277 
    274278private: 
    275     CActiveSchedulerWait *asw_; 
    276279    CConsoleBase *con_; 
    277280}; 
    278281 
    279282 
    280 ConsoleUI::ConsoleUI(CActiveSchedulerWait *asw, CConsoleBase *con)  
    281 : CActive(EPriorityHigh), asw_(asw), con_(con) 
     283ConsoleUI::ConsoleUI(CConsoleBase *con) 
     284: CActive(EPriorityUserInput), con_(con) 
    282285{ 
    283286    CActiveScheduler::Add(this); 
     
    285288 
    286289// Run console UI 
    287 void ConsoleUI::Run()  
     290void ConsoleUI::Run() 
    288291{ 
    289292    con_->Read(iStatus); 
     
    292295 
    293296// Stop console UI 
    294 void ConsoleUI::Stop()  
     297void ConsoleUI::Stop() 
    295298{ 
    296299    DoCancel(); 
     
    298301 
    299302// Cancel asynchronous read. 
    300 void ConsoleUI::DoCancel()  
     303void ConsoleUI::DoCancel() 
    301304{ 
    302305    con_->ReadCancel(); 
    303306} 
    304307 
    305 static void PrintMenu()  
     308static void PrintMenu() 
    306309{ 
    307310    PJ_LOG(3, (THIS_FILE, "\n\n" 
     
    315318 
    316319// Implementation: called when read has completed. 
    317 void ConsoleUI::RunL()  
     320void ConsoleUI::RunL() 
    318321{ 
    319322    TKeyCode kc = con_->KeyCode(); 
    320323    pj_bool_t reschedule = PJ_TRUE; 
    321      
     324 
    322325    switch (kc) { 
    323326    case 'w': 
    324             asw_->AsyncStop(); 
     327            snd_stop(); 
     328            CActiveScheduler::Stop(); 
    325329            reschedule = PJ_FALSE; 
    326330            break; 
     
    344348 
    345349    PrintMenu(); 
    346      
     350 
    347351    if (reschedule) 
    348352        Run(); 
     
    351355 
    352356//////////////////////////////////////////////////////////////////////////// 
    353 int app_main()  
     357int app_main() 
    354358{ 
    355359    if (app_init() != PJ_SUCCESS) 
    356360        return -1; 
    357      
     361 
    358362    // Run the UI 
    359     CActiveSchedulerWait *asw = new CActiveSchedulerWait; 
    360     ConsoleUI *con = new ConsoleUI(asw, console); 
    361      
     363    ConsoleUI *con = new ConsoleUI(console); 
     364 
    362365    con->Run(); 
    363      
     366 
    364367    PrintMenu(); 
    365     asw->Start(); 
    366      
     368    CActiveScheduler::Start(); 
     369 
    367370    delete con; 
    368     delete asw; 
    369      
     371 
    370372    app_fini(); 
    371373    return 0; 
  • pjproject/trunk/pjsip-apps/src/symsndtest/main_symbian.cpp

    r2394 r2506  
    3030 
    3131// Needed by APS 
    32 TPtrC APP_UID = _L("A000000D"); 
     32TPtrC APP_UID = _L("A000000E"); 
    3333 
    3434int app_main(); 
    3535 
    36  
    37 //////////////////////////////////////////////////////////////////////////// 
    38 class MyTask : public CActive 
    39 { 
    40 public: 
    41     static MyTask *NewL(CActiveSchedulerWait *asw); 
    42     ~MyTask(); 
    43     void Start(); 
    44  
    45 protected: 
    46     MyTask(CActiveSchedulerWait *asw); 
    47     void ConstructL(); 
    48     virtual void RunL(); 
    49     virtual void DoCancel(); 
    50  
    51 private: 
    52     RTimer timer_; 
    53     CActiveSchedulerWait *asw_; 
    54 }; 
    55  
    56 MyTask::MyTask(CActiveSchedulerWait *asw) 
    57 : CActive(EPriorityNormal), asw_(asw) 
    58 { 
    59 } 
    60  
    61 MyTask::~MyTask()  
    62 { 
    63     timer_.Close(); 
    64 } 
    65  
    66 void MyTask::ConstructL() 
    67 { 
    68     timer_.CreateLocal(); 
    69     CActiveScheduler::Add(this); 
    70 } 
    71  
    72 MyTask *MyTask::NewL(CActiveSchedulerWait *asw) 
    73 { 
    74     MyTask *self = new (ELeave) MyTask(asw); 
    75     CleanupStack::PushL(self); 
    76  
    77     self->ConstructL(); 
    78  
    79     CleanupStack::Pop(self); 
    80     return self; 
    81 } 
    82  
    83 void MyTask::Start() 
    84 { 
    85     timer_.After(iStatus, 0); 
    86     SetActive(); 
    87 } 
    88  
    89 void MyTask::RunL() 
    90 { 
    91     int rc = app_main(); 
    92     asw_->AsyncStop(); 
    93 } 
    94  
    95 void MyTask::DoCancel() 
    96 { 
    97  
    98 } 
    9936 
    10037//////////////////////////////////////////////////////////////////////////// 
     
    10643    CActiveScheduler::Install(scheduler); 
    10744 
    108     CActiveSchedulerWait *asw = new CActiveSchedulerWait; 
    109     CleanupStack::PushL(asw); 
    110      
    111     MyTask *task = MyTask::NewL(asw); 
    112     task->Start(); 
     45    app_main(); 
    11346 
    114     asw->Start(); 
    115      
    116     delete task; 
    117      
    118     CleanupStack::Pop(asw); 
    119     delete asw; 
    120      
    12147    CActiveScheduler::Install(NULL); 
    12248    CleanupStack::Pop(scheduler); 
     
    14369    TRAPD(startError, DoStartL()); 
    14470 
    145     console->Printf(_L("[press any key to close]\n")); 
    146     console->Getch(); 
    147      
     71    //console->Printf(_L("[press any key to close]\n")); 
     72    //console->Getch(); 
     73 
    14874    delete console; 
    14975    delete cleanup; 
    15076 
    151     CloseSTDLIB();  
     77    CloseSTDLIB(); 
    15278 
    15379    // Mark end of heap usage, detect memory leaks 
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h

    r2394 r2506  
    42014201    unsigned            ec_tail_len; 
    42024202 
     4203    /** 
     4204     * Audio capture buffer length, in milliseconds. 
     4205     * 
     4206     * Default: PJMEDIA_SND_DEFAULT_REC_LATENCY 
     4207     */ 
     4208    unsigned            snd_rec_latency; 
     4209 
     4210    /** 
     4211     * Audio playback buffer length, in milliseconds. 
     4212     * 
     4213     * Default: PJMEDIA_SND_DEFAULT_PLAY_LATENCY 
     4214     */ 
     4215    unsigned            snd_play_latency; 
     4216 
    42034217    /**  
    42044218     * Jitter buffer initial prefetch delay in msec. The value must be 
     
    42734287    /** 
    42744288     * Specify idle time of sound device before it is automatically closed, 
    4275      * in seconds. 
    4276      * 
    4277      * Default : -1 (Disable the auto-close feature of sound device) 
     4289     * in seconds. Use value -1 to disable the auto-close feature of sound 
     4290     * device 
     4291     * 
     4292     * Default : 1 
    42784293     */ 
    42794294    int                 snd_auto_close_time; 
     
    47884803 
    47894804/** 
    4790  * Enum all sound devices installed in the system. 
     4805 * Enum all audio devices installed in the system. 
    47914806 * 
    47924807 * @param info          Array of info to be initialized. 
     
    47964811 * 
    47974812 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     4813 */ 
     4814PJ_DECL(pj_status_t) pjsua_enum_aud_devs(pjmedia_aud_dev_info info[], 
     4815                                         unsigned *count); 
     4816 
     4817/** 
     4818 * Enum all sound devices installed in the system (old API). 
     4819 * 
     4820 * @param info          Array of info to be initialized. 
     4821 * @param count         On input, specifies max elements in the array. 
     4822 *                      On return, it contains actual number of elements 
     4823 *                      that have been initialized. 
     4824 * 
     4825 * @return              PJ_SUCCESS on success, or the appropriate error code. 
    47984826 * 
    47994827 * 
     
    48074835PJ_DECL(pj_status_t) pjsua_enum_snd_devs(pjmedia_snd_dev_info info[], 
    48084836                                         unsigned *count); 
    4809  
    4810  
    48114837 
    48124838/** 
     
    48804906 
    48814907/** 
    4882  * Configure the echo canceller tail length of the sound port. 
     4908 * Change the echo cancellation settings. 
     4909 * 
     4910 * The behavior of this function depends on whether the sound device is 
     4911 * currently active, and if it is, whether device or software AEC is  
     4912 * being used.  
     4913 * 
     4914 * If the sound device is currently active, and if the device supports AEC, 
     4915 * this function will forward the change request to the device and it will 
     4916 * be up to the device on whether support the request. If software AEC is 
     4917 * being used (the software EC will be used if the device does not support 
     4918 * AEC), this function will change the software EC settings. In all cases, 
     4919 * the setting will be saved for future opening of the sound device. 
     4920 * 
     4921 * If the sound device is not currently active, this will only change the 
     4922 * default AEC settings and the setting will be applied next time the  
     4923 * sound device is opened. 
    48834924 * 
    48844925 * @param tail_ms       The tail length, in miliseconds. Set to zero to 
     
    48984939 
    48994940/** 
    4900  * Get current echo canceller tail length. 
     4941 * Get current echo canceller tail length.  
    49014942 * 
    49024943 * @param p_tail_ms     Pointer to receive the tail length, in miliseconds.  
     
    49124953PJ_DECL(pj_status_t) pjsua_get_ec_tail(unsigned *p_tail_ms); 
    49134954 
     4955 
     4956/** 
     4957 * Check whether the sound device is currently active. The sound device 
     4958 * may be inactive if the application has set the auto close feature to 
     4959 * non-zero (the snd_auto_close_time setting in #pjsua_media_config), or 
     4960 * if null sound device or no sound device has been configured via the 
     4961 * #pjsua_set_no_snd_dev() function. 
     4962 */ 
     4963PJ_DECL(pj_bool_t) pjsua_snd_is_active(void); 
     4964 
     4965     
     4966/** 
     4967 * Configure sound device setting to the sound device being used. If sound  
     4968 * device is currently active, the function will forward the setting to the 
     4969 * sound device instance to be applied immediately, if it supports it.  
     4970 * 
     4971 * The setting will be saved for future opening of the sound device, if the  
     4972 * "keep" argument is set to non-zero. If the sound device is currently 
     4973 * inactive, and the "keep" argument is false, this function will return 
     4974 * error. 
     4975 *  
     4976 * Note that in case the setting is kept for future use, it will be applied 
     4977 * to any devices, even when application has changed the sound device to be 
     4978 * used. 
     4979 * 
     4980 * Note also that the echo cancellation setting should be set with  
     4981 * #pjsua_set_ec() API instead. 
     4982 * 
     4983 * See also #pjmedia_aud_stream_set_cap() for more information about setting 
     4984 * an audio device capability. 
     4985 * 
     4986 * @param cap           The sound device setting to change. 
     4987 * @param pval          Pointer to value. Please see #pjmedia_aud_dev_cap 
     4988 *                      documentation about the type of value to be  
     4989 *                      supplied for each setting. 
     4990 * @param keep          Specify whether the setting is to be kept for future 
     4991 *                      use. 
     4992 * 
     4993 * @return              PJ_SUCCESS on success or the appropriate error code. 
     4994 */ 
     4995PJ_DECL(pj_status_t) pjsua_snd_set_setting(pjmedia_aud_dev_cap cap, 
     4996                                           const void *pval, 
     4997                                           pj_bool_t keep); 
     4998 
     4999/** 
     5000 * Retrieve a sound device setting. If sound device is currently active, 
     5001 * the function will forward the request to the sound device. If sound device 
     5002 * is currently inactive, and if application had previously set the setting 
     5003 * and mark the setting as kept, then that setting will be returned. 
     5004 * Otherwise, this function will return error. 
     5005 * 
     5006 * Note that echo cancellation settings should be retrieved with  
     5007 * #pjsua_get_ec_tail() API instead. 
     5008 * 
     5009 * @param cap           The sound device setting to retrieve. 
     5010 * @param pval          Pointer to receive the value.  
     5011 *                      Please see #pjmedia_aud_dev_cap documentation about 
     5012 *                      the type of value to be supplied for each setting. 
     5013 * 
     5014 * @return              PJ_SUCCESS on success or the appropriate error code. 
     5015 */ 
     5016PJ_DECL(pj_status_t) pjsua_snd_get_setting(pjmedia_aud_dev_cap cap, 
     5017                                           void *pval); 
    49145018 
    49155019 
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h

    r2394 r2506  
    273273    pjsua_conf_setting   mconf_cfg; /**< Additionan conf. bridge. param */ 
    274274    pjmedia_conf        *mconf;     /**< Conference bridge.             */ 
    275     int                  cap_dev;   /**< Capture device ID.             */ 
    276     int                  play_dev;  /**< Playback device ID.            */ 
     275    pj_bool_t            is_mswitch;/**< Are we using audio switchboard 
     276                                         (a.k.a APS-Direct)             */ 
     277 
     278    /* Sound device */ 
     279    pjmedia_aud_dev_index cap_dev;  /**< Capture device ID.             */ 
     280    pjmedia_aud_dev_index play_dev; /**< Playback device ID.            */ 
     281    pj_uint32_t          aud_svmask;/**< Which settings to save         */ 
     282    pjmedia_aud_param    aud_param; /**< User settings to sound dev     */ 
     283    pj_bool_t            aud_open_cnt;/**< How many # device is opened  */ 
    277284    pj_bool_t            no_snd;    /**< No sound (app will manage it)  */ 
    278285    pj_pool_t           *snd_pool;  /**< Sound's private pool.          */ 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r2394 r2506  
    371371    PJSUA_LOCK(); 
    372372 
    373     /* Create sound port if none is instantiated */ 
    374     if (pjsua_var.snd_port==NULL && pjsua_var.null_snd==NULL &&  
    375         !pjsua_var.no_snd)  
     373    /* Create sound port if none is instantiated, to check if sound device 
     374     * can be used. But only do this with the conference bridge, as with  
     375     * audio switchboard (i.e. APS-Direct), we can only open the sound  
     376     * device once the correct format has been known 
     377     */ 
     378    if (!pjsua_var.is_mswitch && pjsua_var.snd_port==NULL &&  
     379        pjsua_var.null_snd==NULL && !pjsua_var.no_snd)  
    376380    { 
    377381        pj_status_t status; 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c

    r2481 r2506  
    178178    cfg->ilbc_mode = PJSUA_DEFAULT_ILBC_MODE; 
    179179    cfg->ec_tail_len = PJSUA_DEFAULT_EC_TAIL_LEN; 
     180    cfg->snd_rec_latency = PJMEDIA_SND_DEFAULT_REC_LATENCY; 
     181    cfg->snd_play_latency = PJMEDIA_SND_DEFAULT_PLAY_LATENCY; 
    180182    cfg->jb_init = cfg->jb_min_pre = cfg->jb_max_pre = cfg->jb_max = -1; 
    181     cfg->snd_auto_close_time = -1; 
     183    cfg->snd_auto_close_time = 1; 
    182184 
    183185    cfg->turn_conn_type = PJ_TURN_TP_UDP; 
     
    582584 
    583585    /* Set default sound device ID */ 
    584     pjsua_var.cap_dev = pjsua_var.play_dev = -1; 
     586    pjsua_var.cap_dev = PJMEDIA_AUD_DEFAULT_CAPTURE_DEV; 
     587    pjsua_var.play_dev = PJMEDIA_AUD_DEFAULT_PLAYBACK_DEV; 
    585588 
    586589    /* Init caching pool. */ 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c

    r2425 r2506  
    3636static pj_uint16_t next_rtp_port; 
    3737 
     38/* Open sound dev */ 
     39static pj_status_t open_snd_dev(pjmedia_aud_param *param); 
    3840/* Close existing sound device */ 
    3941static void close_snd_dev(void); 
     42/* Create audio device param */ 
     43static pj_status_t create_aud_param(pjmedia_aud_param *param, 
     44                                    pjmedia_aud_dev_index capture_dev, 
     45                                    pjmedia_aud_dev_index playback_dev, 
     46                                    unsigned clock_rate, 
     47                                    unsigned channel_count, 
     48                                    unsigned samples_per_frame, 
     49                                    unsigned bits_per_sample); 
    4050 
    4151 
     
    6070    /* To suppress warning about unused var when all codecs are disabled */ 
    6171    PJ_UNUSED_ARG(codec_id); 
     72 
     73    /* Specify which audio device settings are save-able */ 
     74    pjsua_var.aud_svmask = 0xFFFFFFFF; 
     75    /* These are not-settable */ 
     76    pjsua_var.aud_svmask &= ~(PJMEDIA_AUD_DEV_CAP_EXT_FORMAT | 
     77                              PJMEDIA_AUD_DEV_CAP_INPUT_SIGNAL_METER | 
     78                              PJMEDIA_AUD_DEV_CAP_OUTPUT_SIGNAL_METER); 
     79    /* EC settings use different API */ 
     80    pjsua_var.aud_svmask &= ~(PJMEDIA_AUD_DEV_CAP_EC | 
     81                              PJMEDIA_AUD_DEV_CAP_EC_TAIL); 
    6282 
    6383    /* Copy configuration */ 
     
    172192 
    173193#endif /* PJMEDIA_HAS_INTEL_IPP */ 
     194 
     195#if PJMEDIA_HAS_PASSTHROUGH_CODECS 
     196    /* Register passthrough codecs */ 
     197    status = pjmedia_codec_passthrough_init(pjsua_var.med_endpt); 
     198    if (status != PJ_SUCCESS) { 
     199        pjsua_perror(THIS_FILE, "Error initializing passthrough codecs", 
     200                     status); 
     201        return status; 
     202    } 
     203#endif /* PJMEDIA_HAS_PASSTHROUGH_CODECS */ 
    174204 
    175205#if PJMEDIA_HAS_L16_CODEC 
     
    226256        return status; 
    227257    } 
     258 
     259    /* Are we using the audio switchboard (a.k.a APS-Direct)? */ 
     260    pjsua_var.is_mswitch = pjmedia_conf_get_master_port(pjsua_var.mconf) 
     261                            ->info.signature == PJMEDIA_CONF_SWITCH_SIGNATURE; 
    228262 
    229263    /* Create null port just in case user wants to use null sound. */ 
     
    574608            pjmedia_codec_ipp_deinit(); 
    575609#       endif   /* PJMEDIA_HAS_INTEL_IPP */ 
     610 
     611#       if PJMEDIA_HAS_PASSTHROUGH_CODECS 
     612            pjmedia_codec_passthrough_deinit(); 
     613#       endif /* PJMEDIA_HAS_PASSTHROUGH_CODECS */ 
    576614 
    577615#       if PJMEDIA_HAS_L16_CODEC 
     
    14961534} 
    14971535 
    1498  
    14991536/* 
    15001537 * Get maxinum number of conference ports. 
     
    16111648    } 
    16121649 
    1613     /* Create sound port if none is instantiated */ 
    1614     if (pjsua_var.snd_port==NULL && pjsua_var.null_snd==NULL &&  
    1615         !pjsua_var.no_snd)  
    1616     { 
     1650 
     1651    /* For audio switchboard (i.e. APS-Direct): 
     1652     * Check if sound device need to be reopened, i.e: its attributes 
     1653     * (format, clock rate, channel count) must match to peer's.  
     1654     * Note that sound device can be reopened only if it doesn't have 
     1655     * any connection. 
     1656     */ 
     1657    if (pjsua_var.is_mswitch) { 
     1658        pjmedia_conf_port_info port0_info; 
     1659        pjmedia_conf_port_info peer_info; 
     1660        unsigned peer_id; 
     1661        pj_bool_t need_reopen = PJ_FALSE; 
    16171662        pj_status_t status; 
    16181663 
    1619         status = pjsua_set_snd_dev(pjsua_var.cap_dev, pjsua_var.play_dev); 
    1620         if (status != PJ_SUCCESS) { 
    1621             pjsua_perror(THIS_FILE, "Error opening sound device", status); 
    1622             return status; 
    1623         } 
     1664        peer_id = (source!=0)? source : sink; 
     1665        status = pjmedia_conf_get_port_info(pjsua_var.mconf, peer_id,  
     1666                                            &peer_info); 
     1667        pj_assert(status == PJ_SUCCESS); 
     1668 
     1669        status = pjmedia_conf_get_port_info(pjsua_var.mconf, 0, &port0_info); 
     1670        pj_assert(status == PJ_SUCCESS); 
     1671 
     1672        /* Check if sound device is instantiated. */ 
     1673        need_reopen = (pjsua_var.snd_port==NULL && pjsua_var.null_snd==NULL &&  
     1674                      !pjsua_var.no_snd); 
     1675 
     1676        /* Check if sound device need to reopen because it needs to modify  
     1677         * settings to match its peer. Sound device must be idle in this case  
     1678         * though. 
     1679         */ 
     1680        if (!need_reopen &&  
     1681            port0_info.listener_cnt==0 && port0_info.transmitter_cnt==0)  
     1682        { 
     1683            need_reopen = (peer_info.format.id != port0_info.format.id || 
     1684                           peer_info.format.bitrate != port0_info.format.bitrate || 
     1685                           peer_info.clock_rate != port0_info.clock_rate || 
     1686                           peer_info.channel_count != port0_info.channel_count); 
     1687        } 
     1688 
     1689        if (need_reopen) { 
     1690            pjmedia_aud_param param; 
     1691 
     1692            /* Create parameter based on peer info */ 
     1693            status = create_aud_param(&param, pjsua_var.cap_dev,  
     1694                                      pjsua_var.play_dev, 
     1695                                      peer_info.clock_rate, 
     1696                                      peer_info.channel_count, 
     1697                                      peer_info.samples_per_frame, 
     1698                                      peer_info.bits_per_sample); 
     1699 
     1700            /* And peer format */ 
     1701            if (peer_info.format.id != PJMEDIA_FORMAT_PCM) { 
     1702                param.flags |= PJMEDIA_AUD_DEV_CAP_EXT_FORMAT; 
     1703                param.ext_fmt = peer_info.format; 
     1704            } 
     1705 
     1706            status = open_snd_dev(&param); 
     1707            if (status != PJ_SUCCESS) { 
     1708                pjsua_perror(THIS_FILE, "Error opening sound device", status); 
     1709                return status; 
     1710            } 
     1711        } 
     1712 
     1713    } else { 
     1714        /* The bridge version */ 
     1715 
     1716        /* Create sound port if none is instantiated */ 
     1717        if (pjsua_var.snd_port==NULL && pjsua_var.null_snd==NULL &&  
     1718            !pjsua_var.no_snd)  
     1719        { 
     1720            pj_status_t status; 
     1721 
     1722            status = pjsua_set_snd_dev(pjsua_var.cap_dev, pjsua_var.play_dev); 
     1723            if (status != PJ_SUCCESS) { 
     1724                pjsua_perror(THIS_FILE, "Error opening sound device", status); 
     1725                return status; 
     1726            } 
     1727        } 
     1728 
    16241729    } 
    16251730 
     
    20982203 * Enum sound devices. 
    20992204 */ 
     2205 
     2206PJ_DEF(pj_status_t) pjsua_enum_aud_devs( pjmedia_aud_dev_info info[], 
     2207                                         unsigned *count) 
     2208{ 
     2209    unsigned i, dev_count; 
     2210 
     2211    dev_count = pjmedia_aud_dev_count(); 
     2212     
     2213    if (dev_count > *count) dev_count = *count; 
     2214 
     2215    for (i=0; i<dev_count; ++i) { 
     2216        pj_status_t status; 
     2217 
     2218        status = pjmedia_aud_dev_get_info(i, &info[i]); 
     2219        if (status != PJ_SUCCESS) 
     2220            return status; 
     2221    } 
     2222 
     2223    *count = dev_count; 
     2224 
     2225    return PJ_SUCCESS; 
     2226} 
     2227 
     2228 
    21002229PJ_DEF(pj_status_t) pjsua_enum_snd_devs( pjmedia_snd_dev_info info[], 
    21012230                                         unsigned *count) 
     
    21032232    unsigned i, dev_count; 
    21042233 
    2105     dev_count = pjmedia_snd_get_dev_count(); 
     2234    dev_count = pjmedia_aud_dev_count(); 
    21062235     
    21072236    if (dev_count > *count) dev_count = *count; 
     2237    pj_bzero(info, dev_count * sizeof(pjmedia_snd_dev_info)); 
    21082238 
    21092239    for (i=0; i<dev_count; ++i) { 
    2110         const pjmedia_snd_dev_info *ci; 
    2111  
    2112         ci = pjmedia_snd_get_dev_info(i); 
    2113         pj_memcpy(&info[i], ci, sizeof(*ci)); 
     2240        pjmedia_aud_dev_info ai; 
     2241        pj_status_t status; 
     2242 
     2243        status = pjmedia_aud_dev_get_info(i, &ai); 
     2244        if (status != PJ_SUCCESS) 
     2245            return status; 
     2246 
     2247        strncpy(info[i].name, ai.name, sizeof(info[i].name)); 
     2248        info[i].name[sizeof(info[i].name)-1] = '\0'; 
     2249        info[i].input_count = ai.input_count; 
     2250        info[i].output_count = ai.output_count; 
     2251        info[i].default_samples_per_sec = ai.default_samples_per_sec; 
    21142252    } 
    21152253 
     
    21192257} 
    21202258 
    2121  
    2122 /* Close existing sound device */ 
    2123 static void close_snd_dev(void) 
    2124 { 
    2125     /* Close sound device */ 
    2126     if (pjsua_var.snd_port) { 
    2127         const pjmedia_snd_dev_info *cap_info, *play_info; 
    2128  
    2129         cap_info = pjmedia_snd_get_dev_info(pjsua_var.cap_dev); 
    2130         play_info = pjmedia_snd_get_dev_info(pjsua_var.play_dev); 
    2131  
    2132         PJ_LOG(4,(THIS_FILE, "Closing %s sound playback device and " 
    2133                              "%s sound capture device", 
    2134                              play_info->name, cap_info->name)); 
    2135  
    2136         pjmedia_snd_port_disconnect(pjsua_var.snd_port); 
    2137         pjmedia_snd_port_destroy(pjsua_var.snd_port); 
    2138         pjsua_var.snd_port = NULL; 
    2139     } 
    2140  
    2141     /* Close null sound device */ 
    2142     if (pjsua_var.null_snd) { 
    2143         PJ_LOG(4,(THIS_FILE, "Closing null sound device..")); 
    2144         pjmedia_master_port_destroy(pjsua_var.null_snd, PJ_FALSE); 
    2145         pjsua_var.null_snd = NULL; 
    2146     } 
    2147  
    2148     if (pjsua_var.snd_pool)  
    2149         pj_pool_release(pjsua_var.snd_pool); 
    2150     pjsua_var.snd_pool = NULL; 
    2151 } 
    2152  
    2153 /* 
    2154  * Select or change sound device. Application may call this function at 
    2155  * any time to replace current sound device. 
    2156  */ 
    2157 PJ_DEF(pj_status_t) pjsua_set_snd_dev( int capture_dev, 
    2158                                        int playback_dev) 
     2259/* Create audio device parameter to open the device */ 
     2260static pj_status_t create_aud_param(pjmedia_aud_param *param, 
     2261                                    pjmedia_aud_dev_index capture_dev, 
     2262                                    pjmedia_aud_dev_index playback_dev, 
     2263                                    unsigned clock_rate, 
     2264                                    unsigned channel_count, 
     2265                                    unsigned samples_per_frame, 
     2266                                    unsigned bits_per_sample) 
     2267{ 
     2268    pj_status_t status; 
     2269 
     2270    /* Normalize device ID with new convention about default device ID */ 
     2271    if (playback_dev == PJMEDIA_AUD_DEFAULT_CAPTURE_DEV) 
     2272        playback_dev = PJMEDIA_AUD_DEFAULT_PLAYBACK_DEV; 
     2273 
     2274    /* Create default parameters for the device */ 
     2275    status = pjmedia_aud_dev_default_param(capture_dev, param); 
     2276    if (status != PJ_SUCCESS) { 
     2277        pjsua_perror(THIS_FILE, "Error retrieving default audio " 
     2278                                "device parameters", status); 
     2279        return status; 
     2280    } 
     2281    param->dir = PJMEDIA_DIR_CAPTURE_PLAYBACK; 
     2282    param->rec_id = capture_dev; 
     2283    param->play_id = playback_dev; 
     2284    param->clock_rate = clock_rate; 
     2285    param->channel_count = channel_count; 
     2286    param->samples_per_frame = samples_per_frame; 
     2287    param->bits_per_sample = bits_per_sample; 
     2288 
     2289    /* Update the setting with user preference */ 
     2290#define update_param(cap, field)    \ 
     2291        if (pjsua_var.aud_param.flags & cap) { \ 
     2292            param->flags |= cap; \ 
     2293            param->field = pjsua_var.aud_param.field; \ 
     2294        } 
     2295    update_param( PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING, input_vol); 
     2296    update_param( PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING, output_vol); 
     2297    update_param( PJMEDIA_AUD_DEV_CAP_INPUT_ROUTE, input_route); 
     2298    update_param( PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE, output_route); 
     2299#undef update_param 
     2300 
     2301    /* Latency settings */ 
     2302    param->flags |= (PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY |  
     2303                     PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY); 
     2304    param->input_latency_ms = pjsua_var.media_cfg.snd_rec_latency; 
     2305    param->output_latency_ms = pjsua_var.media_cfg.snd_play_latency; 
     2306 
     2307    /* EC settings */ 
     2308    if (pjsua_var.media_cfg.ec_tail_len) { 
     2309        param->flags |= (PJMEDIA_AUD_DEV_CAP_EC | PJMEDIA_AUD_DEV_CAP_EC_TAIL); 
     2310        param->ec_enabled = PJ_TRUE; 
     2311        param->ec_tail_ms = pjsua_var.media_cfg.ec_tail_len; 
     2312    } else { 
     2313        param->flags &= ~(PJMEDIA_AUD_DEV_CAP_EC|PJMEDIA_AUD_DEV_CAP_EC_TAIL); 
     2314    } 
     2315 
     2316    return PJ_SUCCESS; 
     2317} 
     2318 
     2319/* Internal: the first time the audio device is opened (during app 
     2320 *   startup), retrieve the audio settings such as volume level 
     2321 *   so that aud_get_settings() will work. 
     2322 */ 
     2323static pj_status_t update_initial_aud_param() 
     2324{ 
     2325    pjmedia_aud_stream *strm; 
     2326    pjmedia_aud_param param; 
     2327    pj_status_t status; 
     2328 
     2329    PJ_ASSERT_RETURN(pjsua_var.snd_port != NULL, PJ_EBUG); 
     2330 
     2331    strm = pjmedia_snd_port_get_snd_stream(pjsua_var.snd_port); 
     2332 
     2333    status = pjmedia_aud_stream_get_param(strm, &param); 
     2334    if (status != PJ_SUCCESS) { 
     2335        pjsua_perror(THIS_FILE, "Error audio stream " 
     2336                                "device parameters", status); 
     2337        return status; 
     2338    } 
     2339 
     2340#define update_saved_param(cap, field)  \ 
     2341        if (param.flags & cap) { \ 
     2342            pjsua_var.aud_param.flags |= cap; \ 
     2343            pjsua_var.aud_param.field = param.field; \ 
     2344        } 
     2345 
     2346    update_saved_param(PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING, input_vol); 
     2347    update_saved_param(PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING, output_vol); 
     2348    update_saved_param(PJMEDIA_AUD_DEV_CAP_INPUT_ROUTE, input_route); 
     2349    update_saved_param(PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE, output_route); 
     2350#undef update_saved_param 
     2351 
     2352    return PJ_SUCCESS; 
     2353} 
     2354 
     2355/* Get format name */ 
     2356static const char *get_fmt_name(pj_uint32_t id) 
     2357{ 
     2358    static char name[8]; 
     2359 
     2360    if (id == PJMEDIA_FORMAT_L16) 
     2361        return "PCM"; 
     2362    pj_memcpy(name, &id, 4); 
     2363    name[4] = '\0'; 
     2364    return name; 
     2365} 
     2366 
     2367/* Open sound device with the setting. */ 
     2368static pj_status_t open_snd_dev(pjmedia_aud_param *param) 
    21592369{ 
    21602370    pjmedia_port *conf_port; 
    2161     const pjmedia_snd_dev_info *play_info; 
    2162     unsigned clock_rates[] = {0, 44100, 48000, 32000, 16000, 8000}; 
    2163     unsigned selected_clock_rate = 0; 
    2164     unsigned i; 
    2165     pjmedia_snd_stream *strm; 
    2166     pjmedia_snd_stream_info si; 
    2167     pj_str_t tmp; 
    2168     pj_status_t status = -1; 
     2371    pj_status_t status; 
     2372 
     2373    PJ_ASSERT_RETURN(param, PJ_EINVAL); 
    21692374 
    21702375    /* Check if NULL sound device is used */ 
    2171     if (NULL_SND_DEV_ID == capture_dev || NULL_SND_DEV_ID == playback_dev) { 
     2376    if (NULL_SND_DEV_ID==param->rec_id || NULL_SND_DEV_ID==param->play_id) { 
    21722377        return pjsua_set_null_snd_dev(); 
    21732378    } 
     
    21802385    PJ_ASSERT_RETURN(pjsua_var.snd_pool, PJ_ENOMEM); 
    21812386 
    2182     /* Set default clock rate */ 
    2183     clock_rates[0] = pjsua_var.media_cfg.snd_clock_rate; 
    2184     if (clock_rates[0] == 0) 
    2185         clock_rates[0] = pjsua_var.media_cfg.clock_rate; 
     2387 
     2388    PJ_LOG(4,(THIS_FILE, "Opening sound device %s@%d/%d/%dms", 
     2389              get_fmt_name(param->ext_fmt.id), 
     2390              param->clock_rate, param->channel_count, 
     2391              param->samples_per_frame / param->channel_count * 1000 / 
     2392              param->clock_rate)); 
     2393 
     2394    status = pjmedia_snd_port_create2( pjsua_var.snd_pool,  
     2395                                       param,  &pjsua_var.snd_port); 
     2396    if (status != PJ_SUCCESS) 
     2397        return status; 
    21862398 
    21872399    /* Get the port0 of the conference bridge. */ 
     
    21892401    pj_assert(conf_port != NULL); 
    21902402 
    2191     /* Attempts to open the sound device with different clock rates */ 
    2192     for (i=0; i<PJ_ARRAY_SIZE(clock_rates); ++i) { 
    2193         char errmsg[PJ_ERR_MSG_SIZE]; 
    2194         unsigned samples_per_frame; 
    2195  
    2196         PJ_LOG(4,(THIS_FILE,  
    2197                   "pjsua_set_snd_dev(): attempting to open devices " 
    2198                   "@%d Hz", clock_rates[i])); 
    2199  
    2200         samples_per_frame = clock_rates[i] * 
    2201                             pjsua_var.media_cfg.audio_frame_ptime * 
    2202                             pjsua_var.media_cfg.channel_count / 1000; 
    2203  
    2204         /* Create the sound device. Sound port will start immediately. */ 
    2205         status = pjmedia_snd_port_create(pjsua_var.snd_pool, capture_dev, 
    2206                                          playback_dev,  
    2207                                          clock_rates[i],  
    2208                                          pjsua_var.media_cfg.channel_count, 
    2209                                          samples_per_frame, 
    2210                                          16, 0, &pjsua_var.snd_port); 
    2211  
    2212         if (status == PJ_SUCCESS) { 
    2213             selected_clock_rate = clock_rates[i]; 
    2214  
    2215             /* If there's mismatch between sound port and conference's port, 
    2216              * create a resample port to bridge them. 
    2217              */ 
    2218             if (selected_clock_rate != pjsua_var.media_cfg.clock_rate) { 
    2219                 pjmedia_port *resample_port; 
    2220                 unsigned resample_opt = 0; 
    2221  
    2222                 if (pjsua_var.media_cfg.quality >= 3 && 
    2223                     pjsua_var.media_cfg.quality <= 4) 
    2224                 { 
    2225                     resample_opt |= PJMEDIA_RESAMPLE_USE_SMALL_FILTER; 
    2226                 } 
    2227                 else if (pjsua_var.media_cfg.quality < 3) { 
    2228                     resample_opt |= PJMEDIA_RESAMPLE_USE_LINEAR; 
    2229                 } 
    2230                  
    2231                 status = pjmedia_resample_port_create(pjsua_var.snd_pool,  
    2232                                                       conf_port, 
    2233                                                       selected_clock_rate, 
    2234                                                       resample_opt,  
    2235                                                       &resample_port); 
    2236                 if (status != PJ_SUCCESS) { 
    2237                     pj_strerror(status, errmsg, sizeof(errmsg)); 
    2238                     PJ_LOG(4, (THIS_FILE,  
    2239                                "Error creating resample port, trying next " 
    2240                                "clock rate",  
    2241                                errmsg)); 
    2242                     pjmedia_snd_port_destroy(pjsua_var.snd_port); 
    2243                     pjsua_var.snd_port = NULL; 
    2244                     continue; 
    2245                 } else { 
    2246                     conf_port = resample_port; 
    2247                     break; 
    2248                 } 
    2249  
    2250             } else { 
    2251                 break; 
    2252             } 
    2253         } 
    2254  
    2255         pj_strerror(status, errmsg, sizeof(errmsg)); 
    2256         PJ_LOG(4, (THIS_FILE, "..failed: %s", errmsg)); 
    2257     } 
    2258  
    2259     if (status != PJ_SUCCESS) { 
    2260         pjsua_perror(THIS_FILE, "Unable to open sound device", status); 
    2261         return status; 
    2262     } 
    2263  
    2264     /* Set AEC */ 
    2265     pjmedia_snd_port_set_ec( pjsua_var.snd_port, pjsua_var.snd_pool,  
    2266                              pjsua_var.media_cfg.ec_tail_len,  
    2267                              pjsua_var.media_cfg.ec_options); 
    2268  
    2269     /* Connect sound port to the bridge */        
     2403    /* For conference bridge, resample if necessary if the bridge's 
     2404     * clock rate is different than the sound device's clock rate. 
     2405     */ 
     2406    if (!pjsua_var.is_mswitch && 
     2407        param->ext_fmt.id == PJMEDIA_FORMAT_PCM && 
     2408        conf_port->info.clock_rate != param->clock_rate) 
     2409    { 
     2410        pjmedia_port *resample_port; 
     2411        unsigned resample_opt = 0; 
     2412 
     2413        if (pjsua_var.media_cfg.quality >= 3 && 
     2414            pjsua_var.media_cfg.quality <= 4) 
     2415        { 
     2416            resample_opt |= PJMEDIA_RESAMPLE_USE_SMALL_FILTER; 
     2417        } 
     2418        else if (pjsua_var.media_cfg.quality < 3) { 
     2419            resample_opt |= PJMEDIA_RESAMPLE_USE_LINEAR; 
     2420        } 
     2421         
     2422        status = pjmedia_resample_port_create(pjsua_var.snd_pool,  
     2423                                              conf_port, 
     2424                                              param->clock_rate, 
     2425                                              resample_opt,  
     2426                                              &resample_port); 
     2427        if (status != PJ_SUCCESS) { 
     2428            char errmsg[PJ_ERR_MSG_SIZE]; 
     2429            pj_strerror(status, errmsg, sizeof(errmsg)); 
     2430            PJ_LOG(4, (THIS_FILE,  
     2431                       "Error creating resample port: %s",  
     2432                       errmsg)); 
     2433            close_snd_dev(); 
     2434            return status; 
     2435        }  
     2436             
     2437        conf_port = resample_port; 
     2438    } 
     2439 
     2440    /* Otherwise for audio switchboard, the switch's port0 setting is 
     2441     * derived from the sound device setting, so update the setting. 
     2442     */ 
     2443    if (pjsua_var.is_mswitch) { 
     2444        pj_memcpy(&conf_port->info.format, &param->ext_fmt,  
     2445                  sizeof(conf_port->info.format)); 
     2446        conf_port->info.clock_rate = param->clock_rate; 
     2447        conf_port->info.samples_per_frame = param->samples_per_frame; 
     2448        conf_port->info.channel_count = param->channel_count; 
     2449        conf_port->info.bits_per_sample = 16; 
     2450    } 
     2451 
     2452    /* Connect sound port to the bridge */ 
    22702453    status = pjmedia_snd_port_connect(pjsua_var.snd_port,         
    22712454                                      conf_port );        
     
    22792462 
    22802463    /* Save the device IDs */ 
    2281     pjsua_var.cap_dev = capture_dev; 
    2282     pjsua_var.play_dev = playback_dev; 
     2464    pjsua_var.cap_dev = param->rec_id; 
     2465    pjsua_var.play_dev = param->play_id; 
    22832466 
    22842467    /* Update sound device name. */ 
    2285     strm = pjmedia_snd_port_get_snd_stream(pjsua_var.snd_port); 
    2286     pjmedia_snd_stream_get_info(strm, &si); 
    2287     play_info = pjmedia_snd_get_dev_info(si.rec_id); 
    2288  
    2289     if (si.clock_rate != pjsua_var.media_cfg.clock_rate) { 
    2290         char tmp_buf[128]; 
    2291         int tmp_buf_len = sizeof(tmp_buf); 
    2292  
    2293         tmp_buf_len = pj_ansi_snprintf(tmp_buf, sizeof(tmp_buf)-1, "%s (%dKHz)", 
    2294                                        play_info->name, si.clock_rate/1000); 
    2295         pj_strset(&tmp, tmp_buf, tmp_buf_len); 
    2296         pjmedia_conf_set_port0_name(pjsua_var.mconf, &tmp);  
     2468    { 
     2469        pjmedia_aud_dev_info rec_info; 
     2470        pjmedia_aud_stream *strm; 
     2471        pjmedia_aud_param si; 
     2472        pj_str_t tmp; 
     2473 
     2474        strm = pjmedia_snd_port_get_snd_stream(pjsua_var.snd_port); 
     2475        status = pjmedia_aud_stream_get_param(strm, &si); 
     2476        if (status == PJ_SUCCESS) 
     2477            status = pjmedia_aud_dev_get_info(si.rec_id, &rec_info); 
     2478 
     2479        if (status==PJ_SUCCESS) { 
     2480            if (param->clock_rate != pjsua_var.media_cfg.clock_rate) { 
     2481                char tmp_buf[128]; 
     2482                int tmp_buf_len = sizeof(tmp_buf); 
     2483 
     2484                tmp_buf_len = pj_ansi_snprintf(tmp_buf, sizeof(tmp_buf)-1,  
     2485                                               "%s (%dKHz)", 
     2486                                               rec_info.name,  
     2487                                               param->clock_rate/1000); 
     2488                pj_strset(&tmp, tmp_buf, tmp_buf_len); 
     2489                pjmedia_conf_set_port0_name(pjsua_var.mconf, &tmp);  
     2490            } else { 
     2491                pjmedia_conf_set_port0_name(pjsua_var.mconf,  
     2492                                            pj_cstr(&tmp, rec_info.name)); 
     2493            } 
     2494        } 
     2495 
     2496        /* Any error is not major, let it through */ 
     2497        status = PJ_SUCCESS; 
     2498    }; 
     2499 
     2500    /* If this is the first time the audio device is open, retrieve some 
     2501     * settings from the device (such as volume settings) so that the 
     2502     * pjsua_snd_get_setting() work. 
     2503     */ 
     2504    if (pjsua_var.aud_open_cnt == 0) { 
     2505        update_initial_aud_param(); 
     2506        ++pjsua_var.aud_open_cnt; 
     2507    } 
     2508 
     2509    return PJ_SUCCESS; 
     2510} 
     2511 
     2512 
     2513/* Close existing sound device */ 
     2514static void close_snd_dev(void) 
     2515{ 
     2516    /* Close sound device */ 
     2517    if (pjsua_var.snd_port) { 
     2518        pjmedia_aud_dev_info cap_info, play_info; 
     2519        pjmedia_aud_stream *strm; 
     2520        pjmedia_aud_param param; 
     2521 
     2522        strm = pjmedia_snd_port_get_snd_stream(pjsua_var.snd_port); 
     2523        pjmedia_aud_stream_get_param(strm, &param); 
     2524 
     2525        if (pjmedia_aud_dev_get_info(param.rec_id, &cap_info) != PJ_SUCCESS) 
     2526            cap_info.name[0] = '\0'; 
     2527        if (pjmedia_aud_dev_get_info(param.play_id, &play_info) != PJ_SUCCESS) 
     2528            play_info.name[0] = '\0'; 
     2529 
     2530        PJ_LOG(4,(THIS_FILE, "Closing %s sound playback device and " 
     2531                             "%s sound capture device", 
     2532                             play_info.name, cap_info.name)); 
     2533 
     2534        pjmedia_snd_port_disconnect(pjsua_var.snd_port); 
     2535        pjmedia_snd_port_destroy(pjsua_var.snd_port); 
     2536        pjsua_var.snd_port = NULL; 
     2537    } 
     2538 
     2539    /* Close null sound device */ 
     2540    if (pjsua_var.null_snd) { 
     2541        PJ_LOG(4,(THIS_FILE, "Closing null sound device..")); 
     2542        pjmedia_master_port_destroy(pjsua_var.null_snd, PJ_FALSE); 
     2543        pjsua_var.null_snd = NULL; 
     2544    } 
     2545 
     2546    if (pjsua_var.snd_pool)  
     2547        pj_pool_release(pjsua_var.snd_pool); 
     2548    pjsua_var.snd_pool = NULL; 
     2549} 
     2550 
     2551 
     2552/* 
     2553 * Select or change sound device. Application may call this function at 
     2554 * any time to replace current sound device. 
     2555 */ 
     2556PJ_DEF(pj_status_t) pjsua_set_snd_dev( int capture_dev, 
     2557                                       int playback_dev) 
     2558{ 
     2559    unsigned alt_cr_cnt = 1; 
     2560    unsigned alt_cr[] = {0, 44100, 48000, 32000, 16000, 8000}; 
     2561    unsigned i; 
     2562    pj_status_t status = -1; 
     2563 
     2564    /* Set default clock rate */ 
     2565    alt_cr[0] = pjsua_var.media_cfg.snd_clock_rate; 
     2566    if (alt_cr[0] == 0) 
     2567        alt_cr[0] = pjsua_var.media_cfg.clock_rate; 
     2568 
     2569    /* Allow retrying of different clock rate if we're using conference  
     2570     * bridge (meaning audio format is always PCM), otherwise lock on 
     2571     * to one clock rate. 
     2572     */ 
     2573    if (pjsua_var.is_mswitch) { 
     2574        alt_cr_cnt = 1; 
    22972575    } else { 
    2298         pjmedia_conf_set_port0_name(pjsua_var.mconf,  
    2299                                     pj_cstr(&tmp, play_info->name)); 
     2576        alt_cr_cnt = PJ_ARRAY_SIZE(alt_cr); 
     2577    } 
     2578 
     2579    /* Attempts to open the sound device with different clock rates */ 
     2580    for (i=0; i<alt_cr_cnt; ++i) { 
     2581        pjmedia_aud_param param; 
     2582        unsigned samples_per_frame; 
     2583 
     2584        /* Create the default audio param */ 
     2585        samples_per_frame = alt_cr[i] * 
     2586                            pjsua_var.media_cfg.audio_frame_ptime * 
     2587                            pjsua_var.media_cfg.channel_count / 1000; 
     2588        status = create_aud_param(&param, capture_dev, playback_dev,  
     2589                                  alt_cr[i], pjsua_var.media_cfg.channel_count, 
     2590                                  samples_per_frame, 16); 
     2591        if (status != PJ_SUCCESS) 
     2592            return status; 
     2593 
     2594        /* Open! */ 
     2595        status = open_snd_dev(&param); 
     2596        if (status == PJ_SUCCESS) 
     2597            break; 
     2598    } 
     2599 
     2600    if (status != PJ_SUCCESS) { 
     2601        pjsua_perror(THIS_FILE, "Unable to open sound device", status); 
     2602        return status; 
    23002603    } 
    23012604 
     
    24052708 
    24062709 
     2710/* 
     2711 * Check whether the sound device is currently active. 
     2712 */ 
     2713PJ_DEF(pj_bool_t) pjsua_snd_is_active(void) 
     2714{ 
     2715    return pjsua_var.snd_port != NULL; 
     2716} 
     2717 
     2718 
     2719/* 
     2720 * Configure sound device setting to the sound device being used.  
     2721 */ 
     2722PJ_DEF(pj_status_t) pjsua_snd_set_setting( pjmedia_aud_dev_cap cap, 
     2723                                           const void *pval, 
     2724                                           pj_bool_t keep) 
     2725{ 
     2726    pj_status_t status; 
     2727 
     2728    /* Check if we are allowed to set the cap */ 
     2729    if ((cap & pjsua_var.aud_svmask) == 0) { 
     2730        return PJMEDIA_EAUD_INVCAP; 
     2731    } 
     2732 
     2733    /* If sound is active, set it immediately */ 
     2734    if (pjsua_snd_is_active()) { 
     2735        pjmedia_aud_stream *strm; 
     2736         
     2737        strm = pjmedia_snd_port_get_snd_stream(pjsua_var.snd_port); 
     2738        status = pjmedia_aud_stream_set_cap(strm, cap, pval); 
     2739    } else { 
     2740        status = PJ_SUCCESS; 
     2741    } 
     2742 
     2743    if (status != PJ_SUCCESS) 
     2744        return status; 
     2745 
     2746    /* Save in internal param for later device open */ 
     2747    if (keep) { 
     2748        status = pjmedia_aud_param_set_cap(&pjsua_var.aud_param, 
     2749                                           cap, pval); 
     2750    } 
     2751 
     2752    return status; 
     2753} 
     2754 
     2755/* 
     2756 * Retrieve a sound device setting. 
     2757 */ 
     2758PJ_DEF(pj_status_t) pjsua_snd_get_setting( pjmedia_aud_dev_cap cap, 
     2759                                           void *pval) 
     2760{ 
     2761    /* If sound device has never been opened before, open it to  
     2762     * retrieve the initial setting from the device (e.g. audio 
     2763     * volume) 
     2764     */ 
     2765    if (pjsua_var.aud_open_cnt==0) { 
     2766        PJ_LOG(4,(THIS_FILE, "Opening sound device to get initial settings")); 
     2767        pjsua_set_snd_dev(pjsua_var.cap_dev, pjsua_var.play_dev); 
     2768        close_snd_dev(); 
     2769    } 
     2770 
     2771    if (pjsua_snd_is_active()) { 
     2772        /* Sound is active, retrieve from device directly */ 
     2773        pjmedia_aud_stream *strm; 
     2774         
     2775        strm = pjmedia_snd_port_get_snd_stream(pjsua_var.snd_port); 
     2776        return pjmedia_aud_stream_get_cap(strm, cap, pval); 
     2777    } else { 
     2778        /* Otherwise retrieve from internal param */ 
     2779        return pjmedia_aud_param_get_cap(&pjsua_var.aud_param, 
     2780                                         cap, pval); 
     2781    } 
     2782} 
     2783 
     2784 
    24072785/***************************************************************************** 
    24082786 * Codecs. 
Note: See TracChangeset for help on using the changeset viewer.