mAudioTracks.mNumTracks is being accessed on two separate threads without being properly synchronized. `Buffered` does acquire `mMutex`, but it's not intended to guard this field in particular, so `OnDemuxerInitDone` never acquires it. So it seems it's a question of whether mNumTracks should be made atomic, or whether it should become one of the fields protected by mMutex. --------- Permalinks to problematic lines: [TrackBuffersManager::Buffered](https://searchfox.org/mozilla-central/rev/07342ce09126c513540c1c343476e026cfa907bf/dom/media/mediasource/TrackBuffersManager.cpp#385) vs [TrackBuffersManager::OnDemuxerInitDone](https://searchfox.org/mozilla-central/rev/07342ce09126c513540c1c343476e026cfa907bf/dom/media/mediasource/TrackBuffersManager.cpp#1236)
Bug 1685838 Comment 1 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
`mAudioTracks.mNumTracks` is being accessed on two separate threads without being properly synchronized. `Buffered` does acquire `mMutex`, but it's not intended to guard this field in particular, so `OnDemuxerInitDone` never acquires it. So it seems it's a question of whether mNumTracks should be made atomic, or whether it should become one of the fields protected by mMutex. --------- Permalinks to problematic lines: [TrackBuffersManager::Buffered](https://searchfox.org/mozilla-central/rev/07342ce09126c513540c1c343476e026cfa907bf/dom/media/mediasource/TrackBuffersManager.cpp#385) vs [TrackBuffersManager::OnDemuxerInitDone](https://searchfox.org/mozilla-central/rev/07342ce09126c513540c1c343476e026cfa907bf/dom/media/mediasource/TrackBuffersManager.cpp#1236)