Beispiel #1
0
// Handle messages for this resource.
UtlBoolean MprToneGen::handleMessage(MpResourceMsg& rMsg)
{
   UtlBoolean msgHandled = FALSE;
   int msgType;

   MpToneResourceMsg* toneMsg = (MpToneResourceMsg*)(&rMsg);

   msgType = rMsg.getMsg();
   switch (msgType)
   {
   case MpResourceMsg::MPRM_START_TONE:
      MpToneGen_startTone(mpToneGenState, toneMsg->getToneCode());
      enable();
      msgHandled = TRUE;
      break;
   case MpResourceMsg::MPRM_STOP_TONE:
      MpToneGen_stopTone(mpToneGenState);
      disable();
      msgHandled = TRUE;
      break;
   default:
      // If we don't handle the message here, let our parent try.
      msgHandled = MpResource::handleMessage(rMsg); 
      break;
   }
   return msgHandled;
}
Beispiel #2
0
// Handles an incoming resource message for this media processing object.
// Returns TRUE if the message was handled, otherwise FALSE.
UtlBoolean MpResource::handleMessage(MpResourceMsg& rMsg)
{
   UtlBoolean msgHandled = FALSE;

   // Do stuff for resource messages.
   msgHandled = TRUE; // assume we'll handle the msg
   switch (rMsg.getMsg())
   {
   case MpResourceMsg::MPRM_RESOURCE_DISABLE:   // disable this resource
      msgHandled = handleDisable();
      break;
   case MpResourceMsg::MPRM_RESOURCE_ENABLE:    // enable this resource
      msgHandled = handleEnable();
      break;
   case MpResourceMsg::MPRM_DISABLE_ALL_NOTIFICATIONS:
      // Disable all notifications sent out from this resource.
      setNotificationsEnabled(FALSE);
      break;
   case MpResourceMsg::MPRM_ENABLE_ALL_NOTIFICATIONS:
      // Enable all notifications sent out from this resource.
      setNotificationsEnabled(TRUE);
      break;
   default:
      msgHandled = FALSE; // we didn't handle the msg after all
      break;
   }

   return msgHandled;
}
UtlBoolean MpRtpInputAudioConnection::handleMessage(MpResourceMsg& rMsg)
{
    UtlBoolean result = FALSE;
    unsigned char messageSubtype = rMsg.getMsgSubType();
    switch(messageSubtype)
    {
    case MpResourceMsg::MPRM_START_RECEIVE_RTP:
        {
            MprRtpStartReceiveMsg* startMessage = (MprRtpStartReceiveMsg*) &rMsg;
            UtlSList codecList;
            startMessage->getCodecList(codecList);
            OsSocket* rtpSocket = startMessage->getRtpSocket();
            OsSocket* rtcpSocket = startMessage->getRtcpSocket();

            handleStartReceiveRtp(codecList, *rtpSocket, *rtcpSocket);
            result = TRUE;
        }
        break;

    case MpResourceMsg::MPRM_STOP_RECEIVE_RTP:
        handleStopReceiveRtp();
        result = TRUE;
        break;

    default:
        result = MpResource::handleMessage(rMsg);
        break;
    }
    return(result);
}
UtlBoolean MpRtpInputConnection::handleMessage(MpResourceMsg& rMsg)
{
   UtlBoolean msgHandled = FALSE;

   switch (rMsg.getMsg()) 
   {
   case MPRM_SET_INACTIVITY_TIMEOUT:
      {
         MpIntResourceMsg *pMsg = (MpIntResourceMsg*)&rMsg;
         OsTime timeout(pMsg->getData());
         handleSetInactivityTimeout(timeout);
      }
      msgHandled = TRUE;
      break;

   case MPRM_ENABLE_SSRC_DISCARD:
   case MPRM_DISABLE_SSRC_DISCARD:
      {
         MpIntResourceMsg *pMsg = (MpIntResourceMsg*)&rMsg;
         RtpSRC ssrc = pMsg->getData();
         UtlBoolean enable = (rMsg.getMsg() == MPRM_ENABLE_SSRC_DISCARD);
         handleEnableSsrcDiscard(enable, ssrc);
      }
      msgHandled = TRUE;
      break;

   case MpResourceMsg::MPRM_DISABLE_ALL_NOTIFICATIONS:
   case MpResourceMsg::MPRM_ENABLE_ALL_NOTIFICATIONS:
      // Enable/disable all notifications sent out from this resource.
      msgHandled = MpResource::handleMessage(rMsg); 
      if (msgHandled)
      {
         UtlBoolean enabled = (rMsg.getMsg() == MpResourceMsg::MPRM_ENABLE_ALL_NOTIFICATIONS);
         mpRtpDispatcher->setNotificationsEnabled(enabled);
      }
      break;

   default:
      // If we don't handle the message here, let our parent try.
      msgHandled = MpResource::handleMessage(rMsg); 
      break;
   }
   return msgHandled;
}
Beispiel #5
0
UtlBoolean MprDelay::handleMessage(MpResourceMsg& rMsg)
{
   UtlBoolean msgHandled = TRUE;
   switch (rMsg.getMsg())
   {
   case MPRM_DELAY_START_PLAY:
      mState = MPDS_PLAYING;
      break;
   case MPRM_DELAY_STOP_PLAY:
      mState = MPDS_WAITING;
      mFifo.reset();
      break;
   default:
      return MpResource::handleMessage(rMsg);
   }
   return msgHandled;
}
Beispiel #6
0
UtlBoolean MprBridge::handleMessage(MpResourceMsg& rMsg)
{
   UtlBoolean msgHandled = FALSE;

   MprBridgeSetGainsMsg* pBridgeMsg = NULL;
   switch (rMsg.getMsg()) 
   {
   case MpResourceMsg::MPRM_BRIDGE_SET_GAINS:
      pBridgeMsg = (MprBridgeSetGainsMsg*)&rMsg;

      if (pBridgeMsg->getType() == MprBridgeSetGainsMsg::GAINS_ROW)
      {
         // Set row in mix matrix
         handleSetMixWeightsForOutput(pBridgeMsg->getPort(),
                                      pBridgeMsg->getGainsNum(),
                                      pBridgeMsg->getGains());
      }
      else if (pBridgeMsg->getType() == MprBridgeSetGainsMsg::GAINS_COLUMN)
      {
         // Set column in mix matrix
         handleSetMixWeightsForInput(pBridgeMsg->getPort(),
                                     pBridgeMsg->getGainsNum(),
                                     pBridgeMsg->getGains());
      }
      else
      {
         // Unknown type
         assert(false);
      }

      msgHandled = TRUE;
      break;

   default:
      // If we don't handle the message here, let our parent try.
      msgHandled = MpResource::handleMessage(rMsg); 
      break;
   }
   return msgHandled;
}