From 950d6f18cae70e8fc3e1561e1faf26a5c7c5e54e Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Wed, 14 Oct 2020 09:32:49 +0000 Subject: [PATCH] Bug 1670560 - Don't use the same thread pool for both decoding and waiting for the decode to complete. r=mattwoodrow Unlikely to happen, but we could have exhausted all our thread in the decoder thread pool and be deadlock. Differential Revision: https://phabricator.services.mozilla.com/D93202 --- .../webrtc/libwebrtcglue/WebrtcMediaDataDecoderCodec.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dom/media/webrtc/libwebrtcglue/WebrtcMediaDataDecoderCodec.cpp b/dom/media/webrtc/libwebrtcglue/WebrtcMediaDataDecoderCodec.cpp index aa742b3d973e3..d425ffd3b3665 100644 --- a/dom/media/webrtc/libwebrtcglue/WebrtcMediaDataDecoderCodec.cpp +++ b/dom/media/webrtc/libwebrtcglue/WebrtcMediaDataDecoderCodec.cpp @@ -16,7 +16,7 @@ namespace mozilla { WebrtcMediaDataDecoder::WebrtcMediaDataDecoder() - : mThreadPool(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER)), + : mThreadPool(GetMediaThreadPool(MediaThreadType::CONTROLLER)), mTaskQueue(new TaskQueue(do_AddRef(mThreadPool), "WebrtcMediaDataDecoder::mTaskQueue")), mImageContainer(layers::LayerManager::CreateImageContainer( @@ -170,8 +170,11 @@ int32_t WebrtcMediaDataDecoder::CreateDecoder() { // We need to wrap our decoder in a MediaDataDecoderProxy so that it always // run on an nsISerialEventTarget (which the webrtc code doesn't do) - mDecoder = - new MediaDataDecoderProxy(decoder.forget(), do_AddRef(mTaskQueue.get())); + mDecoder = new MediaDataDecoderProxy( + decoder.forget(), + MakeAndAddRef( + GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER), + "webrtc decode TaskQueue")); media::Await( do_AddRef(mThreadPool), mDecoder->Init(),