当前位置: 首页>>代码示例>>C++>>正文


C++ GraphImpl函数代码示例

本文整理汇总了C++中GraphImpl函数的典型用法代码示例。如果您正苦于以下问题:C++ GraphImpl函数的具体用法?C++ GraphImpl怎么用?C++ GraphImpl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GraphImpl函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mon

bool
AudioCallbackDriver::OSXDeviceSwitchingWorkaround()
{
    MonitorAutoLock mon(GraphImpl()->GetMonitor());
    if (mSelfReference) {
        // Apparently, depending on the osx version, on device switch, the
        // callback is called "some" number of times, and then stops being called,
        // and then gets called again. 10 is to be safe, it's a low-enough number
        // of milliseconds anyways (< 100ms)
        //STREAM_LOG(LogLevel::Debug, ("Callbacks during switch: %d", mCallbackReceivedWhileSwitching+1));
        if (mCallbackReceivedWhileSwitching++ >= 10) {
            STREAM_LOG(LogLevel::Debug, ("Got %d callbacks, switching back to CallbackDriver", mCallbackReceivedWhileSwitching));
            // If we have a self reference, we have fallen back temporarily on a
            // system clock driver, but we just got called back, that means the osx
            // audio backend has switched to the new device.
            // Ask the graph to switch back to the previous AudioCallbackDriver
            // (`this`), and when the graph has effectively switched, we can drop
            // the self reference and unref the SystemClockDriver we fallen back on.
            if (GraphImpl()->CurrentDriver() == this) {
                mSelfReference.Drop(this);
                mNextDriver = nullptr;
            } else {
                GraphImpl()->CurrentDriver()->SwitchAtNextIteration(this);
            }

        }
        return true;
    }

    return false;
}
开发者ID:bitwiseworks,项目名称:mozilla-os2,代码行数:31,代码来源:GraphDriver.cpp

示例2: Message

void
AudioNodeStream::SetChannelMixingParameters(uint32_t aNumberOfChannels,
                                            ChannelCountMode aChannelCountMode,
                                            ChannelInterpretation aChannelInterpretation)
{
  class Message final : public ControlMessage
  {
  public:
    Message(AudioNodeStream* aStream,
            uint32_t aNumberOfChannels,
            ChannelCountMode aChannelCountMode,
            ChannelInterpretation aChannelInterpretation)
      : ControlMessage(aStream),
        mNumberOfChannels(aNumberOfChannels),
        mChannelCountMode(aChannelCountMode),
        mChannelInterpretation(aChannelInterpretation)
    {}
    void Run() override
    {
      static_cast<AudioNodeStream*>(mStream)->
        SetChannelMixingParametersImpl(mNumberOfChannels, mChannelCountMode,
                                       mChannelInterpretation);
    }
    uint32_t mNumberOfChannels;
    ChannelCountMode mChannelCountMode;
    ChannelInterpretation mChannelInterpretation;
  };

  GraphImpl()->AppendMessage(MakeUnique<Message>(this, aNumberOfChannels,
                                                 aChannelCountMode,
                                                 aChannelInterpretation));
}
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:32,代码来源:AudioNodeStream.cpp

示例3: Message

void
AudioNodeStream::SetStreamTimeParameter(uint32_t aIndex, AudioContext* aContext,
                                        double aStreamTime)
{
  class Message : public ControlMessage {
  public:
    Message(AudioNodeStream* aStream, uint32_t aIndex, MediaStream* aRelativeToStream,
            double aStreamTime)
      : ControlMessage(aStream), mStreamTime(aStreamTime),
        mRelativeToStream(aRelativeToStream), mIndex(aIndex) {}
    virtual void Run()
    {
      static_cast<AudioNodeStream*>(mStream)->
          SetStreamTimeParameterImpl(mIndex, mRelativeToStream, mStreamTime);
    }
    double mStreamTime;
    MediaStream* mRelativeToStream;
    uint32_t mIndex;
  };

  MOZ_ASSERT(this);
  GraphImpl()->AppendMessage(new Message(this, aIndex,
      aContext->DestinationStream(),
      aContext->DOMTimeToStreamTime(aStreamTime)));
}
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:25,代码来源:AudioNodeStream.cpp

示例4: Message

void
AudioNodeStream::SendTimelineEvent(uint32_t aIndex,
                                   const AudioTimelineEvent& aEvent)
{
  class Message final : public ControlMessage
  {
  public:
    Message(AudioNodeStream* aStream, uint32_t aIndex,
            const AudioTimelineEvent& aEvent)
      : ControlMessage(aStream),
        mEvent(aEvent),
        mSampleRate(aStream->SampleRate()),
        mIndex(aIndex)
    {}
    virtual void Run() override
    {
      static_cast<AudioNodeStream*>(mStream)->Engine()->
          RecvTimelineEvent(mIndex, mEvent);
    }
    AudioTimelineEvent mEvent;
    TrackRate mSampleRate;
    uint32_t mIndex;
  };
  GraphImpl()->AppendMessage(new Message(this, aIndex, aEvent));
}
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:25,代码来源:AudioNodeStream.cpp

示例5: Message

void
AudioNodeStream::SetTimelineParameter(uint32_t aIndex,
                                      const AudioParamTimeline& aValue)
{
  class Message final : public ControlMessage
  {
  public:
    Message(AudioNodeStream* aStream, uint32_t aIndex,
            const AudioParamTimeline& aValue)
      : ControlMessage(aStream),
        mValue(aValue),
        mSampleRate(aStream->SampleRate()),
        mIndex(aIndex)
    {}
    virtual void Run() override
    {
      static_cast<AudioNodeStream*>(mStream)->Engine()->
          SetTimelineParameter(mIndex, mValue, mSampleRate);
    }
    AudioParamTimeline mValue;
    TrackRate mSampleRate;
    uint32_t mIndex;
  };
  GraphImpl()->AppendMessage(new Message(this, aIndex, aValue));
}
开发者ID:paulmadore,项目名称:luckyde,代码行数:25,代码来源:AudioNodeStream.cpp

示例6: GraphImpl

void
AudioNodeStream::CheckForInactive()
{
  if (((mActiveInputCount > 0 || mEngine->IsActive()) &&
       !mMarkAsFinishedAfterThisBlock) ||
      !mIsActive) {
    return;
  }

  mIsActive = false;
  mInputChunks.Clear(); // not required for foreseeable future
  for (auto& chunk : mLastChunks) {
    chunk.SetNull(WEBAUDIO_BLOCK_SIZE);
  }
  if (!(mFlags & EXTERNAL_OUTPUT)) {
    GraphImpl()->IncrementSuspendCount(this);
  }
  if (IsAudioParamStream()) {
    return;
  }

  for (const auto& consumer : mConsumers) {
    AudioNodeStream* ns = consumer->GetDestination()->AsAudioNodeStream();
    if (ns) {
      ns->DecrementActiveInputCount();
    }
  }
}
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:28,代码来源:AudioNodeStream.cpp

示例7: message

void
AudioNodeStream::ScheduleCheckForInactive()
{
  if (mActiveInputCount > 0 && !mMarkAsFinishedAfterThisBlock) {
    return;
  }

  nsAutoPtr<CheckForInactiveMessage> message(new CheckForInactiveMessage(this));
  GraphImpl()->RunMessageAfterProcessing(Move(message));
}
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:10,代码来源:AudioNodeStream.cpp

示例8: GraphImpl

void
AudioNodeStream::ScheduleCheckForInactive()
{
  if (mActiveInputCount > 0 && !mMarkAsFinishedAfterThisBlock) {
    return;
  }

  auto message = MakeUnique<CheckForInactiveMessage>(this);
  GraphImpl()->RunMessageAfterProcessing(Move(message));
}
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:10,代码来源:AudioNodeStream.cpp

示例9: Run

  virtual void Run() override
  {
    auto ns = static_cast<AudioNodeStream*>(mStream);
    ns->mBufferStartTime -= mAdvance;

    StreamBuffer::Track* track = ns->EnsureTrack(AUDIO_TRACK);
    track->Get<AudioSegment>()->AppendNullData(mAdvance);

    ns->GraphImpl()->DecrementSuspendCount(mStream);
  }
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:10,代码来源:AudioNodeStream.cpp

示例10: Message

void
AudioCaptureStream::Start()
{
    class Message : public ControlMessage {
    public:
        explicit Message(AudioCaptureStream* aStream)
            : ControlMessage(aStream), mStream(aStream) {}

        virtual void Run()
        {
            mStream->mStarted = true;
        }

    protected:
        AudioCaptureStream* mStream;
    };
    GraphImpl()->AppendMessage(MakeUnique<Message>(this));
}
开发者ID:frap129,项目名称:hyperfox,代码行数:18,代码来源:AudioCaptureStream.cpp

示例11: Message

void
AudioNodeStream::SetTimelineParameter(uint32_t aIndex,
                                      const AudioEventTimeline<ErrorResult>& aValue)
{
  class Message : public ControlMessage {
  public:
    Message(AudioNodeStream* aStream, uint32_t aIndex,
            const AudioEventTimeline<ErrorResult>& aValue)
      : ControlMessage(aStream), mValue(aValue), mIndex(aIndex) {}
    virtual void Run()
    {
      static_cast<AudioNodeStream*>(mStream)->Engine()->
          SetTimelineParameter(mIndex, mValue);
    }
    AudioEventTimeline<ErrorResult> mValue;
    uint32_t mIndex;
  };
  GraphImpl()->AppendMessage(new Message(this, aIndex, aValue));
}
开发者ID:TelefonicaPushServer,项目名称:mozilla-central,代码行数:19,代码来源:AudioNodeStream.cpp

示例12: MOZ_ASSERT

  void TrackUnionStream::CopyTrackData(StreamBuffer::Track* aInputTrack,
                     uint32_t aMapIndex, GraphTime aFrom, GraphTime aTo,
                     bool* aOutputTrackFinished)
  {
    TrackMapEntry* map = &mTrackMap[aMapIndex];
    StreamBuffer::Track* outputTrack = mBuffer.FindTrack(map->mOutputTrackID);
    MOZ_ASSERT(outputTrack && !outputTrack->IsEnded(), "Can't copy to ended track");

    MediaSegment* segment = map->mSegment;
    MediaStream* source = map->mInputPort->GetSource();

    GraphTime next;
    *aOutputTrackFinished = false;
    for (GraphTime t = aFrom; t < aTo; t = next) {
      MediaInputPort::InputInterval interval = map->mInputPort->GetNextInputInterval(t);
      interval.mEnd = std::min(interval.mEnd, aTo);
      StreamTime inputEnd = source->GraphTimeToStreamTime(interval.mEnd);
      StreamTime inputTrackEndPoint = STREAM_TIME_MAX;

      if (aInputTrack->IsEnded() &&
          aInputTrack->GetEnd() <= inputEnd) {
        inputTrackEndPoint = aInputTrack->GetEnd();
        *aOutputTrackFinished = true;
      }

      if (interval.mStart >= interval.mEnd) {
        break;
      }
      StreamTime ticks = interval.mEnd - interval.mStart;
      next = interval.mEnd;

      StreamTime outputStart = outputTrack->GetEnd();

      if (interval.mInputIsBlocked) {
        // Maybe the input track ended?
        segment->AppendNullData(ticks);
        STREAM_LOG(LogLevel::Verbose, ("TrackUnionStream %p appending %lld ticks of null data to track %d",
                   this, (long long)ticks, outputTrack->GetID()));
      } else if (InMutedCycle()) {
        segment->AppendNullData(ticks);
      } else {
        if (GraphImpl()->StreamSuspended(source)) {
          segment->AppendNullData(aTo - aFrom);
        } else {
          MOZ_ASSERT(outputTrack->GetEnd() == GraphTimeToStreamTime(interval.mStart),
                     "Samples missing");
          StreamTime inputStart = source->GraphTimeToStreamTime(interval.mStart);
          segment->AppendSlice(*aInputTrack->GetSegment(),
                               std::min(inputTrackEndPoint, inputStart),
                               std::min(inputTrackEndPoint, inputEnd));
        }
      }
      ApplyTrackDisabling(outputTrack->GetID(), segment);
      for (uint32_t j = 0; j < mListeners.Length(); ++j) {
        MediaStreamListener* l = mListeners[j];
        l->NotifyQueuedTrackChanges(Graph(), outputTrack->GetID(),
                                    outputStart, 0, *segment);
      }
      outputTrack->GetSegment()->AppendFrom(segment);
    }
  }
开发者ID:ShakoHo,项目名称:gecko-dev,代码行数:61,代码来源:TrackUnionStream.cpp

示例13: MOZ_ASSERT

void
AudioCallbackDriver::Init()
{
    cubeb_stream_params params;
    uint32_t latency;

    MOZ_ASSERT(!NS_IsMainThread(),
               "This is blocking and should never run on the main thread.");

    mSampleRate = params.rate = CubebUtils::PreferredSampleRate();

#if defined(__ANDROID__)
#if defined(MOZ_B2G)
    params.stream_type = CubebUtils::ConvertChannelToCubebType(mAudioChannel);
#else
    params.stream_type = CUBEB_STREAM_TYPE_MUSIC;
#endif
    if (params.stream_type == CUBEB_STREAM_TYPE_MAX) {
        NS_WARNING("Bad stream type");
        return;
    }
#else
    (void)mAudioChannel;
#endif

    params.channels = mGraphImpl->AudioChannelCount();
    if (AUDIO_OUTPUT_FORMAT == AUDIO_FORMAT_S16) {
        params.format = CUBEB_SAMPLE_S16NE;
    } else {
        params.format = CUBEB_SAMPLE_FLOAT32NE;
    }

    if (cubeb_get_min_latency(CubebUtils::GetCubebContext(), params, &latency) != CUBEB_OK) {
        NS_WARNING("Could not get minimal latency from cubeb.");
        return;
    }

    cubeb_stream* stream;
    if (cubeb_stream_init(CubebUtils::GetCubebContext(), &stream,
                          "AudioCallbackDriver", params, latency,
                          DataCallback_s, StateCallback_s, this) == CUBEB_OK) {
        mAudioStream.own(stream);
    } else {
        NS_WARNING("Could not create a cubeb stream for MediaStreamGraph, falling back to a SystemClockDriver");
        // Fall back to a driver using a normal thread.
        mNextDriver = new SystemClockDriver(GraphImpl());
        mNextDriver->SetGraphTime(this, mIterationStart, mIterationEnd);
        mGraphImpl->SetCurrentDriver(mNextDriver);
        DebugOnly<bool> found = mGraphImpl->RemoveMixerCallback(this);
        NS_WARN_IF_FALSE(!found, "Mixer callback not added when switching?");
        mNextDriver->Start();
        return;
    }

    cubeb_stream_register_device_changed_callback(mAudioStream,
            AudioCallbackDriver::DeviceChangedCallback_s);

    StartStream();

    STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver started."));
}
开发者ID:bitwiseworks,项目名称:mozilla-os2,代码行数:61,代码来源:GraphDriver.cpp


注:本文中的GraphImpl函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。