Bug 1222697 - Audio Indicator doesn't appear when using Web Speech Synthesis. r=eeejay
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Thu, 31 Mar 2016 11:09:03 +0900
changeset 291503 5027257b611edc9260756bc55659388b90d95736
parent 291502 8167849e665a754e6301a617642cf3acfcb0b64a
child 291504 4c17ed03e401275309d890ddcbb0cd4af2d13347
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerseeejay
bugs1222697
milestone48.0a1
Bug 1222697 - Audio Indicator doesn't appear when using Web Speech Synthesis. r=eeejay Create audio channel agent even if e10s. Dispatch*Inner won't be called from child process's SpeechSynthesisRequestChild, so it is created at Dispatch*Impl. MozReview-Commit-ID: 4ZQWE2gPh9g
dom/media/webspeech/synth/nsSpeechTask.cpp
--- a/dom/media/webspeech/synth/nsSpeechTask.cpp
+++ b/dom/media/webspeech/synth/nsSpeechTask.cpp
@@ -346,18 +346,16 @@ nsSpeechTask::DispatchStart()
   }
 
   return DispatchStartInner();
 }
 
 nsresult
 nsSpeechTask::DispatchStartInner()
 {
-  CreateAudioChannelAgent();
-
   nsSynthVoiceRegistry::GetInstance()->SetIsSpeaking(true);
   return DispatchStartImpl();
 }
 
 nsresult
 nsSpeechTask::DispatchStartImpl()
 {
   return DispatchStartImpl(mChosenVoiceURI);
@@ -368,16 +366,18 @@ nsSpeechTask::DispatchStartImpl(const ns
 {
   LOG(LogLevel::Debug, ("nsSpeechTask::DispatchStart"));
 
   MOZ_ASSERT(mUtterance);
   if(NS_WARN_IF(!(mUtterance->mState == SpeechSynthesisUtterance::STATE_PENDING))) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
+  CreateAudioChannelAgent();
+
   mUtterance->mState = SpeechSynthesisUtterance::STATE_SPEAKING;
   mUtterance->mChosenVoiceURI = aUri;
   mUtterance->DispatchSpeechSynthesisEvent(NS_LITERAL_STRING("start"), 0, 0,
                                            EmptyString());
 
   return NS_OK;
 }
 
@@ -390,30 +390,30 @@ nsSpeechTask::DispatchEnd(float aElapsed
   }
 
   return DispatchEndInner(aElapsedTime, aCharIndex);
 }
 
 nsresult
 nsSpeechTask::DispatchEndInner(float aElapsedTime, uint32_t aCharIndex)
 {
-  DestroyAudioChannelAgent();
-
   if (!mPreCanceled) {
     nsSynthVoiceRegistry::GetInstance()->SpeakNext();
   }
 
   return DispatchEndImpl(aElapsedTime, aCharIndex);
 }
 
 nsresult
 nsSpeechTask::DispatchEndImpl(float aElapsedTime, uint32_t aCharIndex)
 {
   LOG(LogLevel::Debug, ("nsSpeechTask::DispatchEnd\n"));
 
+  DestroyAudioChannelAgent();
+
   MOZ_ASSERT(mUtterance);
   if(NS_WARN_IF(mUtterance->mState == SpeechSynthesisUtterance::STATE_ENDED)) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   // XXX: This should not be here, but it prevents a crash in MSG.
   if (mStream) {
     mStream->Destroy();