mmserv/tms/tmsimpl/src/tmsstreambodyimpl.cpp
changeset 53 eabc8c503852
parent 38 9e9fc5ab059f
equal deleted inserted replaced
48:a493a607b5bf 53:eabc8c503852
    27 #include "tmsshared.h"
    27 #include "tmsshared.h"
    28 #include "tmsstreambodyimpl.h"
    28 #include "tmsstreambodyimpl.h"
    29 #include "tmsmembuffer.h"
    29 #include "tmsmembuffer.h"
    30 #include "tmsclientsourceimpl.h"
    30 #include "tmsclientsourceimpl.h"
    31 #include "tmsclientsinkimpl.h"
    31 #include "tmsclientsinkimpl.h"
       
    32 #include "tmsmodemsourceimpl.h"
       
    33 #include "tmsmodemsinkimpl.h"
       
    34 #include "tmsmicsourceimpl.h"
       
    35 #include "tmsspeakersinkimpl.h"
    32 #include "tmsvolumeeffectimpl.h"
    36 #include "tmsvolumeeffectimpl.h"
    33 #include "tmsgaineffectimpl.h"
    37 #include "tmsgaineffectimpl.h"
    34 #include "tmsg711formatimpl.h"
    38 #include "tmsg711formatimpl.h"
    35 #include "tmsg729formatimpl.h"
    39 #include "tmsg729formatimpl.h"
    36 #include "tmsilbcformatimpl.h"
    40 #include "tmsilbcformatimpl.h"
    58     TRACE_PRN_FN_ENT;
    62     TRACE_PRN_FN_ENT;
    59     if (iMsgQHandler)
    63     if (iMsgQHandler)
    60         {
    64         {
    61         iMsgQHandler->Cancel();
    65         iMsgQHandler->Cancel();
    62         }
    66         }
       
    67     iMsgQHandler->RemoveObserver(*this);
    63     delete iMsgQHandler;
    68     delete iMsgQHandler;
    64     if (iMsgQueue.Handle() > 0)
    69     if (iMsgQueue.Handle() > 0)
    65         {
    70         {
    66         iMsgQueue.Close();
    71         iMsgQueue.Close();
    67         }
    72         }
   422                 ret = TMS_RESULT_INVALID_ARGUMENT;
   427                 ret = TMS_RESULT_INVALID_ARGUMENT;
   423                 break;
   428                 break;
   424             }
   429             }
   425         }
   430         }
   426 
   431 
   427     if (iContext.StreamType == TMS_STREAM_UPLINK)
       
   428         {
       
   429         if (iSink)
       
   430             {
       
   431             TMSSinkType sinkType;
       
   432             iSink->GetType(sinkType);
       
   433             switch (sinkType)
       
   434                 {
       
   435                 case TMS_SINK_CLIENT:
       
   436                     static_cast<TMSClientSinkImpl*> (iSink)->SetProxy(&iContext,
       
   437                             iMsgQHandler);
       
   438                     break;
       
   439                 case TMS_SINK_MODEM:
       
   440                 case TMS_SINK_SPEAKER:
       
   441                     break;
       
   442                 default:
       
   443                     ret = TMS_RESULT_INVALID_ARGUMENT;
       
   444                     break;
       
   445                 }
       
   446             }
       
   447         else
       
   448             {
       
   449             ret = TMS_RESULT_UNINITIALIZED_OBJECT;
       
   450             }
       
   451         }
       
   452     else if (iContext.StreamType == TMS_STREAM_DOWNLINK)
       
   453         {
       
   454         if (iSource)
       
   455             {
       
   456             TMSSourceType sourceType;
       
   457             iSource->GetType(sourceType);
       
   458             switch (sourceType)
       
   459                 {
       
   460                 case TMS_SOURCE_CLIENT:
       
   461                     static_cast<TMSClientSourceImpl*> (iSource)->SetProxy(
       
   462                             &iContext, iMsgQHandler);
       
   463                     break;
       
   464                 case TMS_SOURCE_MODEM:
       
   465                 case TMS_SOURCE_MIC:
       
   466                     break;
       
   467                 default:
       
   468                     ret = TMS_RESULT_INVALID_ARGUMENT;
       
   469                     break;
       
   470                 }
       
   471             }
       
   472         else
       
   473             {
       
   474             ret = TMS_RESULT_UNINITIALIZED_OBJECT;
       
   475             }
       
   476         }
       
   477 
       
   478     return ret;
   432     return ret;
   479     }
   433     }
   480 
   434 
   481 gint TMSStreamBodyImpl::Pause()
   435 gint TMSStreamBodyImpl::Pause()
   482     {
   436     {
   547                 {
   501                 {
   548                 if (iContext.CallType == TMS_CALL_IP &&
   502                 if (iContext.CallType == TMS_CALL_IP &&
   549                         iContext.StreamType == TMS_STREAM_DOWNLINK)
   503                         iContext.StreamType == TMS_STREAM_DOWNLINK)
   550                     {
   504                     {
   551                     iSource = source;
   505                     iSource = source;
       
   506                     static_cast<TMSClientSourceImpl*> (iSource)->SetProxy(
       
   507                              &iContext, iMsgQHandler);
   552                     ret = TMS_RESULT_SUCCESS;
   508                     ret = TMS_RESULT_SUCCESS;
   553                     }
   509                     }
   554                 }
   510                 }
   555                 break;
   511                 break;
   556             case TMS_SOURCE_MIC:
   512             case TMS_SOURCE_MIC:
   557                 {
   513                 {
   558                 if (iContext.StreamType == TMS_STREAM_UPLINK)
   514                 if (iContext.StreamType == TMS_STREAM_UPLINK)
   559                     {
   515                     {
   560                     iSource = source;
   516                     iSource = source;
       
   517                     static_cast<TMSMicSourceImpl*> (iSource)->SetProxy(
       
   518                              iContext.CallProxy, iMsgQHandler);
   561                     ret = TMS_RESULT_SUCCESS;
   519                     ret = TMS_RESULT_SUCCESS;
   562                     }
   520                     }
   563                 }
   521                 }
   564                 break;
   522                 break;
   565             case TMS_SOURCE_MODEM:
   523             case TMS_SOURCE_MODEM:
   566                 {
   524                 {
   567                 if (iContext.CallType == TMS_CALL_CS &&
   525                 if (iContext.CallType == TMS_CALL_CS &&
   568                         iContext.StreamType == TMS_STREAM_DOWNLINK)
   526                         iContext.StreamType == TMS_STREAM_DOWNLINK)
   569                     {
   527                     {
   570                     iSource = source;
   528                     iSource = source;
       
   529                     static_cast<TMSModemSourceImpl*> (iSource)->SetProxy(
       
   530                               iContext.CallProxy, iMsgQHandler);
   571                     ret = TMS_RESULT_SUCCESS;
   531                     ret = TMS_RESULT_SUCCESS;
   572                     }
   532                     }
   573                 break;
   533                 break;
   574                 }
   534                 }
   575             default:
   535             default:
   595                 {
   555                 {
   596                 if (iContext.CallType == TMS_CALL_IP &&
   556                 if (iContext.CallType == TMS_CALL_IP &&
   597                         iContext.StreamType == TMS_STREAM_UPLINK)
   557                         iContext.StreamType == TMS_STREAM_UPLINK)
   598                     {
   558                     {
   599                     iSink = sink;
   559                     iSink = sink;
       
   560                     static_cast<TMSClientSinkImpl*> (iSink)->SetProxy(&iContext,
       
   561                             iMsgQHandler);
   600                     ret = TMS_RESULT_SUCCESS;
   562                     ret = TMS_RESULT_SUCCESS;
   601                     }
   563                     }
   602                 }
   564                 }
   603                 break;
   565                 break;
   604             case TMS_SINK_SPEAKER:
   566             case TMS_SINK_SPEAKER:
   605                 {
   567                 {
   606                 if (iContext.StreamType == TMS_STREAM_DOWNLINK)
   568                 if (iContext.StreamType == TMS_STREAM_DOWNLINK)
   607                     {
   569                     {
   608                     iSink = sink;
   570                     iSink = sink;
       
   571                     static_cast<TMSSpeakerSinkImpl*> (iSink)->SetProxy(iContext.CallProxy,
       
   572                              iMsgQHandler);
   609                     ret = TMS_RESULT_SUCCESS;
   573                     ret = TMS_RESULT_SUCCESS;
   610                     }
   574                     }
   611                 }
   575                 }
   612                 break;
   576                 break;
   613             case TMS_SINK_MODEM:
   577             case TMS_SINK_MODEM:
   614                 {
   578                 {
   615                 if (iContext.CallType == TMS_CALL_CS &&
   579                 if (iContext.CallType == TMS_CALL_CS &&
   616                         iContext.StreamType == TMS_STREAM_UPLINK)
   580                         iContext.StreamType == TMS_STREAM_UPLINK)
   617                     {
   581                     {
   618                     iSink = sink;
   582                     iSink = sink;
       
   583                     static_cast<TMSModemSinkImpl*> (iSink)->SetProxy(iContext.CallProxy,
       
   584                              iMsgQHandler);
   619                     ret = TMS_RESULT_SUCCESS;
   585                     ret = TMS_RESULT_SUCCESS;
   620                     }
   586                     }
   621                 break;
   587                 }
   622                 }
   588                 break;
   623             default:
   589             default:
   624                 break;
   590                 break;
   625             }
   591             }
   626         }
   592         }
   627 
   593