예제 #1
0
void
AudioSinkWrapper::Start(int64_t aStartTime, const MediaInfo& aInfo)
{
  AssertOwnerThread();
  MOZ_ASSERT(!mIsStarted, "playback already started.");

  mIsStarted = true;

  mAudioSink = mCreator->Create();
  mEndPromise = mAudioSink->Init();
  SetPlaybackParams(mParams);
}
예제 #2
0
void
AudioSinkWrapper::Start(int64_t aStartTime, const MediaInfo& aInfo)
{
  AssertOwnerThread();
  MOZ_ASSERT(!mIsStarted, "playback already started.");

  mIsStarted = true;
  mPlayDuration = aStartTime;
  mPlayStartTime = TimeStamp::Now();

  // no audio is equivalent to audio ended before video starts.
  mAudioEnded = !aInfo.HasAudio();

  if (aInfo.HasAudio()) {
    mAudioSink = mCreator->Create();
    mEndPromise = mAudioSink->Init();
    SetPlaybackParams(mParams);

    mAudioSinkPromise.Begin(mEndPromise->Then(
      mOwnerThread.get(), __func__, this,
      &AudioSinkWrapper::OnAudioEnded,
      &AudioSinkWrapper::OnAudioEnded));
  }
}