Changeset 4708 for pjproject


Ignore:
Timestamp:
Jan 21, 2014 10:59:25 AM (10 years ago)
Author:
nanang
Message:

Re #1519 [into SVN trunk]: AudioMedia? objects must not be destroyed before unregistered from conf bridge.

Location:
pjproject/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/samples/pjsua2_demo.cpp

    r4704 r4708  
    9292void MyCall::onCallState(OnCallStateParam &prm) 
    9393{ 
     94    PJ_UNUSED_ARG(prm); 
     95 
    9496    CallInfo ci = getInfo(); 
    9597    std::cout << "*** Call: " <<  ci.remoteUri << " [" << ci.stateText 
     
    205207} 
    206208 
     209 
     210void mainProg3() throw(Error) 
     211{ 
     212    Endpoint ep; 
     213 
     214    // Create library 
     215    ep.libCreate(); 
     216 
     217    // Init library 
     218    EpConfig ep_cfg; 
     219    ep.libInit( ep_cfg ); 
     220 
     221    // Start library 
     222    ep.libStart(); 
     223    std::cout << "*** PJSUA2 STARTED ***" << std::endl; 
     224 
     225    // Create player and recorder 
     226    { 
     227        AudioMediaPlayer amp; 
     228        amp.createPlayer("../../tests/pjsua/wavs/input.16.wav"); 
     229 
     230        AudioMediaRecorder amr; 
     231        amr.createRecorder("recorder_test_output.wav"); 
     232 
     233        amp.startTransmit(ep.audDevManager().getPlaybackDevMedia()); 
     234        amp.startTransmit(amr); 
     235 
     236        pj_thread_sleep(5000); 
     237    } 
     238 
     239    ep.libDestroy(); 
     240} 
     241 
     242 
    207243void mainProg() throw(Error) 
    208244{ 
     
    272308    { 
    273309        Endpoint ep; 
    274         ep.natDetectType(); 
    275         { 
    276         } 
    277310    } 
    278311 
    279312    try { 
    280         mainProg1(); 
     313        mainProg3(); 
    281314        std::cout << "Success" << std::endl; 
    282315    } catch (Error & err) { 
  • pjproject/trunk/pjsip/src/pjsua2/media.cpp

    r4704 r4708  
    248248AudioMediaPlayer::~AudioMediaPlayer() 
    249249{ 
    250     if (playerId != PJSUA_INVALID_ID) 
     250    if (playerId != PJSUA_INVALID_ID) { 
     251        unregisterMediaPort(); 
    251252        pjsua_player_destroy(playerId); 
     253    } 
    252254} 
    253255 
     
    256258                                    throw(Error) 
    257259{ 
     260    if (playerId != PJSUA_INVALID_ID) { 
     261        PJSUA2_RAISE_ERROR(PJ_EEXISTS); 
     262    } 
     263 
    258264    pj_str_t pj_name = str2Pj(file_name); 
    259265 
     
    273279                                      throw(Error) 
    274280{ 
     281    if (playerId != PJSUA_INVALID_ID) { 
     282        PJSUA2_RAISE_ERROR(PJ_EEXISTS); 
     283    } 
     284 
    275285    pj_str_t pj_files[MAX_FILE_NAMES]; 
    276286    unsigned i, count = 0; 
     
    318328AudioMediaRecorder::~AudioMediaRecorder() 
    319329{ 
    320     if (recorderId != PJSUA_INVALID_ID) 
     330    if (recorderId != PJSUA_INVALID_ID) { 
     331        unregisterMediaPort(); 
    321332        pjsua_recorder_destroy(recorderId); 
     333    } 
    322334} 
    323335 
     
    329341{ 
    330342    PJ_UNUSED_ARG(max_size); 
     343 
     344    if (recorderId != PJSUA_INVALID_ID) { 
     345        PJSUA2_RAISE_ERROR(PJ_EEXISTS); 
     346    } 
    331347 
    332348    pj_str_t pj_name = str2Pj(file_name); 
Note: See TracChangeset for help on using the changeset viewer.