Bug 1568372 - add mutex in RemoteDecoderModule::LaunchRDDProcessIfNeeded. r=jya

This stops a potential race when multiple media playback threads attempt to
launch the RDD process and setup the IPC connections between
RemoteDecoderManager{Child|Parent} at the same time.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Michael Froman 2019-07-24 07:02:07 +00:00
Родитель cd7a74b452
Коммит de0172246c
2 изменённых файлов: 7 добавлений и 0 удалений

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

@ -29,6 +29,8 @@ using dom::ContentChild;
using namespace ipc;
using namespace layers;
StaticMutex RemoteDecoderModule::sLaunchMonitor;
RemoteDecoderModule::RemoteDecoderModule()
: mManagerThread(RemoteDecoderManagerChild::GetManagerThread()) {}
@ -62,6 +64,8 @@ void RemoteDecoderModule::LaunchRDDProcessIfNeeded() {
return;
}
StaticMutexAutoLock mon(sLaunchMonitor);
// We have a couple possible states here. We are in a content process
// and:
// 1) the RDD process has never been launched. RDD should be launched

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

@ -7,6 +7,8 @@
#define include_dom_media_ipc_RemoteDecoderModule_h
#include "PlatformDecoderModule.h"
#include "mozilla/StaticMutex.h"
namespace mozilla {
// A PDM implementation that creates a RemoteMediaDataDecoder (a
@ -31,6 +33,7 @@ class RemoteDecoderModule : public PlatformDecoderModule {
private:
RefPtr<nsIThread> mManagerThread;
static StaticMutex sLaunchMonitor;
};
} // namespace mozilla