Bug 1415556 - P9. Assert on proper access of mStreams member. r?padenot. draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 10 Nov 2017 18:56:29 +0100
changeset 696756 52460ed79c78de18600297eca859c5450614bf94
parent 696755 c8ad9f3f59ebe067cba6d97dbdb4b735fe0d12d8
child 696757 b2a3b8bc3fa346a03d2d2acdefe4a98583d0478b
push id88781
push userbmo:jyavenard@mozilla.com
push dateSat, 11 Nov 2017 09:23:59 +0000
reviewerspadenot
bugs1415556, 1408276
milestone58.0a1
Bug 1415556 - P9. Assert on proper access of mStreams member. r?padenot. mStreams should only ever be accessed on the MSG thread. However, under some shutdown circumstances, it can be accessed on the main thread while the MSG thread is still alive. This will be corrected in bug 1408276. MozReview-Commit-ID: 6xWzxxV1Dv3
dom/media/MediaStreamGraphImpl.h
--- a/dom/media/MediaStreamGraphImpl.h
+++ b/dom/media/MediaStreamGraphImpl.h
@@ -391,16 +391,19 @@ public:
    * Compute how much stream data we would like to buffer for aStream.
    */
   StreamTime GetDesiredBufferEnd(MediaStream* aStream);
   /**
    * Returns true when there are no active streams.
    */
   bool IsEmpty() const
   {
+    MOZ_ASSERT(OnGraphThreadOrNotRunning() ||
+               (NS_IsMainThread() &&
+                LifecycleStateRef() >= LIFECYCLE_WAITING_FOR_MAIN_THREAD_CLEANUP));
     return mStreams.IsEmpty() && mSuspendedStreams.IsEmpty() && mPortCount == 0;
   }
 
   /**
    * Add aStream to the graph and initializes its graph-specific state.
    */
   void AddStreamGraphThread(MediaStream* aStream);
   /**