Changeset 318


Ignore:
Timestamp:
Mar 15, 2006 7:32:41 PM (18 years ago)
Author:
bennylp
Message:

Added Null port, and changed conference so that it does not call port get_frame() when there is no listener on the port

Location:
pjproject/trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/build/pjmedia.dsp

    r311 r318  
    121121# Begin Source File 
    122122 
     123SOURCE=..\src\pjmedia\null_port.c 
     124# End Source File 
     125# Begin Source File 
     126 
    123127SOURCE=..\src\pjmedia\nullsound.c 
    124128# PROP Exclude_From_Build 1 
     
    207211 
    208212SOURCE=..\include\pjmedia\jbuf.h 
     213# End Source File 
     214# Begin Source File 
     215 
     216SOURCE=..\include\pjmedia\null_port.h 
    209217# End Source File 
    210218# Begin Source File 
  • pjproject/trunk/pjmedia/include/pjmedia.h

    r278 r318  
    3333#include <pjmedia/g711.h> 
    3434#include <pjmedia/jbuf.h> 
     35#include <pjmedia/null_port.h> 
    3536#include <pjmedia/port.h> 
    3637#include <pjmedia/rtcp.h> 
  • pjproject/trunk/pjmedia/src/pjmedia/conference.c

    r312 r318  
    492492    pj_status_t status; 
    493493 
    494     PJ_ASSERT_RETURN(conf && pool && strm_port && port_name && p_port,  
    495                      PJ_EINVAL); 
     494    PJ_ASSERT_RETURN(conf && pool && strm_port && port_name, PJ_EINVAL); 
    496495 
    497496    pj_mutex_lock(conf->mutex); 
     
    523522 
    524523    /* Done. */ 
    525     *p_port = index; 
     524    if (p_port) { 
     525        *p_port = index; 
     526    } 
    526527 
    527528    pj_mutex_unlock(conf->mutex); 
     
    10521053            continue; 
    10531054        } 
     1055 
     1056        /* Also skip if this port doesn't have listeners. */ 
     1057        if (conf_port->listener_cnt == 0) 
     1058            continue; 
    10541059 
    10551060        /* Get frame from this port.  
     
    11021107        } 
    11031108 
    1104         /* Also skip if this port doesn't have listeners. */ 
    1105         if (conf_port->listener_cnt == 0) 
    1106             continue; 
    1107  
    11081109        /* Get the signal level. */ 
    11091110        level = pjmedia_calc_avg_signal(output, conf->samples_per_frame); 
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h

    r312 r318  
    6565 * streams. 
    6666 */ 
    67 #define PJSUA_CONF_MORE_PORTS       2 
     67#define PJSUA_CONF_MORE_PORTS       3 
    6868 
    6969 
     
    186186    char            *wav_file;      /**< WAV file name to play.         */ 
    187187    unsigned         wav_slot;      /**< WAV player slot in bridge      */ 
     188    pjmedia_port    *file_port;     /**< WAV player port.               */ 
     189    pjmedia_port    *null_port;     /**< NULL port.                     */ 
    188190    pj_bool_t        auto_play;     /**< Auto play file for calls?      */ 
    189191    pj_bool_t        auto_loop;     /**< Auto loop RTP stream?          */ 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c

    r315 r318  
    754754    } 
    755755 
     756    /* Add NULL port to the bridge. */ 
     757    status = pjmedia_null_port_create( pjsua.pool, pjsua.clock_rate,  
     758                                       pjsua.clock_rate * 20 / 1000, 16, 
     759                                       &pjsua.null_port); 
     760    pjmedia_conf_add_port( pjsua.mconf, pjsua.pool, pjsua.null_port,  
     761                           &pjsua.null_port->info.name, NULL ); 
     762 
    756763    /* Create WAV file player if required: */ 
    757764 
    758765    if (pjsua.wav_file) { 
    759         pjmedia_port *port; 
    760766        pj_str_t port_name; 
    761767 
    762768        /* Create the file player port. */ 
    763769        status = pjmedia_file_player_port_create( pjsua.pool, pjsua.wav_file, 
    764                                                   0, -1, NULL, &port); 
     770                                                  0, -1, NULL,  
     771                                                  &pjsua.file_port); 
    765772        if (status != PJ_SUCCESS) { 
    766773            pjsua_perror(THIS_FILE,  
     
    771778 
    772779        /* Add port to conference bridge: */ 
    773         status = pjmedia_conf_add_port(pjsua.mconf, pjsua.pool, port,  
     780        status = pjmedia_conf_add_port(pjsua.mconf, pjsua.pool,  
     781                                       pjsua.file_port,  
    774782                                       pj_cstr(&port_name, pjsua.wav_file), 
    775783                                       &pjsua.wav_slot); 
     
    10501058        pjmedia_conf_destroy(pjsua.mconf); 
    10511059 
     1060    /* Destroy file port */ 
     1061    pjmedia_port_destroy(pjsua.file_port); 
     1062 
     1063    /* Destroy null port. */ 
     1064    pjmedia_port_destroy(pjsua.null_port); 
     1065 
     1066 
    10521067    /* Destroy sound framework:  
    10531068     * (this should be done in pjmedia_shutdown()) 
Note: See TracChangeset for help on using the changeset viewer.