Beispiel #1
0
RefPtr<MP4TrackDemuxer::SeekPromise>
MP4TrackDemuxer::Seek(const media::TimeUnit& aTime)
{
  auto seekTime = aTime;
  mQueuedSample = nullptr;

  mIterator->Seek(seekTime.ToMicroseconds());

  // Check what time we actually seeked to.
  RefPtr<MediaRawData> sample;
  do {
    sample = GetNextSample();
    if (!sample) {
      return SeekPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_END_OF_STREAM,
                                          __func__);
    }
    if (!sample->Size()) {
      // This sample can't be decoded, continue searching.
      continue;
    }
    if (sample->mKeyframe) {
      mQueuedSample = sample;
      seekTime = mQueuedSample->mTime;
    }
  } while (!mQueuedSample);

  SetNextKeyFrameTime();

  return SeekPromise::CreateAndResolve(seekTime, __func__);
}
Beispiel #2
0
    int TickDelta::ToMilliseconds() const
    {
        if (*this == Infinite())
        {
            return _I32_MAX;
        }

        int64 nTickUs = ToMicroseconds();

        int64 lnRound = 500;
        if (nTickUs < 0)
        {
            lnRound = -500;
        }

        int64 lnDelta = (nTickUs + lnRound) / ((int64) 1000);
        AssertMsg((lnDelta <= INT_MAX) && (lnDelta >= INT_MIN), "Ensure no overflow");

        return (int) lnDelta;
    }
Beispiel #3
0
//	////////////////////////////////////////////////////////////////////////////
unsigned long long TimeVal::ToTicks() const
{
	return(ToMicroseconds());
}