Bug 1388309 - let VideoDecoderChild::InitIPDL() return false if we don't want to decode video on GPU process; draft
authorKaku Kuo <kaku@mozilla.com>
Mon, 14 Aug 2017 18:03:12 +0800
changeset 649819 2b9a373c34eebdf54ad71fdd2fca42462bdc8539
parent 649622 7dddbd85047c6dc73ddbe1e423cd643a217845b3
child 727202 ff817f918f345ba3055f4ab86d2f107b395ff263
push id75165
push userbmo:kaku@mozilla.com
push dateMon, 21 Aug 2017 10:40:36 +0000
bugs1388309
milestone57.0a1
Bug 1388309 - let VideoDecoderChild::InitIPDL() return false if we don't want to decode video on GPU process; MozReview-Commit-ID: DD7xVkXT6fk
dom/media/ipc/VideoDecoderChild.cpp
--- a/dom/media/ipc/VideoDecoderChild.cpp
+++ b/dom/media/ipc/VideoDecoderChild.cpp
@@ -147,22 +147,31 @@ VideoDecoderChild::ActorDestroy(ActorDes
 }
 
 bool
 VideoDecoderChild::InitIPDL(const VideoInfo& aVideoInfo,
                             const layers::TextureFactoryIdentifier& aIdentifier)
 {
   RefPtr<VideoDecoderManagerChild> manager =
     VideoDecoderManagerChild::GetSingleton();
-  // If the manager isn't available, then don't initialize mIPDLSelfRef and
+
+  // The manager isn't available because VideoDecoderManagerChild has been
+  // initialized with null end points and we don't want to decode video on GPU
+  // process anymore. Return false here so that we can fallback to other PDMs.
+  if (!manager) {
+    return false;
+  }
+
+  // The manager doesn't support sending messages because we've just crashed
+  // and are working on reinitialization. Don't initialize mIPDLSelfRef and
   // leave us in an error state. We'll then immediately reject the promise when
   // Init() is called and the caller can try again. Hopefully by then the new
   // manager is ready, or we've notified the caller of it being no longer
   // available. If not, then the cycle repeats until we're ready.
-  if (!manager || !manager->CanSend()) {
+  if (!manager->CanSend()) {
     return true;
   }
 
   mIPDLSelfRef = this;
   bool success = false;
   if (manager->SendPVideoDecoderConstructor(this, aVideoInfo, aIdentifier,
                                             &success)) {
     mCanSend = true;