Index: www/firefox/Makefile =================================================================== --- www/firefox/Makefile +++ www/firefox/Makefile @@ -3,7 +3,7 @@ PORTNAME= firefox DISTVERSION= 80.0.1 -PORTEPOCH= 1 +PORTEPOCH= 2 CATEGORIES= www MASTER_SITES= MOZILLA/${PORTNAME}/releases/${DISTVERSION}/source \ MOZILLA/${PORTNAME}/candidates/${DISTVERSION}-candidates/build1/source Index: www/firefox/files/patch-dom_media_AudioStream.cpp =================================================================== --- /dev/null +++ www/firefox/files/patch-dom_media_AudioStream.cpp @@ -0,0 +1,55 @@ +--- dom/media/AudioStream.cpp.orig 2020-09-02 19:01:19.287101000 +0800 ++++ dom/media/AudioStream.cpp 2020-09-02 23:05:54.175619000 +0800 +@@ -582,8 +582,7 @@ void AudioStream::GetTimeStretched(AudioBufferWriter& + bool AudioStream::CheckThreadIdChanged() { + #ifdef MOZ_GECKO_PROFILER + auto id = profiler_current_thread_id(); +- if (id != mAudioThreadId) { +- mAudioThreadId = id; ++ if (id != mAudioThreadId.exchange(id, std::memory_order_acquire)) { + return true; + } + #endif +@@ -591,7 +590,8 @@ bool AudioStream::CheckThreadIdChanged() { + } + + long AudioStream::DataCallback(void* aBuffer, long aFrames) { +- if (!mSandboxed && CheckThreadIdChanged()) { ++ bool threadIdChanged = false; ++ if (!mSandboxed && (threadIdChanged = CheckThreadIdChanged())) { + CubebUtils::GetAudioThreadRegistry()->Register(mAudioThreadId); + } + WebCore::DenormalDisabler disabler; +@@ -649,9 +649,12 @@ long AudioStream::DataCallback(void* aBuffer, long aFr + mDumpFile.Write(static_cast(aBuffer), + aFrames * mOutChannels); + +- if (!mSandboxed && writer.Available() != 0) { ++#ifdef MOZ_GECKO_PROFILER ++ if (!mSandboxed && writer.Available() != 0 && !threadIdChanged) { + CubebUtils::GetAudioThreadRegistry()->Unregister(mAudioThreadId); ++ mAudioThreadId.store(0, std::memory_order_release); + } ++#endif + return aFrames - writer.Available(); + } + +@@ -667,6 +670,18 @@ void AudioStream::StateCallback(cubeb_state aState) { + mState = ERRORED; + mDataSource.Errored(); + } ++ ++#ifdef MOZ_GECKO_PROFILER ++ if (!mSandboxed && aState != CUBEB_STATE_STARTED) { ++ // If DataCallback and this Callback stay on the same thread, in case the ++ // stream stopped for whatever reason, unregister the audio thread from ++ // audio thread registry. ++ int threadId = profiler_current_thread_id(); ++ if (mAudioThreadId.compare_exchange_strong(threadId, 0)) { ++ CubebUtils::GetAudioThreadRegistry()->Unregister(threadId); ++ } ++ } ++#endif + } + + AudioClock::AudioClock()