Bug 1517711 - Guard other uses of SetPullingEnabled too. r=padenot

Depends on D15892

Differential Revision: https://phabricator.services.mozilla.com/D15896

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Pehrson 2019-01-08 10:06:08 +00:00
Родитель 72327b88f5
Коммит 6f2800844c
3 изменённых файлов: 19 добавлений и 6 удалений

Просмотреть файл

@ -4193,7 +4193,8 @@ SourceListener::InitializeAsync() {
state->mTrackEnabled = true;
state->mTrackEnabledTime = TimeStamp::Now();
if (state == mVideoDeviceState.get()) {
if (state == mVideoDeviceState.get() &&
!mStream->IsDestroyed()) {
mStream->SetPullingEnabled(kVideoTrack, true);
}
}

Просмотреть файл

@ -461,6 +461,9 @@ nsresult MediaEngineDefaultAudioSource::Start(
NS_DispatchToMainThread(
NS_NewRunnableFunction(__func__, [stream = mStream, track = mTrackID]() {
if (stream->IsDestroyed()) {
return;
}
stream->SetPullingEnabled(track, true);
}));
@ -484,6 +487,9 @@ nsresult MediaEngineDefaultAudioSource::Stop(
NS_DispatchToMainThread(
NS_NewRunnableFunction(__func__, [stream = mStream, track = mTrackID]() {
if (stream->IsDestroyed()) {
return;
}
stream->SetPullingEnabled(track, false);
}));
return NS_OK;

Просмотреть файл

@ -1475,16 +1475,22 @@ class GenericReceiveListener : public MediaStreamTrackListener {
}
void AddSelf() {
if (!mListening) {
if (mListening) {
return;
}
mListening = true;
mSource->SetPullingEnabled(mTrackId, true);
mMaybeTrackNeedsUnmute = true;
if (!mSource->IsDestroyed()) {
mSource->SetPullingEnabled(mTrackId, true);
}
}
void RemoveSelf() {
if (mListening) {
if (!mListening) {
return;
}
mListening = false;
if (!mSource->IsDestroyed()) {
mSource->SetPullingEnabled(mTrackId, false);
}
}