//-----------------------------------------------------------------------
      void TransportStream::write(
                                  SecureByteBlockPtr bufferToAdopt,
                                  StreamHeaderPtr header
                                  )
      {
        ZS_THROW_INVALID_ARGUMENT_IF(!bufferToAdopt)

        AutoRecursiveLock lock(getLock());

        if (isShutdown()) {
          ZS_LOG_WARNING(Detail, log("cannot write as already shutdown"))
          return;
        }

        if (mBlockQueue) {
          ZS_LOG_TRACE(log("write blocked thus putting buffer into block queue") + ZS_PARAM("size", bufferToAdopt->SizeInBytes()) + ZS_PARAM("header", (bool)header))
          if (!mBlockHeader) {
            mBlockHeader = header;
          }
          if (bufferToAdopt->SizeInBytes() > 0) {
            mBlockQueue->Put(bufferToAdopt->BytePtr(), bufferToAdopt->SizeInBytes());
          }
          return;
        }

        Buffer buffer;
        buffer.mBuffer = bufferToAdopt;
        buffer.mHeader = header;

        ZS_LOG_TRACE(log("buffer written") + ZS_PARAM("written", bufferToAdopt->SizeInBytes()) )

        mBuffers.push_back(buffer);

        notifySubscribers(false, true);
      }
Пример #2
0
    //-------------------------------------------------------------------------
    void SocketSet::delegateGone(SocketPtr socket)
    {
      ZS_THROW_BAD_STATE_IF(mPollingSocketsWithDelegateGoneCount >= mPollingCount) // can never grow larger than the polling count

      mPollingSocketsWithDelegateGone[mPollingSocketsWithDelegateGoneCount] = socket;
      ++mPollingSocketsWithDelegateGoneCount;

      ZS_LOG_TRACE(log("delegate gone") + ZS_PARAM("handle", socket->getSocket()) + ZS_PARAM("gone count", mPollingSocketsWithDelegateGoneCount))
    }
Пример #3
0
    //-------------------------------------------------------------------------
    void SocketSet::firedEvent(
                               SocketPtr socket,
                               event_type event
                               )
    {
      ZS_THROW_BAD_STATE_IF(mPollingFiredEventCount >= mPollingCount) // can never grow larger than the polling count

      mPollingFiredEvents[mPollingFiredEventCount].first = socket;
      mPollingFiredEvents[mPollingFiredEventCount].second = event;
      ++mPollingFiredEventCount;

      ZS_LOG_INSANE(log("fire event") + ZS_PARAM("handle", socket->getSocket()) + ZS_PARAM("event", friendly(event)) + ZS_PARAM("fired count", mPollingFiredEventCount))
    }
    //-------------------------------------------------------------------------
    void RTPReceiverChannelAudio::onPromiseSettled(PromisePtr promise)
    {
      ZS_LOG_DEBUG(log("promise settled") + ZS_PARAM("promise", promise->getID()))

      AutoRecursiveLock lock(*this);
      step();
    }
      //-----------------------------------------------------------------------
      void TransportStream::write(
                                  const BYTE *inBuffer,
                                  size_t bufferLengthInBytes,
                                  StreamHeaderPtr header
                                  )
      {
        ZS_THROW_INVALID_ARGUMENT_IF(!inBuffer)

        AutoRecursiveLock lock(getLock());

        if (isShutdown()) {
          ZS_LOG_WARNING(Detail, log("cannot write as already shutdown"))
          return;
        }

        if (mBlockQueue) {
          ZS_LOG_TRACE(log("write blocked thus putting buffer into block queue") + ZS_PARAM("size", bufferLengthInBytes) + ZS_PARAM("header", (bool)header))
          if (!mBlockHeader) {
            mBlockHeader = header;
          }
          if (bufferLengthInBytes > 0) {
            mBlockQueue->Put(inBuffer, bufferLengthInBytes);
          }
          return;
        }

        write(IHelper::convertToBuffer(inBuffer, bufferLengthInBytes), header);
      }
    //-------------------------------------------------------------------------
    void RTPReceiverChannelAudio::onTimer(TimerPtr timer)
    {
      ZS_LOG_DEBUG(log("timer") + ZS_PARAM("timer id", timer->getID()))

      AutoRecursiveLock lock(*this);
#define TODO 1
#define TODO 2
    }
    //-------------------------------------------------------------------------
    void RTPSenderChannelAudio::onPromiseSettled(PromisePtr promise)
    {
      ZS_LOG_DEBUG(log("promise settled") + ZS_PARAM("promise", promise->getID()))

      AutoRecursiveLock lock(*this);
      step();
      
      if (ZS_DYNAMIC_PTR_CAST(PromiseWithRTPMediaEngineChannelResource, promise)) {
      }
    }
    //-------------------------------------------------------------------------
    void RTPReceiverChannelAudio::onSecureTransportState(ISecureTransport::States state)
    {
      ZS_LOG_TRACE(log("notified secure transport state") + ZS_PARAM("state", ISecureTransport::toString(state)))

      AutoRecursiveLock lock(*this);

      mTransportState = state;

      if (mChannelResource)
        mChannelResource->notifyTransportState(state);
    }
Пример #9
0
  //---------------------------------------------------------------------------
  Exception::Exception(
                       const Subsystem &subsystem,
                       const String &message,
                       CSTR function,
                       CSTR filePath,
                       ULONG lineNumber,
                       const char *expression
                       ) :
    mSubsystem(subsystem),
    mMessage(message),
    mFunction(function),
    mFilePath(filePath),
    mLineNumber(lineNumber)
  {
    ZS_EVENTING_5(subsystem, e, Basic, ExceptionEvent, zs, Exception, Exception, string, message, message, string, function, function, string, filePath, filePath, ulong, lineNumber, lineNumber, string, expression, expression);

    if (expression) {
      mParams << ZS_PARAM("expression", expression);
    }

    // force log of event
    Log::log(subsystem, Log::Error, Log::Basic, mParams, function, filePath, lineNumber);
  }
Пример #10
0
 //-------------------------------------------------------------------------
 SocketPtr *SocketSet::getSocketsWithDelegateGone(poll_size &outSize)
 {
   outSize = mPollingSocketsWithDelegateGoneCount;
   ZS_LOG_INSANE(log("get delegates gone") + ZS_PARAM("gone count", mPollingSocketsWithDelegateGoneCount))
   return mPollingSocketsWithDelegateGone;
 }
Пример #11
0
 //-------------------------------------------------------------------------
 SocketSet::FiredEventPair *SocketSet::getFiredEvents(poll_size &outSize)
 {
   outSize = mPollingFiredEventCount;
   ZS_LOG_INSANE(log("get fired events") + ZS_PARAM("fired count", mPollingFiredEventCount))
   return mPollingFiredEvents;
 }