mmserv/tms/tmsimpl/src/tmsstreambodyimpl.cpp
changeset 31 8dfd592727cb
parent 22 128eb6a32b84
child 42 1fa3fb47b1e3
equal deleted inserted replaced
22:128eb6a32b84 31:8dfd592727cb
   332 gint TMSStreamBodyImpl::GetStreamId()
   332 gint TMSStreamBodyImpl::GetStreamId()
   333     {
   333     {
   334     return iContext.StreamId;
   334     return iContext.StreamId;
   335     }
   335     }
   336 
   336 
   337 gint TMSStreamBodyImpl::Init()
   337 gint TMSStreamBodyImpl::Init(gint retrytime)
   338     {
   338     {
   339     gint ret(TMS_RESULT_SUCCESS);
   339     gint ret(TMS_RESULT_SUCCESS);
   340 
   340 
   341     ret = ValidateStream();
   341     ret = ValidateStream();
   342 
   342 
   353         }
   353         }
   354 
   354 
   355     if (iContext.CallProxy)
   355     if (iContext.CallProxy)
   356         {
   356         {
   357         ret = (iContext.CallProxy)->InitStream(iContext.CallType,
   357         ret = (iContext.CallProxy)->InitStream(iContext.CallType,
   358                 iContext.StreamType, iContext.StreamId, fmttype, &iMsgQueue);
   358                 iContext.StreamType, iContext.StreamId, fmttype, &iMsgQueue,
       
   359                 retrytime);
   359         }
   360         }
   360     else
   361     else
   361         {
   362         {
   362         ret = TMS_RESULT_UNINITIALIZED_OBJECT;
   363         ret = TMS_RESULT_UNINITIALIZED_OBJECT;
   363         }
   364         }
   371             TMSEffectType effecttype;
   372             TMSEffectType effecttype;
   372             iEffectsList[i]->GetType(effecttype);
   373             iEffectsList[i]->GetType(effecttype);
   373             switch (effecttype)
   374             switch (effecttype)
   374                 {
   375                 {
   375                 case TMS_EFFECT_GAIN:
   376                 case TMS_EFFECT_GAIN:
   376                     static_cast<TMSGainEffectImpl*>(iEffectsList[i])->SetProxy(
   377                     static_cast<TMSGainEffectImpl*> (iEffectsList[i])->SetProxy(
   377                             iContext.CallProxy, iMsgQHandler);
   378                             iContext.CallProxy, iMsgQHandler);
   378                     break;
   379                     break;
   379                 case TMS_EFFECT_VOLUME:
   380                 case TMS_EFFECT_VOLUME:
   380                     static_cast<TMSVolumeEffectImpl*>
   381                     static_cast<TMSVolumeEffectImpl*>
   381                         (iEffectsList[i])->SetProxy(iContext.CallProxy,
   382                         (iEffectsList[i])->SetProxy(iContext.CallProxy,
   393         TMSFormatType fmttype;
   394         TMSFormatType fmttype;
   394         iFormat->GetType(fmttype);
   395         iFormat->GetType(fmttype);
   395         switch (fmttype)
   396         switch (fmttype)
   396             {
   397             {
   397             case TMS_FORMAT_PCM:
   398             case TMS_FORMAT_PCM:
   398                 static_cast<TMSPCMFormatImpl*>(iFormat)->SetProxy(&iContext,
   399                 static_cast<TMSPCMFormatImpl*> (iFormat)->SetProxy(&iContext,
   399                         iMsgQHandler);
   400                         iMsgQHandler);
   400                 break;
   401                 break;
   401             case TMS_FORMAT_AMR:
   402             case TMS_FORMAT_AMR:
   402                 static_cast<TMSAMRFormatImpl*>(iFormat)->SetProxy(&iContext,
   403                 static_cast<TMSAMRFormatImpl*> (iFormat)->SetProxy(&iContext,
   403                         iMsgQHandler);
   404                         iMsgQHandler);
   404                 break;
   405                 break;
   405             case TMS_FORMAT_G711:
   406             case TMS_FORMAT_G711:
   406                 static_cast<TMSG711FormatImpl*>(iFormat)->SetProxy(&iContext,
   407                 static_cast<TMSG711FormatImpl*> (iFormat)->SetProxy(&iContext,
   407                         iMsgQHandler);
   408                         iMsgQHandler);
   408                 break;
   409                 break;
   409             case TMS_FORMAT_G729:
   410             case TMS_FORMAT_G729:
   410                 static_cast<TMSG729FormatImpl*>(iFormat)->SetProxy(&iContext,
   411                 static_cast<TMSG729FormatImpl*> (iFormat)->SetProxy(&iContext,
   411                         iMsgQHandler);
   412                         iMsgQHandler);
   412                 break;
   413                 break;
   413             case TMS_FORMAT_ILBC:
   414             case TMS_FORMAT_ILBC:
   414                 static_cast<TMSILBCFormatImpl*>(iFormat)->SetProxy(&iContext,
   415                 static_cast<TMSILBCFormatImpl*> (iFormat)->SetProxy(&iContext,
   415                         iMsgQHandler);
   416                         iMsgQHandler);
   416                 break;
   417                 break;
   417             default:
   418             default:
   418                 ret = TMS_RESULT_INVALID_ARGUMENT;
   419                 ret = TMS_RESULT_INVALID_ARGUMENT;
   419                 break;
   420                 break;
   427             TMSSinkType sinkType;
   428             TMSSinkType sinkType;
   428             iSink->GetType(sinkType);
   429             iSink->GetType(sinkType);
   429             switch (sinkType)
   430             switch (sinkType)
   430                 {
   431                 {
   431                 case TMS_SINK_CLIENT:
   432                 case TMS_SINK_CLIENT:
   432                     static_cast<TMSClientSinkImpl*>(iSink)->SetProxy(
   433                     static_cast<TMSClientSinkImpl*> (iSink)->SetProxy(&iContext,
   433                             iContext.CallProxy, iMsgQHandler);
   434                             iMsgQHandler);
   434                     break;
   435                     break;
   435                 case TMS_SINK_MODEM:
   436                 case TMS_SINK_MODEM:
   436                 case TMS_SINK_SPEAKER:
   437                 case TMS_SINK_SPEAKER:
   437                     break;
   438                     break;
   438                 default:
   439                 default:
   452             TMSSourceType sourceType;
   453             TMSSourceType sourceType;
   453             iSource->GetType(sourceType);
   454             iSource->GetType(sourceType);
   454             switch (sourceType)
   455             switch (sourceType)
   455                 {
   456                 {
   456                 case TMS_SOURCE_CLIENT:
   457                 case TMS_SOURCE_CLIENT:
   457                     static_cast<TMSClientSourceImpl*>(iSource)->SetProxy(
   458                     static_cast<TMSClientSourceImpl*> (iSource)->SetProxy(
   458                             iContext.CallProxy, iContext.StreamId,
   459                             &iContext, iMsgQHandler);
   459                             iMsgQHandler);
       
   460                     break;
   460                     break;
   461                 case TMS_SOURCE_MODEM:
   461                 case TMS_SOURCE_MODEM:
   462                 case TMS_SOURCE_MIC:
   462                 case TMS_SOURCE_MIC:
   463                     break;
   463                     break;
   464                 default:
   464                 default:
   488         ret = TMS_RESULT_UNINITIALIZED_OBJECT;
   488         ret = TMS_RESULT_UNINITIALIZED_OBJECT;
   489         }
   489         }
   490     return ret;
   490     return ret;
   491     }
   491     }
   492 
   492 
   493 gint TMSStreamBodyImpl::Start()
   493 gint TMSStreamBodyImpl::Start(gint retrytime)
   494     {
   494     {
   495     gint ret(TMS_RESULT_SUCCESS);
   495     gint ret(TMS_RESULT_SUCCESS);
   496     if (iContext.CallProxy)
   496     if (iContext.CallProxy)
   497         {
   497         {
   498         ret = (iContext.CallProxy)->StartStream(iContext.CallType,
   498         ret = (iContext.CallProxy)->StartStream(iContext.CallType,
   499                 iContext.StreamType, iContext.StreamId);
   499                 iContext.StreamType, iContext.StreamId, retrytime);
   500         }
   500         }
   501     else
   501     else
   502         {
   502         {
   503         ret = TMS_RESULT_UNINITIALIZED_OBJECT;
   503         ret = TMS_RESULT_UNINITIALIZED_OBJECT;
   504         }
   504         }
   732             {
   732             {
   733             event.curr_state = aEventType;
   733             event.curr_state = aEventType;
   734             event.prev_state = iPrevState;
   734             event.prev_state = iPrevState;
   735             if (iObserver)
   735             if (iObserver)
   736                 {
   736                 {
   737                 event.type = TMS_EVENT_STREAM_STATE_CHANGED;
   737                 if (aError != TMS_RESULT_SUCCESS)
       
   738                     {
       
   739                     event.type = TMS_EVENT_STREAM_STATE_CHANGE_ERROR;
       
   740                     }
       
   741                 else
       
   742                     {
       
   743                     event.type = TMS_EVENT_STREAM_STATE_CHANGED;
       
   744                     }
   738                 iObserver->TMSStreamEvent(*iParent, event);
   745                 iObserver->TMSStreamEvent(*iParent, event);
   739                 }
   746                 }
   740             break;
   747             break;
   741             }
   748             }
   742         default:
   749         default: