Changeset 4443 for pjproject/trunk


Ignore:
Timestamp:
Mar 20, 2013 6:56:19 AM (12 years ago)
Author:
nanang
Message:

Misc (re #1630): Added compile-time setting to configure audio switchboard buffer size.

Location:
pjproject/trunk/pjmedia
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/include/pjmedia/config.h

    r4240 r4443  
    6060#   define PJMEDIA_CONF_USE_SWITCH_BOARD    0 
    6161#endif 
     62 
     63/** 
     64 * Specify buffer size for audio switch board, in bytes. This buffer will 
     65 * be used for transmitting/receiving audio frame data (and some overheads, 
     66 * i.e: pjmedia_frame structure) among conference ports in the audio 
     67 * switch board. For example, if a port uses PCM format @44100Hz mono 
     68 * and frame time 20ms, the PCM audio data will require 1764 bytes, 
     69 * so with overhead, a safe buffer size will be ~1900 bytes. 
     70 * 
     71 * Default: PJMEDIA_MAX_MTU 
     72 */ 
     73#ifndef PJMEDIA_CONF_SWITCH_BOARD_BUF_SIZE 
     74#   define PJMEDIA_CONF_SWITCH_BOARD_BUF_SIZE    PJMEDIA_MAX_MTU 
     75#endif 
     76 
    6277 
    6378/* 
  • pjproject/trunk/pjmedia/src/pjmedia/conf_switch.c

    r4122 r4443  
    5151#define SLOT_TYPE           unsigned 
    5252#define INVALID_SLOT        ((SLOT_TYPE)-1) 
    53 #define BUFFER_SIZE         PJMEDIA_MAX_MTU 
     53#define BUFFER_SIZE         PJMEDIA_CONF_SWITCH_BOARD_BUF_SIZE 
    5454#define MAX_LEVEL           (32767) 
    5555#define MIN_LEVEL           (-32768) 
     
    144144 
    145145    PJ_ASSERT_RETURN(pool && conf && port && name && p_conf_port, PJ_EINVAL); 
     146 
     147    /* Check port's buffer size */ 
     148    if (port->info.fmt.id == PJMEDIA_FORMAT_PCM && 
     149        PJMEDIA_PIA_SPF(&port->info)*2 > BUFFER_SIZE - sizeof(pjmedia_frame)) 
     150    { 
     151        pj_assert(!"Too small buffer size for audio switchboard. " 
     152                   "Try increase PJMEDIA_CONF_SWITCH_BOARD_BUF_SIZE"); 
     153        return PJ_ETOOSMALL; 
     154    } 
    146155 
    147156    /* Create port. */ 
Note: See TracChangeset for help on using the changeset viewer.