mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
Bug 1163223 - Use AwaitStartTime to invoke MediaDecoderReader::SetStartTime. r=jww
This commit is contained in:
parent
3d04b30371
commit
b3e7a4b2a3
@ -148,6 +148,7 @@ void
|
||||
MediaDecoderReader::SetStartTime(int64_t aStartTime)
|
||||
{
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
MOZ_ASSERT(mStartTime == -1);
|
||||
mStartTime = aStartTime;
|
||||
}
|
||||
|
||||
|
@ -328,7 +328,13 @@ protected:
|
||||
// The start time of the media, in microseconds. This is the presentation
|
||||
// time of the first frame decoded from the media. This is initialized to -1,
|
||||
// and then set to a value >= by MediaDecoderStateMachine::SetStartTime(),
|
||||
// after which point it never changes.
|
||||
// after which point it never changes (though SetStartTime may be called
|
||||
// multiple times with the same value).
|
||||
//
|
||||
// This is an ugly breach of abstractions - it's currently necessary for the
|
||||
// readers to return the correct value of GetBuffered. We should refactor
|
||||
// things such that all GetBuffered calls go through the MDSM, which would
|
||||
// offset the range accordingly.
|
||||
int64_t mStartTime;
|
||||
|
||||
// This is a quick-and-dirty way for DecodeAudioData implementations to
|
||||
|
@ -2177,6 +2177,15 @@ MediaDecoderStateMachine::OnMetadataRead(MetadataHolder* aMetadata)
|
||||
if (!mStartTimeRendezvous) {
|
||||
mStartTimeRendezvous = new StartTimeRendezvous(TaskQueue(), HasAudio(), HasVideo(),
|
||||
mReader->ForceZeroStartTime() || IsRealTime());
|
||||
|
||||
mStartTimeRendezvous->AwaitStartTime()->Then(TaskQueue(), __func__,
|
||||
[self] () -> void {
|
||||
NS_ENSURE_TRUE_VOID(!self->IsShutdown());
|
||||
ReentrantMonitorAutoEnter mon(self->mDecoder->GetReentrantMonitor());
|
||||
self->mReader->SetStartTime(self->StartTime());
|
||||
},
|
||||
[] () -> void { NS_WARNING("Setting start time on reader failed"); }
|
||||
);
|
||||
}
|
||||
|
||||
if (mInfo.mMetadataDuration.isSome()) {
|
||||
@ -3176,10 +3185,6 @@ void MediaDecoderStateMachine::SetStartTime(int64_t aStartTimeUsecs)
|
||||
}
|
||||
}
|
||||
|
||||
// Pass along this immutable value to the reader so that it can make
|
||||
// calculations independently of the state machine.
|
||||
mReader->SetStartTime(mStartTime);
|
||||
|
||||
// Set the audio start time to be start of media. If this lies before the
|
||||
// first actual audio frame we have, we'll inject silence during playback
|
||||
// to ensure the audio starts at the correct time.
|
||||
|
Loading…
Reference in New Issue
Block a user