Bug 1531828 - Part 1: Check that transceiver is sending before doing tone stuff. r=mjf
authorByron Campen [:bwc] <docfaraday@gmail.com>
Tue, 23 Apr 2019 15:20:53 +0000
changeset 530757 8f1305cd6725f69fe9e570103af1f75bfed16e46
parent 530756 c4d705b02c8e242089478ce8f348e25bbc381daf
child 530758 94a8d41c171d0523eff5bdb26b3913992240c98b
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmjf
bugs1531828
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1531828 - Part 1: Check that transceiver is sending before doing tone stuff. r=mjf Depends on D28402 Differential Revision: https://phabricator.services.mozilla.com/D28403
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
media/webrtc/signaling/src/peerconnection/TransceiverImpl.h
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -2931,16 +2931,20 @@ void PeerConnectionImpl::startCallTelem(
 
   // Increment session call counter
   // If we want to track Loop calls independently here, we need two histograms.
   Telemetry::Accumulate(Telemetry::WEBRTC_CALL_COUNT_2, 1);
 }
 
 nsresult PeerConnectionImpl::DTMFState::Notify(nsITimer* timer) {
   MOZ_ASSERT(NS_IsMainThread());
+  if (!mTransceiver->IsSending()) {
+    mSendTimer->Cancel();
+    return NS_OK;
+  }
 
   nsString eventTone;
   if (!mTones.IsEmpty()) {
     uint16_t toneChar = mTones.CharAt(0);
     int tone = GetDTMFToneCode(toneChar);
 
     eventTone.Assign(toneChar);
 
--- a/media/webrtc/signaling/src/peerconnection/TransceiverImpl.h
+++ b/media/webrtc/signaling/src/peerconnection/TransceiverImpl.h
@@ -108,16 +108,21 @@ class TransceiverImpl : public nsISuppor
   }
 
   void AddRIDExtension(unsigned short aExtensionId);
 
   void AddRIDFilter(const nsAString& aRid);
 
   bool IsVideo() const;
 
+  bool IsSending() const {
+    return !mJsepTransceiver->IsStopped() &&
+           mJsepTransceiver->mSendTrack.GetActive();
+  }
+
   void GetRtpSources(const int64_t aTimeNow,
                      nsTArray<dom::RTCRtpSourceEntry>& outSources) const;
 
   // test-only: insert fake CSRCs and audio levels for testing
   void InsertAudioLevelForContributingSource(uint32_t aSource,
                                              int64_t aTimestamp, bool aHasLevel,
                                              uint8_t aLevel);