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


C++ MediaStreamListener::NotifyFinishedTrackCreation方法代码示例

本文整理汇总了C++中MediaStreamListener::NotifyFinishedTrackCreation方法的典型用法代码示例。如果您正苦于以下问题:C++ MediaStreamListener::NotifyFinishedTrackCreation方法的具体用法?C++ MediaStreamListener::NotifyFinishedTrackCreation怎么用?C++ MediaStreamListener::NotifyFinishedTrackCreation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MediaStreamListener的用法示例。


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

示例1: tracks

void
AudioCaptureStream::ProcessInput(GraphTime aFrom, GraphTime aTo,
                                 uint32_t aFlags)
{
  uint32_t inputCount = mInputs.Length();
  StreamBuffer::Track* track = EnsureTrack(mTrackId);
  // Notify the DOM everything is in order.
  if (!mTrackCreated) {
    for (uint32_t i = 0; i < mListeners.Length(); i++) {
      MediaStreamListener* l = mListeners[i];
      AudioSegment tmp;
      l->NotifyQueuedTrackChanges(
        Graph(), mTrackId, 0, MediaStreamListener::TRACK_EVENT_CREATED, tmp);
      l->NotifyFinishedTrackCreation(Graph());
    }
    mTrackCreated = true;
  }

  // If the captured stream is connected back to a object on the page (be it an
  // HTMLMediaElement with a stream as source, or an AudioContext), a cycle
  // situation occur. This can work if it's an AudioContext with at least one
  // DelayNode, but the MSG will mute the whole cycle otherwise.
  if (mFinished || InMutedCycle() || inputCount == 0) {
    track->Get<AudioSegment>()->AppendNullData(aTo - aFrom);
  } else {
    // We mix down all the tracks of all inputs, to a stereo track. Everything
    // is {up,down}-mixed to stereo.
    mMixer.StartMixing();
    AudioSegment output;
    for (uint32_t i = 0; i < inputCount; i++) {
      MediaStream* s = mInputs[i]->GetSource();
      StreamBuffer::TrackIter tracks(s->GetStreamBuffer(), MediaSegment::AUDIO);
      while (!tracks.IsEnded()) {
        AudioSegment* inputSegment = tracks->Get<AudioSegment>();
        StreamTime inputStart = s->GraphTimeToStreamTimeWithBlocking(aFrom);
        StreamTime inputEnd = s->GraphTimeToStreamTimeWithBlocking(aTo);
        AudioSegment toMix;
        toMix.AppendSlice(*inputSegment, inputStart, inputEnd);
        // Care for streams blocked in the [aTo, aFrom] range.
        if (inputEnd - inputStart < aTo - aFrom) {
          toMix.AppendNullData((aTo - aFrom) - (inputEnd - inputStart));
        }
        toMix.Mix(mMixer, MONO, Graph()->GraphRate());
        tracks.Next();
      }
    }
    // This calls MixerCallback below
    mMixer.FinishMixing();
  }

  // Regardless of the status of the input tracks, we go foward.
  mBuffer.AdvanceKnownTracksTime(GraphTimeToStreamTimeWithBlocking((aTo)));
}
开发者ID:Shaif95,项目名称:gecko-dev,代码行数:53,代码来源:AudioCaptureStream.cpp

示例2: lock

void
CameraPreviewMediaStream::OnPreviewStateChange(bool aActive)
{
    if (aActive) {
        MutexAutoLock lock(mMutex);
        if (!mTrackCreated) {
            mTrackCreated = true;
            VideoSegment tmpSegment;
            for (uint32_t j = 0; j < mListeners.Length(); ++j) {
                MediaStreamListener* l = mListeners[j];
                l->NotifyQueuedTrackChanges(mFakeMediaStreamGraph, TRACK_VIDEO, 0,
                                            MediaStreamListener::TRACK_EVENT_CREATED,
                                            tmpSegment);
                l->NotifyFinishedTrackCreation(mFakeMediaStreamGraph);
            }
        }
    }
}
开发者ID:carriercomm,项目名称:gecko-dev,代码行数:18,代码来源:CameraPreviewMediaStream.cpp


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