Commit 20b22622 authored by Paul Adenot's avatar Paul Adenot
Browse files

Bug 18179974 - Adjust code to take advantage of the new TimeUnit API. r=alwu

parent 2fdac409
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ TEST(TestOggWriter, MultiPageInput)
  }

  size_t inputBytes = 0;
  const size_t USECS_PER_MS = 1000;
  auto frameData = MakeRefPtr<EncodedFrame::FrameData>();
  frameData->SetLength(320);  // 320B per 20ms == 128kbps
  PodZero(frameData->Elements(), frameData->Length());
+3 −3
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ static const uint32_t OGG_SEEK_FUZZ_USECS = 500000;

// The number of microseconds of "pre-roll" we use for Opus streams.
// The specification recommends 80 ms.
static const int64_t OGG_SEEK_OPUS_PREROLL = 80 * USECS_PER_MS;
static const TimeUnit OGG_SEEK_OPUS_PREROLL = TimeUnit::FromMicroseconds(80000);

static Atomic<uint32_t> sStreamSourceID(0u);

@@ -1095,7 +1095,7 @@ nsresult OggDemuxer::SeekInternal(TrackInfo::TrackType aType,
  int64_t startTime = StartTime(aType);
  int64_t endTime = mInfo.mMetadataDuration->ToMicroseconds() + startTime;
  if (aType == TrackInfo::kAudioTrack && mOpusState) {
    adjustedTarget = std::max(startTime, target - OGG_SEEK_OPUS_PREROLL);
    adjustedTarget = std::max(startTime, target - OGG_SEEK_OPUS_PREROLL.ToMicroseconds());
  }

  if (!HaveStartTime(aType) || adjustedTarget == startTime) {
@@ -1869,7 +1869,7 @@ nsresult OggDemuxer::SeekInUnbuffered(TrackInfo::TrackType aType,
  }
  // Add in the Opus pre-roll if necessary, as well.
  if (aType == TrackInfo::kAudioTrack && mOpusState) {
    keyframeOffsetMs = std::max(keyframeOffsetMs, OGG_SEEK_OPUS_PREROLL);
    keyframeOffsetMs = std::max(keyframeOffsetMs, OGG_SEEK_OPUS_PREROLL.ToMilliseconds());
  }
  int64_t seekTarget = std::max(aStartTime, aTarget - keyframeOffsetMs);
  // Minimize the bisection search space using the known timestamps from the
+1 −1
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ nsAVIFDecoder::DecodeResult AVIFParser::GetImage(AVIFImage& aImage) {

    aImage.mFrameNum = mFrameNum++;
    int64_t durationMs =
        aImage.mColorImage->mDuration.ToMicroseconds() / USECS_PER_MS;
        aImage.mColorImage->mDuration.ToMilliseconds();
    aImage.mDuration = FrameTimeout::FromRawMilliseconds(
        static_cast<int32_t>(std::min<int64_t>(durationMs, INT32_MAX)));