Bug 1261900: [webm] P9. Prevent null deref when webm logs are turned on. r?kinetik
MozReview-Commit-ID: EHmYC8hPoIR
--- a/dom/media/webm/WebMDemuxer.cpp
+++ b/dom/media/webm/WebMDemuxer.cpp
@@ -1040,30 +1040,32 @@ WebMTrackDemuxer::GetNextRandomAccessPoi
}
RefPtr<WebMTrackDemuxer::SkipAccessPointPromise>
WebMTrackDemuxer::SkipToNextRandomAccessPoint(media::TimeUnit aTimeThreshold)
{
uint32_t parsed = 0;
bool found = false;
RefPtr<MediaRawData> sample;
+ int64_t sampleTime;
WEBM_DEBUG("TimeThreshold: %f", aTimeThreshold.ToSeconds());
while (!found && (sample = NextSample())) {
parsed++;
- if (sample->mKeyframe && sample->mTime >= aTimeThreshold.ToMicroseconds()) {
+ sampleTime = sample->mTime;
+ if (sample->mKeyframe && sampleTime >= aTimeThreshold.ToMicroseconds()) {
found = true;
mSamples.Reset();
mSamples.PushFront(sample.forget());
}
}
SetNextKeyFrameTime();
if (found) {
WEBM_DEBUG("next sample: %f (parsed: %d)",
- media::TimeUnit::FromMicroseconds(sample->mTime).ToSeconds(),
+ media::TimeUnit::FromMicroseconds(sampleTime).ToSeconds(),
parsed);
return SkipAccessPointPromise::CreateAndResolve(parsed, __func__);
} else {
SkipFailureHolder failure(DemuxerFailureReason::END_OF_STREAM, parsed);
return SkipAccessPointPromise::CreateAndReject(Move(failure), __func__);
}
}