Changeset 3025


Ignore:
Timestamp:
Nov 24, 2009 12:24:35 PM (14 years ago)
Author:
nanang
Message:

Ticket #990:

  • Updated VAS stream start to be synchronous.
  • Fixed VAS formats enumeration in factory_init() to delete VAS factory instance.
  • Minor fix: compile warning on 5th edition: CPjAudioEngine has virtual member but no virtual destructor.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia-audiodev/symb_vas_dev.cpp

    r2833 r3025  
    246246    TInt GetMaxGain() { TInt gain;iVoIPUplink->GetMaxGain(gain);return gain; } 
    247247 
     248    TBool IsStarted(); 
     249     
    248250private: 
    249251    CPjAudioEngine(struct vas_stream *parent_strm, 
     
    261263 
    262264    // From MVoIPDownlinkObserver 
    263     virtual void FillBuffer(const CVoIPAudioDownlinkStream& aSrc, 
     265    void FillBuffer(const CVoIPAudioDownlinkStream& aSrc, 
    264266                            CVoIPDataBuffer* aBuffer); 
    265     virtual void Event(const CVoIPAudioDownlinkStream& aSrc, 
     267    void Event(const CVoIPAudioDownlinkStream& aSrc, 
    266268                       TInt aEventType, 
    267269                       TInt aError); 
    268270 
    269271    // From MVoIPUplinkObserver 
    270     virtual void EmptyBuffer(const CVoIPAudioUplinkStream& aSrc, 
     272    void EmptyBuffer(const CVoIPAudioUplinkStream& aSrc, 
    271273                             CVoIPDataBuffer* aBuffer); 
    272     virtual void Event(const CVoIPAudioUplinkStream& aSrc, 
     274    void Event(const CVoIPAudioUplinkStream& aSrc, 
    273275                       TInt aEventType, 
    274276                       TInt aError); 
    275277 
    276278    // From MVoIPFormatObserver 
    277     virtual void Event(const CVoIPFormatIntfc& aSrc, TInt aEventType); 
     279    void Event(const CVoIPFormatIntfc& aSrc, TInt aEventType); 
    278280 
    279281    State                        dn_state_; 
     
    370372} 
    371373 
     374TBool CPjAudioEngine::IsStarted() 
     375{ 
     376    return ((((parentStrm_->param.dir & PJMEDIA_DIR_CAPTURE) == 0) ||  
     377               up_state_ == STATE_STREAMING) && 
     378            (((parentStrm_->param.dir & PJMEDIA_DIR_PLAYBACK) == 0) ||  
     379               dn_state_ == STATE_STREAMING)); 
     380} 
     381 
    372382TInt CPjAudioEngine::InitPlay() 
    373383{ 
     
    669679// Callback from MVoIPFormatObserver 
    670680void CPjAudioEngine::Event(const CVoIPFormatIntfc& /*aSrc*/,  
    671                            TInt /*aEventType*/) 
    672 { 
     681                           TInt aEventType) 
     682{ 
     683    snd_perror("Format event", aEventType); 
    673684} 
    674685 
     
    13101321{ 
    13111322    struct vas_factory *af = (struct vas_factory*)f; 
    1312     CVoIPUtilityFactory *vas_factory; 
     1323    CVoIPUtilityFactory *vas_factory_; 
    13131324    CVoIPAudioUplinkStream *vas_uplink; 
    13141325    CVoIPAudioDownlinkStream *vas_dnlink; 
     
    13331344 
    13341345    /* Enumerate supported formats */ 
    1335     err = CVoIPUtilityFactory::CreateFactory(vas_factory); 
     1346    err = CVoIPUtilityFactory::CreateFactory(vas_factory_); 
    13361347    if (err != KErrNone) 
    13371348        goto on_error; 
     
    13401351     * querying formats. 
    13411352     */ 
    1342     err = vas_factory->CreateUplinkStream(vas_version,  
     1353    err = vas_factory_->CreateUplinkStream(vas_version,  
    13431354                                          CVoIPUtilityFactory::EVoIPCall, 
    13441355                                          vas_uplink); 
     
    13461357        goto on_error; 
    13471358     
    1348     err = vas_factory->CreateDownlinkStream(vas_version,  
     1359    err = vas_factory_->CreateDownlinkStream(vas_version,  
    13491360                                            CVoIPUtilityFactory::EVoIPCall, 
    13501361                                            vas_dnlink); 
     
    13531364     
    13541365    uplink_formats.Reset(); 
    1355     err = vas_factory->GetSupportedUplinkFormats(uplink_formats); 
     1366    err = vas_factory_->GetSupportedUplinkFormats(uplink_formats); 
    13561367    if (err != KErrNone) 
    13571368        goto on_error; 
    13581369 
    13591370    dnlink_formats.Reset(); 
    1360     err = vas_factory->GetSupportedDownlinkFormats(dnlink_formats); 
     1371    err = vas_factory_->GetSupportedDownlinkFormats(dnlink_formats); 
    13611372    if (err != KErrNone) 
    13621373        goto on_error; 
     
    13671378    delete vas_dnlink; 
    13681379    vas_dnlink = NULL; 
     1380    delete vas_factory_; 
     1381    vas_factory_ = NULL; 
    13691382     
    13701383    for (TInt i = 0; i < dnlink_formats.Count(); i++) { 
     
    18841897 
    18851898    if (stream->engine) { 
     1899        enum { VAS_WAIT_START = 2000 }; /* in msecs */ 
     1900        TTime start, now; 
    18861901        TInt err = stream->engine->Start(); 
     1902         
    18871903        if (err != KErrNone) 
    18881904            return PJ_RETURN_OS_ERROR(err); 
    1889     } 
    1890  
    1891     return PJ_SUCCESS; 
     1905 
     1906        /* Perform synchronous start, timeout after VAS_WAIT_START ms */ 
     1907        start.UniversalTime(); 
     1908        do { 
     1909            pj_symbianos_poll(-1, 100); 
     1910            now.UniversalTime(); 
     1911        } while (!stream->engine->IsStarted() && 
     1912                 (now.MicroSecondsFrom(start) < VAS_WAIT_START * 1000)); 
     1913         
     1914        if (stream->engine->IsStarted()) 
     1915            return PJ_SUCCESS; 
     1916        else 
     1917            return PJ_ETIMEDOUT; 
     1918    }     
     1919 
     1920    return PJ_EINVALIDOP; 
    18921921} 
    18931922 
Note: See TracChangeset for help on using the changeset viewer.