Skip to content

Commit

Permalink
Bug 1670560 - Don't use the same thread pool for both decoding and wa…
Browse files Browse the repository at this point in the history
…iting 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
  • Loading branch information
Jean-Yves Avenard committed Oct 14, 2020
1 parent 5a9ad19 commit 950d6f1
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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<TaskQueue>(
GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER),
"webrtc decode TaskQueue"));

media::Await(
do_AddRef(mThreadPool), mDecoder->Init(),
Expand Down

0 comments on commit 950d6f1

Please sign in to comment.