mmserv/voipaudioservices/VoIPServer/src/VoIPDownlinkThread.cpp
changeset 53 eabc8c503852
parent 14 80975da52420
equal deleted inserted replaced
48:a493a607b5bf 53:eabc8c503852
    48     Stop();
    48     Stop();
    49 
    49 
    50     delete iJitterBuffer;
    50     delete iJitterBuffer;
    51     delete iAddJBuffer;
    51     delete iAddJBuffer;
    52     delete iGetJBuffer;
    52     delete iGetJBuffer;
    53 
       
    54     delete iAudioOutput;
    53     delete iAudioOutput;
    55     delete iErrConcealmentIntfc;
    54     delete iErrConcealmentIntfc;
    56     delete iG711DecoderIntfc;
    55     delete iG711DecoderIntfc;
    57     delete iG729DecoderIntfc;
    56     delete iG729DecoderIntfc;
    58     delete iIlbcDecoderIntfc;
    57     delete iIlbcDecoderIntfc;
   460             {
   459             {
   461             break;
   460             break;
   462             }
   461             }
   463         }
   462         }
   464 
   463 
       
   464     if (!iAudioOutput)
       
   465         {
       
   466         iAudioOutput = CAudioOutput::NewL(*iDevSound);
       
   467         }
       
   468 
   465     TRACE_PRN_FN_EXT;
   469     TRACE_PRN_FN_EXT;
   466     }
   470     }
   467 
   471 
   468 // -----------------------------------------------------------------------------
   472 // -----------------------------------------------------------------------------
   469 // CVoIPDownlinkThread::SetVolume
   473 // CVoIPDownlinkThread::SetVolume
   504 
   508 
   505     iShared.iMutex.Wait();
   509     iShared.iMutex.Wait();
   506     TUint device = iShared.iAudioDevice;
   510     TUint device = iShared.iAudioDevice;
   507     iShared.iMutex.Signal();
   511     iShared.iMutex.Signal();
   508 
   512 
   509     if (!iAudioOutput)
       
   510         {
       
   511         iAudioOutput = CAudioOutput::NewL(*iDevSound);
       
   512         }
       
   513 
       
   514     if (iAudioOutput)
   513     if (iAudioOutput)
   515         {
   514         {
   516         // ENoPreference=0, EAll=1, ENoOutput=2, EPrivate=3, EPublic=4
   515         // ENoPreference=0, EAll=1, ENoOutput=2, EPrivate=3, EPublic=4
   517         CAudioOutput::TAudioOutputPreference outputDev;
   516         CAudioOutput::TAudioOutputPreference outputDev;
   518 
   517 
   527             outputDev = CAudioOutput::EPublic;
   526             outputDev = CAudioOutput::EPublic;
   528             }
   527             }
   529         else // Use default device routing
   528         else // Use default device routing
   530             {
   529             {
   531             outputDev = CAudioOutput::ENoPreference;
   530             outputDev = CAudioOutput::ENoPreference;
   532             } //make sure doesn't break loudspeaker audio
   531             }
   533 
   532 
   534         iAudioOutput->SetAudioOutputL(outputDev);
   533         iAudioOutput->SetAudioOutputL(outputDev);
       
   534         TRACE_PRN_N1(_L("Output device set=[%d]"), outputDev);
   535         }
   535         }
   536 
   536 
   537     TRACE_PRN_FN_EXT;
   537     TRACE_PRN_FN_EXT;
   538     }
   538     }
   539 
   539 
   544 //
   544 //
   545 void CVoIPDownlinkThread::GetAudioDeviceL()
   545 void CVoIPDownlinkThread::GetAudioDeviceL()
   546     {
   546     {
   547     TRACE_PRN_FN_ENT;
   547     TRACE_PRN_FN_ENT;
   548 
   548 
   549     if (!iAudioOutput)
       
   550         {
       
   551         iAudioOutput = CAudioOutput::NewL(*iDevSound);
       
   552         }
       
   553 
       
   554     if (iAudioOutput)
   549     if (iAudioOutput)
   555         {
   550         {
       
   551         CVoIPAudioDownlinkStream::TVoIPOutputDevice device;
   556         CAudioOutput::TAudioOutputPreference outputDev =
   552         CAudioOutput::TAudioOutputPreference outputDev =
   557                 iAudioOutput->AudioOutput();
   553                 iAudioOutput->AudioOutput();
   558 
   554         TRACE_PRN_N1(_L("VoIP->DNL GetAudioDeviceL [%d]"), outputDev);
   559         CVoIPAudioDownlinkStream::TVoIPOutputDevice device;
       
   560 
   555 
   561         switch (outputDev)
   556         switch (outputDev)
   562             {
   557             {
   563             case (CAudioOutput::ENoPreference):
   558             case (CAudioOutput::ENoPreference):
   564             case (CAudioOutput::EAll):
   559             case (CAudioOutput::EAll):
   938 // CVoIPDownlinkThread::ConfigureJitterBufferL
   933 // CVoIPDownlinkThread::ConfigureJitterBufferL
   939 // -----------------------------------------------------------------------------
   934 // -----------------------------------------------------------------------------
   940 //
   935 //
   941 void CVoIPDownlinkThread::ConfigureJitterBufferL()
   936 void CVoIPDownlinkThread::ConfigureJitterBufferL()
   942     {
   937     {
   943     TInt err = KErrNone;
   938     TInt err = KErrNotSupported;
   944 
   939 
   945     if (iCodecID != KMMFFourCCCodePCM16)
   940     if (iCodecID != KMMFFourCCCodePCM16)
   946         {
   941         {
   947         if (iJitterBuffer)
   942         if (iJitterBuffer)
   948             {
   943             {
  1267             {
  1262             {
  1268             ConcealErrorForNextBuffer();
  1263             ConcealErrorForNextBuffer();
  1269             break;
  1264             break;
  1270             }
  1265             }
  1271         case MJitterBufferObserver::EGeneralError:
  1266         case MJitterBufferObserver::EGeneralError:
  1272 //        case MJitterBufferObserver::EBufferUnderflow:
  1267 //      case MJitterBufferObserver::EBufferUnderflow:
  1273 //        case MJitterBufferObserver::EBufferOverflow:
  1268 //      case MJitterBufferObserver::EBufferOverflow:
  1274         default:
  1269         default:
  1275             {
  1270             {
  1276             SendCmd(ECmdDnLinkJBError, aError);
  1271             SendCmd(ECmdDnLinkJBError, aError);
  1277             break;
  1272             break;
  1278             }
  1273             }