зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1554075 - Move MediaDecoderStateMachine to its own thread pool. r=jya
The MDSM currently uses the "MediaPlayback" thread pool. This is the same thread pool used by the demuxers. If all the threads in the pool are in use demuxing, we can end up not being able to run the A/V sync logic in the MDSM's VideoSink. This means we end up not presenting frames we could have potentially presented. So move the MDSM's TaskQueue to its own SharedThreadPool of size 1. This should allow the state transition tasks to run more independently from the demuxing tasks. Differential Revision: https://phabricator.services.mozilla.com/D33869 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
56773e45c8
Коммит
f428ea02a7
|
@ -2615,7 +2615,7 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder,
|
|||
mAbstractMainThread(aDecoder->AbstractMainThread()),
|
||||
mFrameStats(&aDecoder->GetFrameStatistics()),
|
||||
mVideoFrameContainer(aDecoder->GetVideoFrameContainer()),
|
||||
mTaskQueue(new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK),
|
||||
mTaskQueue(new TaskQueue(GetMediaThreadPool(MediaThreadType::MDSM),
|
||||
"MDSM::mTaskQueue",
|
||||
/* aSupportsTailDispatch = */ true)),
|
||||
mWatchManager(this, mTaskQueue),
|
||||
|
|
|
@ -206,6 +206,7 @@ bool IsValidVideoRegion(const gfx::IntSize& aFrame,
|
|||
|
||||
already_AddRefed<SharedThreadPool> GetMediaThreadPool(MediaThreadType aType) {
|
||||
const char* name;
|
||||
uint32_t threads = 4;
|
||||
switch (aType) {
|
||||
case MediaThreadType::PLATFORM_DECODER:
|
||||
name = "MediaPDecoder";
|
||||
|
@ -216,6 +217,10 @@ already_AddRefed<SharedThreadPool> GetMediaThreadPool(MediaThreadType aType) {
|
|||
case MediaThreadType::WEBRTC_DECODER:
|
||||
name = "WebRTCPD";
|
||||
break;
|
||||
case MediaThreadType::MDSM:
|
||||
name = "MediaDecoderStateMachine";
|
||||
threads = 1;
|
||||
break;
|
||||
default:
|
||||
MOZ_FALLTHROUGH_ASSERT("Unexpected MediaThreadType");
|
||||
case MediaThreadType::PLAYBACK:
|
||||
|
@ -223,9 +228,8 @@ already_AddRefed<SharedThreadPool> GetMediaThreadPool(MediaThreadType aType) {
|
|||
break;
|
||||
}
|
||||
|
||||
static const uint32_t kMediaThreadPoolDefaultCount = 4;
|
||||
RefPtr<SharedThreadPool> pool = SharedThreadPool::Get(
|
||||
nsDependentCString(name), kMediaThreadPoolDefaultCount);
|
||||
RefPtr<SharedThreadPool> pool =
|
||||
SharedThreadPool::Get(nsDependentCString(name), threads);
|
||||
|
||||
// Ensure a larger stack for platform decoder threads
|
||||
if (aType == MediaThreadType::PLATFORM_DECODER) {
|
||||
|
|
|
@ -184,7 +184,8 @@ enum class MediaThreadType {
|
|||
PLAYBACK, // MediaDecoderStateMachine and MediaFormatReader
|
||||
PLATFORM_DECODER, // MediaDataDecoder
|
||||
MSG_CONTROL,
|
||||
WEBRTC_DECODER
|
||||
WEBRTC_DECODER,
|
||||
MDSM,
|
||||
};
|
||||
// Returns the thread pool that is shared amongst all decoder state machines
|
||||
// for decoding streams.
|
||||
|
|
Загрузка…
Ссылка в новой задаче