Read MediaPlayerPrivateMediaStreamAVFObjC::m_canEnqueueDisplayLayer after the lock. As spotted by Eric, there might be an edge case where m_canEnqueueDisplayLayer check would be bypassed: - enqueueVideoSample is called in a background thread, checks m_canEnqueueDisplayLayer which is true and pauses just after the check. - destroyLayers is called, which sets m_canEnqueueDisplayLayer to false. - ensureLayers recreates the display layer which is then not yet initialized - enqueueVideoSample continues and will try to enqueue the sample while m_canEnqueueDisplayLayer is false.
Created attachment 400915 [details] Patch
Committed r262532: <https://trac.webkit.org/changeset/262532> All reviewed patches have been landed. Closing bug and clearing flags on attachment 400915 [details].
<rdar://problem/63975063>