diff options
Diffstat (limited to 'www/waterfox/files/patch-bug1423086')
-rw-r--r-- | www/waterfox/files/patch-bug1423086 | 222 |
1 files changed, 0 insertions, 222 deletions
diff --git a/www/waterfox/files/patch-bug1423086 b/www/waterfox/files/patch-bug1423086 deleted file mode 100644 index 123fb66344b6..000000000000 --- a/www/waterfox/files/patch-bug1423086 +++ /dev/null @@ -1,222 +0,0 @@ -commit 96370abe22e4 -Author: Byron Campen [:bwc] <docfaraday@gmail.com> -Date: Mon Dec 18 12:36:23 2017 -0600 - - Bug 1423086: (beta backport) Use nsITimerCallback for DTMF timers. r=drno a=ritu - - MozReview-Commit-ID: 2IlDknNhlAG - - --HG-- - extra : rebase_source : 344b2b1b10084099a37fb793fc25b71144a4428c ---- - .../src/peerconnection/PeerConnectionImpl.cpp | 72 +++++++++++----------- - .../src/peerconnection/PeerConnectionImpl.h | 28 +++++---- - 2 files changed, 51 insertions(+), 49 deletions(-) - -diff --git media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp -index 68949feb7254..edb07486b45a 100644 ---- media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp -+++ media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp -@@ -2521,8 +2521,8 @@ PeerConnectionImpl::RemoveTrack(MediaStreamTrack& aTrack) { - nsString wideTrackId; - aTrack.GetId(wideTrackId); - for (size_t i = 0; i < mDTMFStates.Length(); ++i) { -- if (mDTMFStates[i].mTrackId == wideTrackId) { -- mDTMFStates[i].mSendTimer->Cancel(); -+ if (mDTMFStates[i]->mTrackId == wideTrackId) { -+ mDTMFStates[i]->mSendTimer->Cancel(); - mDTMFStates.RemoveElementAt(i); - break; - } -@@ -2593,17 +2593,17 @@ PeerConnectionImpl::InsertDTMF(mozilla::dom::RTCRtpSender& sender, - mst->GetId(senderTrackId); - - // Attempt to locate state for the DTMFSender -- DTMFState* state = nullptr; -+ RefPtr<DTMFState> state; - for (auto& dtmfState : mDTMFStates) { -- if (dtmfState.mTrackId == senderTrackId) { -- state = &dtmfState; -+ if (dtmfState->mTrackId == senderTrackId) { -+ state = dtmfState; - break; - } - } - - // No state yet, create a new one - if (!state) { -- state = mDTMFStates.AppendElement(); -+ state = *mDTMFStates.AppendElement(new DTMFState); - state->mPeerConnectionImpl = this; - state->mTrackId = senderTrackId; - state->mSendTimer = NS_NewTimer(); -@@ -2627,9 +2627,7 @@ PeerConnectionImpl::InsertDTMF(mozilla::dom::RTCRtpSender& sender, - state->mDuration = duration; - state->mInterToneGap = interToneGap; - if (!state->mTones.IsEmpty()) { -- state->mSendTimer->InitWithNamedFuncCallback(DTMFSendTimerCallback_m, state, 0, -- nsITimer::TYPE_ONE_SHOT, -- "DTMFSendTimerCallback_m"); -+ state->mSendTimer->InitWithCallback(state, 0, nsITimer::TYPE_ONE_SHOT); - } - return NS_OK; - } -@@ -2653,8 +2651,8 @@ PeerConnectionImpl::GetDTMFToneBuffer(mozilla::dom::RTCRtpSender& sender, - - // Attempt to locate state for the DTMFSender - for (auto& dtmfState : mDTMFStates) { -- if (dtmfState.mTrackId == senderTrackId) { -- outToneBuffer = dtmfState.mTones; -+ if (dtmfState->mTrackId == senderTrackId) { -+ outToneBuffer = dtmfState->mTones; - break; - } - } -@@ -2671,8 +2669,8 @@ PeerConnectionImpl::ReplaceTrack(MediaStreamTrack& aThisTrack, - aThisTrack.GetId(trackId); - - for (size_t i = 0; i < mDTMFStates.Length(); ++i) { -- if (mDTMFStates[i].mTrackId == trackId) { -- mDTMFStates[i].mSendTimer->Cancel(); -+ if (mDTMFStates[i]->mTrackId == trackId) { -+ mDTMFStates[i]->mSendTimer->Cancel(); - mDTMFStates.RemoveElementAt(i); - break; - } -@@ -3117,7 +3115,7 @@ PeerConnectionImpl::CloseInt() - PC_AUTO_ENTER_API_CALL_NO_CHECK(); - - for (auto& dtmfState : mDTMFStates) { -- dtmfState.mSendTimer->Cancel(); -+ dtmfState->mSendTimer->Cancel(); - } - - // We do this at the end of the call because we want to make sure we've waited -@@ -4201,63 +4199,63 @@ PeerConnectionImpl::GetRemoteStreams(nsTArray<RefPtr<DOMMediaStream > >& result) - return NS_OK; - } - --void --PeerConnectionImpl::DTMFSendTimerCallback_m(nsITimer* timer, void* closure) -+nsresult -+PeerConnectionImpl::DTMFState::Notify(nsITimer* timer) - { - MOZ_ASSERT(NS_IsMainThread()); - -- auto state = static_cast<DTMFState*>(closure); -- - nsString eventTone; -- if (!state->mTones.IsEmpty()) { -- uint16_t toneChar = state->mTones.CharAt(0); -+ if (!mTones.IsEmpty()) { -+ uint16_t toneChar = mTones.CharAt(0); - int tone = GetDTMFToneCode(toneChar); - - eventTone.Assign(toneChar); - -- state->mTones.Cut(0, 1); -+ mTones.Cut(0, 1); - - if (tone == -1) { -- state->mSendTimer->InitWithNamedFuncCallback(DTMFSendTimerCallback_m, state, -- 2000, nsITimer::TYPE_ONE_SHOT, -- "DTMFSendTimerCallback_m"); -+ mSendTimer->InitWithCallback(this, 2000, nsITimer::TYPE_ONE_SHOT); - } else { - // Reset delay if necessary -- state->mSendTimer->InitWithNamedFuncCallback(DTMFSendTimerCallback_m, state, -- state->mDuration + state->mInterToneGap, -- nsITimer::TYPE_ONE_SHOT, -- "DTMFSendTimerCallback_m"); -+ mSendTimer->InitWithCallback(this, -+ mDuration + mInterToneGap, -+ nsITimer::TYPE_ONE_SHOT); - - RefPtr<AudioSessionConduit> conduit = -- state->mPeerConnectionImpl->mMedia->GetAudioConduit(state->mLevel); -+ mPeerConnectionImpl->mMedia->GetAudioConduit(mLevel); - - if (conduit) { -- uint32_t duration = state->mDuration; -- state->mPeerConnectionImpl->mSTSThread->Dispatch(WrapRunnableNM([conduit, tone, duration] () { -+ uint32_t duration = mDuration; -+ mPeerConnectionImpl->mSTSThread->Dispatch(WrapRunnableNM([conduit, tone, duration] () { - //Note: We default to channel 0, not inband, and 6dB attenuation. - // here. We might want to revisit these choices in the future. - conduit->InsertDTMFTone(0, tone, true, duration, 6); - }), NS_DISPATCH_NORMAL); - } -- - } - } else { -- state->mSendTimer->Cancel(); -+ mSendTimer->Cancel(); - } - -- RefPtr<PeerConnectionObserver> pco = do_QueryObjectReferent(state->mPeerConnectionImpl->mPCObserver); -+ RefPtr<PeerConnectionObserver> pco = do_QueryObjectReferent(mPeerConnectionImpl->mPCObserver); - if (!pco) { - NS_WARNING("Failed to dispatch the RTCDTMFToneChange event!"); -- return; -+ return NS_OK; // Return is ignored anyhow - } - - JSErrorResult jrv; -- pco->OnDTMFToneChange(state->mTrackId, eventTone, jrv); -+ pco->OnDTMFToneChange(mTrackId, eventTone, jrv); - - if (jrv.Failed()) { - NS_WARNING("Failed to dispatch the RTCDTMFToneChange event!"); -- return; - } -+ -+ return NS_OK; - } - -+PeerConnectionImpl::DTMFState::DTMFState() = default; -+PeerConnectionImpl::DTMFState::~DTMFState() = default; -+ -+NS_IMPL_ISUPPORTS(PeerConnectionImpl::DTMFState, nsITimerCallback) -+ - } // end mozilla namespace -diff --git media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h -index 3090a25bf57e..5213931161fc 100644 ---- media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h -+++ media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h -@@ -829,20 +829,24 @@ private: - uint16_t mMaxSending[SdpMediaSection::kMediaTypes]; - - // DTMF -- struct DTMFState { -- PeerConnectionImpl* mPeerConnectionImpl; -- nsCOMPtr<nsITimer> mSendTimer; -- nsString mTrackId; -- nsString mTones; -- size_t mLevel; -- uint32_t mDuration; -- uint32_t mInterToneGap; -+ class DTMFState : public nsITimerCallback { -+ virtual ~DTMFState(); -+ public: -+ DTMFState(); -+ -+ NS_DECL_NSITIMERCALLBACK -+ NS_DECL_THREADSAFE_ISUPPORTS -+ -+ PeerConnectionImpl* mPeerConnectionImpl; -+ nsCOMPtr<nsITimer> mSendTimer; -+ nsString mTrackId; -+ nsString mTones; -+ size_t mLevel; -+ uint32_t mDuration; -+ uint32_t mInterToneGap; - }; - -- static void -- DTMFSendTimerCallback_m(nsITimer* timer, void*); -- -- nsTArray<DTMFState> mDTMFStates; -+ nsTArray<RefPtr<DTMFState>> mDTMFStates; - - std::vector<unsigned> mSendPacketDumpFlags; - std::vector<unsigned> mRecvPacketDumpFlags; |