mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 06:09:19 +00:00
Bug 1817997 - Adjust code to take advantage of the new TimeUnit API. r=alwu
Differential Revision: https://phabricator.services.mozilla.com/D171256
This commit is contained in:
parent
d76a86c8c9
commit
0aeade5787
@ -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());
|
||||
|
@ -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
|
||||
|
@ -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)));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user