зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1184412. Part 1 - remove dependency on MDSM::OnAudioEndTimeUpdate from DecodedStream. r=roc.
This commit is contained in:
Родитель
fa8ccba8c3
Коммит
aeeb938a34
|
@ -628,13 +628,18 @@ DecodedStream::SendData(double aVolume, bool aIsSameOrigin)
|
||||||
return finished;
|
return finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckedInt64
|
int64_t
|
||||||
DecodedStream::AudioEndTime() const
|
DecodedStream::AudioEndTime() const
|
||||||
{
|
{
|
||||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||||
MOZ_ASSERT(mStartTime.isSome(), "Must be called after StartPlayback()");
|
if (mStartTime.isSome() && mInfo.HasAudio()) {
|
||||||
return mStartTime.ref() +
|
CheckedInt64 t = mStartTime.ref() +
|
||||||
FramesToUsecs(mData->mAudioFramesWritten, mInfo.mAudio.mRate);
|
FramesToUsecs(mData->mAudioFramesWritten, mInfo.mAudio.mRate);
|
||||||
|
if (t.isValid()) {
|
||||||
|
return t.value();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t
|
int64_t
|
||||||
|
|
|
@ -111,7 +111,7 @@ public:
|
||||||
void Connect(ProcessedMediaStream* aStream, bool aFinishWhenEnded);
|
void Connect(ProcessedMediaStream* aStream, bool aFinishWhenEnded);
|
||||||
void Remove(MediaStream* aStream);
|
void Remove(MediaStream* aStream);
|
||||||
void SetPlaying(bool aPlaying);
|
void SetPlaying(bool aPlaying);
|
||||||
CheckedInt64 AudioEndTime() const;
|
int64_t AudioEndTime() const;
|
||||||
int64_t GetPosition() const;
|
int64_t GetPosition() const;
|
||||||
bool IsFinished() const;
|
bool IsFinished() const;
|
||||||
|
|
||||||
|
|
|
@ -372,13 +372,6 @@ void MediaDecoderStateMachine::SendStreamData()
|
||||||
|
|
||||||
bool finished = mDecodedStream->SendData(mVolume, mDecoder->IsSameOriginMedia());
|
bool finished = mDecodedStream->SendData(mVolume, mDecoder->IsSameOriginMedia());
|
||||||
|
|
||||||
if (mInfo.HasAudio()) {
|
|
||||||
CheckedInt64 playedUsecs = mDecodedStream->AudioEndTime();
|
|
||||||
if (playedUsecs.isValid()) {
|
|
||||||
OnAudioEndTimeUpdate(playedUsecs.value());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto clockTime = GetClock();
|
const auto clockTime = GetClock();
|
||||||
while (true) {
|
while (true) {
|
||||||
const AudioData* a = AudioQueue().PeekFront();
|
const AudioData* a = AudioQueue().PeekFront();
|
||||||
|
@ -3080,11 +3073,14 @@ MediaDecoderStateMachine::AudioEndTime() const
|
||||||
AssertCurrentThreadInMonitor();
|
AssertCurrentThreadInMonitor();
|
||||||
if (mAudioSink) {
|
if (mAudioSink) {
|
||||||
return mAudioSink->GetEndTime();
|
return mAudioSink->GetEndTime();
|
||||||
|
} else if (mAudioCaptured) {
|
||||||
|
return mDecodedStream->AudioEndTime();
|
||||||
}
|
}
|
||||||
// Don't call this after mAudioSink becomes null since we can't distinguish
|
// Don't call this after mAudioSink becomes null since we can't distinguish
|
||||||
// "before StartAudioThread" and "after StopAudioThread".
|
// "before StartAudioThread" and "after StopAudioThread" where mAudioSink
|
||||||
MOZ_ASSERT(mAudioCaptured || !mAudioCompleted);
|
// is null in both cases.
|
||||||
return mAudioEndTime;
|
MOZ_ASSERT(!mAudioCompleted);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaDecoderStateMachine::OnAudioEndTimeUpdate(int64_t aAudioEndTime)
|
void MediaDecoderStateMachine::OnAudioEndTimeUpdate(int64_t aAudioEndTime)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче