зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1159974 - Dispatch SetAudioCaptured. r=jww
While we're at it, I figured it was time to experiment with lambdas. :-)
This commit is contained in:
Родитель
d4519a33a2
Коммит
598c3289ab
|
@ -535,7 +535,7 @@ void MediaDecoder::AddOutputStream(ProcessedMediaStream* aStream,
|
|||
{
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
if (mDecoderStateMachine) {
|
||||
mDecoderStateMachine->SetAudioCaptured();
|
||||
mDecoderStateMachine->DispatchAudioCaptured();
|
||||
}
|
||||
if (!GetDecodedStream()) {
|
||||
int64_t t = mDecoderStateMachine ?
|
||||
|
@ -748,7 +748,7 @@ void MediaDecoder::SetStateMachineParameters()
|
|||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
mDecoderStateMachine->SetDuration(mDuration);
|
||||
if (GetDecodedStream()) {
|
||||
mDecoderStateMachine->SetAudioCaptured();
|
||||
mDecoderStateMachine->DispatchAudioCaptured();
|
||||
}
|
||||
if (mMinimizePreroll) {
|
||||
mDecoderStateMachine->SetMinimizePrerollUntilPlaybackStarts();
|
||||
|
|
|
@ -1372,17 +1372,6 @@ void MediaDecoderStateMachine::VolumeChanged()
|
|||
}
|
||||
}
|
||||
|
||||
void MediaDecoderStateMachine::SetAudioCaptured()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
AssertCurrentThreadInMonitor();
|
||||
if (!mAudioCaptured) {
|
||||
mAudioCaptured = true;
|
||||
// Schedule the state machine to send stream data as soon as possible.
|
||||
ScheduleStateMachine();
|
||||
}
|
||||
}
|
||||
|
||||
double MediaDecoderStateMachine::GetCurrentTime() const
|
||||
{
|
||||
return static_cast<double>(mCurrentFrameTime) / static_cast<double>(USECS_PER_S);
|
||||
|
|
|
@ -152,7 +152,20 @@ public:
|
|||
return mState;
|
||||
}
|
||||
|
||||
void SetAudioCaptured();
|
||||
void DispatchAudioCaptured()
|
||||
{
|
||||
nsRefPtr<MediaDecoderStateMachine> self = this;
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([self] () -> void
|
||||
{
|
||||
MOZ_ASSERT(self->OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(self->mDecoder->GetReentrantMonitor());
|
||||
if (!self->mAudioCaptured) {
|
||||
self->mAudioCaptured = true;
|
||||
self->ScheduleStateMachine();
|
||||
}
|
||||
});
|
||||
TaskQueue()->Dispatch(r.forget());
|
||||
}
|
||||
|
||||
// Check if the decoder needs to become dormant state.
|
||||
bool IsDormantNeeded();
|
||||
|
|
Загрузка…
Ссылка в новой задаче