Bug 1197673 - Use float type for SetAudioOutputVolume. r=eitan
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Tue, 01 Sep 2015 17:51:07 +0900
changeset 260226 fdd0c566464b141f905876e97874e952981798e1
parent 260225 c92a7a24d7572e537ba84e9178aab6bef3612b0a
child 260227 4cd9f5b5462fa6ff5eca99eacbd2bb23c66321a9
push id64448
push userm_kato@ga2.so-net.ne.jp
push dateTue, 01 Sep 2015 08:52:43 +0000
treeherdermozilla-inbound@fdd0c566464b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerseitan
bugs1197673
milestone43.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 1197673 - Use float type for SetAudioOutputVolume. r=eitan
dom/media/webspeech/synth/ipc/PSpeechSynthesisRequest.ipdl
dom/media/webspeech/synth/ipc/SpeechSynthesisChild.cpp
dom/media/webspeech/synth/ipc/SpeechSynthesisChild.h
dom/media/webspeech/synth/ipc/SpeechSynthesisParent.cpp
dom/media/webspeech/synth/ipc/SpeechSynthesisParent.h
dom/media/webspeech/synth/nsSpeechTask.cpp
dom/media/webspeech/synth/nsSpeechTask.h
--- a/dom/media/webspeech/synth/ipc/PSpeechSynthesisRequest.ipdl
+++ b/dom/media/webspeech/synth/ipc/PSpeechSynthesisRequest.ipdl
@@ -18,17 +18,17 @@ async protocol PSpeechSynthesisRequest
   Pause();
 
   Resume();
 
   Cancel();
 
   ForceEnd();
 
-  SetAudioOutputVolume(uint32_t aVolume);
+  SetAudioOutputVolume(float aVolume);
 
  child:
 
   __delete__(bool aIsError, float aElapsedTime, uint32_t aCharIndex);
 
   OnStart(nsString aUri);
 
   OnPause(float aElapsedTime, uint32_t aCharIndex);
--- a/dom/media/webspeech/synth/ipc/SpeechSynthesisChild.cpp
+++ b/dom/media/webspeech/synth/ipc/SpeechSynthesisChild.cpp
@@ -187,17 +187,17 @@ SpeechTaskChild::Cancel()
 void
 SpeechTaskChild::ForceEnd()
 {
   MOZ_ASSERT(mActor);
   mActor->SendForceEnd();
 }
 
 void
-SpeechTaskChild::SetAudioOutputVolume(uint32_t aVolume)
+SpeechTaskChild::SetAudioOutputVolume(float aVolume)
 {
   if (mActor) {
     mActor->SendSetAudioOutputVolume(aVolume);
   }
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/media/webspeech/synth/ipc/SpeechSynthesisChild.h
+++ b/dom/media/webspeech/synth/ipc/SpeechSynthesisChild.h
@@ -87,17 +87,17 @@ public:
   virtual void Pause() override;
 
   virtual void Resume() override;
 
   virtual void Cancel() override;
 
   virtual void ForceEnd() override;
 
-  virtual void SetAudioOutputVolume(uint32_t aVolume) override;
+  virtual void SetAudioOutputVolume(float aVolume) override;
 
 private:
   SpeechSynthesisRequestChild* mActor;
 };
 
 } // namespace dom
 } // namespace mozilla
 
--- a/dom/media/webspeech/synth/ipc/SpeechSynthesisParent.cpp
+++ b/dom/media/webspeech/synth/ipc/SpeechSynthesisParent.cpp
@@ -123,17 +123,17 @@ bool
 SpeechSynthesisRequestParent::RecvForceEnd()
 {
   MOZ_ASSERT(mTask);
   mTask->ForceEnd();
   return true;
 }
 
 bool
-SpeechSynthesisRequestParent::RecvSetAudioOutputVolume(const uint32_t& aVolume)
+SpeechSynthesisRequestParent::RecvSetAudioOutputVolume(const float& aVolume)
 {
   MOZ_ASSERT(mTask);
   mTask->SetAudioOutputVolume(aVolume);
   return true;
 }
 
 // SpeechTaskParent
 
--- a/dom/media/webspeech/synth/ipc/SpeechSynthesisParent.h
+++ b/dom/media/webspeech/synth/ipc/SpeechSynthesisParent.h
@@ -65,17 +65,17 @@ protected:
   virtual bool RecvPause() override;
 
   virtual bool RecvResume() override;
 
   virtual bool RecvCancel() override;
 
   virtual bool RecvForceEnd() override;
 
-  virtual bool RecvSetAudioOutputVolume(const uint32_t& aVolume) override;
+  virtual bool RecvSetAudioOutputVolume(const float& aVolume) override;
 };
 
 class SpeechTaskParent : public nsSpeechTask
 {
   friend class SpeechSynthesisRequestParent;
 public:
   SpeechTaskParent(float aVolume, const nsAString& aUtterance)
     : nsSpeechTask(aVolume, aUtterance) {}
--- a/dom/media/webspeech/synth/nsSpeechTask.cpp
+++ b/dom/media/webspeech/synth/nsSpeechTask.cpp
@@ -680,29 +680,29 @@ nsSpeechTask::DestroyAudioChannelAgent()
     mAudioChannelAgent->NotifyStoppedPlaying(nsIAudioChannelAgent::AUDIO_AGENT_NOTIFY);
     mAudioChannelAgent = nullptr;
   }
 }
 
 NS_IMETHODIMP
 nsSpeechTask::WindowVolumeChanged(float aVolume, bool aMuted)
 {
-  SetAudioOutputVolume(mVolume * aVolume * aMuted);
+  SetAudioOutputVolume(aMuted ? 0.0 : mVolume * aVolume);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSpeechTask::WindowAudioCaptureChanged()
 {
   // This is not supported yet.
   return NS_OK;
 }
 
 void
-nsSpeechTask::SetAudioOutputVolume(uint32_t aVolume)
+nsSpeechTask::SetAudioOutputVolume(float aVolume)
 {
   if (mStream) {
     mStream->SetAudioOutputVolume(this, aVolume);
   }
   if (mIndirectAudio) {
     mCallback->OnVolumeChanged(aVolume);
   }
 }
--- a/dom/media/webspeech/synth/nsSpeechTask.h
+++ b/dom/media/webspeech/synth/nsSpeechTask.h
@@ -47,17 +47,17 @@ public:
   uint32_t GetCurrentCharOffset();
 
   void SetSpeechSynthesis(SpeechSynthesis* aSpeechSynthesis);
 
   void Init(ProcessedMediaStream* aStream);
 
   void SetChosenVoiceURI(const nsAString& aUri);
 
-  virtual void SetAudioOutputVolume(uint32_t aVolume);
+  virtual void SetAudioOutputVolume(float aVolume);
 
   bool IsPreCanceled()
   {
     return mPreCanceled;
   };
 
   bool IsPrePaused()
   {