Bug 1499426 - Align the lifetime of AudioInputProcessing with the lifetime of MediaEngineWebRTCAudio. r=achronop
☠☠ backed out by b5b1f341206d ☠ ☠
authorPaul Adenot <paul@paul.cx>
Fri, 11 Jan 2019 17:22:24 +0000
changeset 510614 0f68913927a57f85b9d575541f7c1aff77e27d00
parent 510613 3e29a26d22b2d57b215b1eddbc8cd0e597888048
child 510615 ea7ab7f59caa6b655e117775a5816625acf7060a
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersachronop
bugs1499426
milestone66.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 1499426 - Align the lifetime of AudioInputProcessing with the lifetime of MediaEngineWebRTCAudio. r=achronop Differential Revision: https://phabricator.services.mozilla.com/D16201
dom/media/webrtc/MediaEngineWebRTCAudio.cpp
--- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
+++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
@@ -515,16 +515,19 @@ void MediaEngineWebRTCMicrophoneSource::
   mTrackID = aTrackID;
   mPrincipal = aPrincipal;
 
   AudioSegment* segment = new AudioSegment();
 
   aStream->AddAudioTrack(aTrackID, aStream->GraphRate(), segment,
                          SourceMediaStream::ADDTRACK_QUEUED);
 
+  mInputProcessing = new AudioInputProcessing(mDeviceMaxChannelCount, mStream,
+                                              mTrackID, mPrincipal);
+
   LOG("Stream %p registered for microphone capture", aStream.get());
 }
 
 class StartStopMessage : public ControlMessage {
  public:
   enum StartStop { Start, Stop };
 
   StartStopMessage(AudioInputProcessing* aInputProcessing, StartStop aAction)
@@ -561,19 +564,16 @@ nsresult MediaEngineWebRTCMicrophoneSour
   CubebUtils::AudioDeviceID deviceID = mDeviceInfo->DeviceID();
   if (mStream->GraphImpl()->InputDeviceID() &&
       mStream->GraphImpl()->InputDeviceID() != deviceID) {
     // For now, we only allow opening a single audio input device per document,
     // because we can only have one MSG per document.
     return NS_ERROR_FAILURE;
   }
 
-  mInputProcessing = new AudioInputProcessing(mDeviceMaxChannelCount, mStream,
-                                              mTrackID, mPrincipal);
-
   RefPtr<MediaEngineWebRTCMicrophoneSource> that = this;
   NS_DispatchToMainThread(media::NewRunnableFrom(
       [that, deviceID, stream = mStream, track = mTrackID]() {
         if (stream->IsDestroyed()) {
           return NS_OK;
         }
 
         stream->GraphImpl()->AppendMessage(MakeUnique<StartStopMessage>(