Backed out changeset 91cc337bef3b (bug 1191814) for m-e10s(3) failures in test_global_queue_pause.html

This commit is contained in:
Wes Kocher 2015-08-20 12:05:37 -07:00
Родитель 10db60555b
Коммит 5bfb9df98b
7 изменённых файлов: 21 добавлений и 108 удалений

Просмотреть файл

@ -23,8 +23,6 @@ async protocol PSpeechSynthesisRequest
ForceEnd();
SetAudioOutputVolume(uint32_t aVolume);
child:
__delete__(bool aIsError, float aElapsedTime, uint32_t aCharIndex);

Просмотреть файл

@ -191,13 +191,5 @@ SpeechTaskChild::ForceEnd()
mActor->SendForceEnd();
}
void
SpeechTaskChild::SetAudioOutputVolume(uint32_t aVolume)
{
if (mActor) {
mActor->SendSetAudioOutputVolume(aVolume);
}
}
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -92,8 +92,6 @@ public:
virtual void ForceEnd() override;
virtual void SetAudioOutputVolume(uint32_t aVolume) override;
private:
SpeechSynthesisRequestChild* mActor;
};

Просмотреть файл

@ -127,14 +127,6 @@ SpeechSynthesisRequestParent::RecvForceEnd()
return true;
}
bool
SpeechSynthesisRequestParent::RecvSetAudioOutputVolume(const uint32_t& aVolume)
{
MOZ_ASSERT(mTask);
mTask->SetAudioOutputVolume(aVolume);
return true;
}
// SpeechTaskParent
nsresult

Просмотреть файл

@ -69,8 +69,6 @@ protected:
virtual bool RecvCancel() override;
virtual bool RecvForceEnd() override;
virtual bool RecvSetAudioOutputVolume(const uint32_t& aVolume) override;
};
class SpeechTaskParent : public nsSpeechTask

Просмотреть файл

@ -4,13 +4,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "AudioChannelAgent.h"
#include "AudioChannelService.h"
#include "AudioSegment.h"
#include "mozilla/Preferences.h"
#include "nsSpeechTask.h"
#include "nsSynthVoiceRegistry.h"
#include "SpeechSynthesis.h"
#include "nsSynthVoiceRegistry.h"
// GetCurrentTime is defined in winbase.h as zero argument macro forwarding to
// GetTickCount() and conflicts with nsSpeechTask::GetCurrentTime().
@ -25,11 +22,6 @@ extern PRLogModuleInfo* GetSpeechSynthLog();
namespace mozilla {
namespace dom {
static bool UseAudioChannelService()
{
return Preferences::GetBool("media.useAudioChannelService");
}
class SynthStreamListener : public MediaStreamListener
{
public:
@ -97,7 +89,6 @@ NS_IMPL_CYCLE_COLLECTION(nsSpeechTask, mSpeechSynthesis, mUtterance, mCallback);
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSpeechTask)
NS_INTERFACE_MAP_ENTRY(nsISpeechTask)
NS_INTERFACE_MAP_ENTRY(nsIAudioChannelAgentCallback)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISpeechTask)
NS_INTERFACE_MAP_END
@ -110,6 +101,7 @@ nsSpeechTask::nsSpeechTask(SpeechSynthesisUtterance* aUtterance)
, mPrePaused(false)
, mPreCanceled(false)
, mCallback(nullptr)
, mIndirectAudio(false)
{
mText = aUtterance->mText;
mVolume = aUtterance->Volume();
@ -123,6 +115,7 @@ nsSpeechTask::nsSpeechTask(float aVolume, const nsAString& aText)
, mPrePaused(false)
, mPreCanceled(false)
, mCallback(nullptr)
, mIndirectAudio(false)
{
}
@ -149,7 +142,9 @@ nsSpeechTask::Init(ProcessedMediaStream* aStream)
if (aStream) {
mStream = MediaStreamGraph::GetInstance()->CreateSourceStream(nullptr);
mPort = aStream->AllocateInputPort(mStream, 0);
mIndirectAudio = false;
} else {
mIndirectAudio = true;
}
mInited = true;
}
@ -170,7 +165,8 @@ nsSpeechTask::Setup(nsISpeechTaskCallback* aCallback,
mCallback = aCallback;
if (!mStream) {
if (mIndirectAudio) {
MOZ_ASSERT(!mStream);
if (argc > 0) {
NS_WARNING("Audio info arguments in Setup() are ignored for indirect audio services.");
}
@ -230,7 +226,7 @@ nsSpeechTask::SendAudio(JS::Handle<JS::Value> aData, JS::Handle<JS::Value> aLand
return NS_ERROR_INVALID_ARG;
}
if (!mStream) {
if (mIndirectAudio) {
NS_WARNING("Can't call SendAudio from an indirect audio speech service.");
return NS_ERROR_FAILURE;
}
@ -277,7 +273,7 @@ nsSpeechTask::SendAudioNative(int16_t* aData, uint32_t aDataLen)
return NS_ERROR_FAILURE;
}
if (!mStream) {
if (mIndirectAudio) {
NS_WARNING("Can't call SendAudio from an indirect audio speech service.");
return NS_ERROR_FAILURE;
}
@ -307,7 +303,7 @@ nsSpeechTask::SendAudioImpl(nsRefPtr<mozilla::SharedBuffer>& aSamples, uint32_t
NS_IMETHODIMP
nsSpeechTask::DispatchStart()
{
if (mStream) {
if (!mIndirectAudio) {
NS_WARNING("Can't call DispatchStart() from a direct audio speech service");
return NS_ERROR_FAILURE;
}
@ -318,8 +314,6 @@ nsSpeechTask::DispatchStart()
nsresult
nsSpeechTask::DispatchStartInner()
{
CreateAudioChannelAgent();
nsSynthVoiceRegistry::GetInstance()->SetIsSpeaking(true);
return DispatchStartImpl();
}
@ -351,7 +345,7 @@ nsSpeechTask::DispatchStartImpl(const nsAString& aUri)
NS_IMETHODIMP
nsSpeechTask::DispatchEnd(float aElapsedTime, uint32_t aCharIndex)
{
if (mStream) {
if (!mIndirectAudio) {
NS_WARNING("Can't call DispatchEnd() from a direct audio speech service");
return NS_ERROR_FAILURE;
}
@ -362,8 +356,6 @@ nsSpeechTask::DispatchEnd(float aElapsedTime, uint32_t aCharIndex)
nsresult
nsSpeechTask::DispatchEndInner(float aElapsedTime, uint32_t aCharIndex)
{
DestroyAudioChannelAgent();
if (!mPreCanceled) {
nsSynthVoiceRegistry::GetInstance()->SpeakNext();
}
@ -407,7 +399,7 @@ nsSpeechTask::DispatchEndImpl(float aElapsedTime, uint32_t aCharIndex)
NS_IMETHODIMP
nsSpeechTask::DispatchPause(float aElapsedTime, uint32_t aCharIndex)
{
if (mStream) {
if (!mIndirectAudio) {
NS_WARNING("Can't call DispatchPause() from a direct audio speech service");
return NS_ERROR_FAILURE;
}
@ -439,7 +431,7 @@ nsSpeechTask::DispatchPauseImpl(float aElapsedTime, uint32_t aCharIndex)
NS_IMETHODIMP
nsSpeechTask::DispatchResume(float aElapsedTime, uint32_t aCharIndex)
{
if (mStream) {
if (!mIndirectAudio) {
NS_WARNING("Can't call DispatchResume() from a direct audio speech service");
return NS_ERROR_FAILURE;
}
@ -472,7 +464,7 @@ nsSpeechTask::DispatchResumeImpl(float aElapsedTime, uint32_t aCharIndex)
NS_IMETHODIMP
nsSpeechTask::DispatchError(float aElapsedTime, uint32_t aCharIndex)
{
if (mStream) {
if (!mIndirectAudio) {
NS_WARNING("Can't call DispatchError() from a direct audio speech service");
return NS_ERROR_FAILURE;
}
@ -499,7 +491,7 @@ NS_IMETHODIMP
nsSpeechTask::DispatchBoundary(const nsAString& aName,
float aElapsedTime, uint32_t aCharIndex)
{
if (mStream) {
if (!mIndirectAudio) {
NS_WARNING("Can't call DispatchBoundary() from a direct audio speech service");
return NS_ERROR_FAILURE;
}
@ -526,7 +518,7 @@ NS_IMETHODIMP
nsSpeechTask::DispatchMark(const nsAString& aName,
float aElapsedTime, uint32_t aCharIndex)
{
if (mStream) {
if (!mIndirectAudio) {
NS_WARNING("Can't call DispatchMark() from a direct audio speech service");
return NS_ERROR_FAILURE;
}
@ -567,7 +559,7 @@ nsSpeechTask::Pause()
mPrePaused = true;
}
if (mStream) {
if (!mIndirectAudio) {
DispatchPauseImpl(GetCurrentTime(), GetCurrentCharOffset());
}
}
@ -591,7 +583,7 @@ nsSpeechTask::Resume()
nsSynthVoiceRegistry::GetInstance()->ResumeQueue();
}
if (mStream) {
if (!mIndirectAudio) {
DispatchResumeImpl(GetCurrentTime(), GetCurrentCharOffset());
}
}
@ -616,7 +608,7 @@ nsSpeechTask::Cancel()
mPreCanceled = true;
}
if (mStream) {
if (!mIndirectAudio) {
DispatchEndInner(GetCurrentTime(), GetCurrentCharOffset());
}
}
@ -653,53 +645,5 @@ nsSpeechTask::SetSpeechSynthesis(SpeechSynthesis* aSpeechSynthesis)
mSpeechSynthesis = aSpeechSynthesis;
}
void
nsSpeechTask::CreateAudioChannelAgent()
{
if (!mUtterance || !UseAudioChannelService()) {
return;
}
if (mAudioChannelAgent) {
mAudioChannelAgent->NotifyStoppedPlaying(nsIAudioChannelAgent::AUDIO_AGENT_NOTIFY);
}
mAudioChannelAgent = new AudioChannelAgent();
mAudioChannelAgent->InitWithWeakCallback(mUtterance->GetOwner(),
static_cast<int32_t>(AudioChannelService::GetDefaultAudioChannel()),
this);
}
void
nsSpeechTask::DestroyAudioChannelAgent()
{
if (mAudioChannelAgent) {
mAudioChannelAgent->NotifyStoppedPlaying(nsIAudioChannelAgent::AUDIO_AGENT_NOTIFY);
mAudioChannelAgent = nullptr;
}
}
NS_IMETHODIMP
nsSpeechTask::WindowVolumeChanged(float aVolume, bool aMuted)
{
SetAudioOutputVolume(mVolume * aVolume * aMuted);
return NS_OK;
}
NS_IMETHODIMP
nsSpeechTask::WindowAudioCaptureChanged()
{
// This is not supported yet.
return NS_OK;
}
void
nsSpeechTask::SetAudioOutputVolume(uint32_t aVolume)
{
if (mStream) {
mStream->SetAudioOutputVolume(this, aVolume);
}
}
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -9,7 +9,6 @@
#include "MediaStreamGraph.h"
#include "SpeechSynthesisUtterance.h"
#include "nsIAudioChannelAgent.h"
#include "nsISpeechService.h"
namespace mozilla {
@ -20,7 +19,6 @@ class SpeechSynthesis;
class SynthStreamListener;
class nsSpeechTask : public nsISpeechTask
, public nsIAudioChannelAgentCallback
{
friend class SynthStreamListener;
@ -29,7 +27,6 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsSpeechTask, nsISpeechTask)
NS_DECL_NSISPEECHTASK
NS_DECL_NSIAUDIOCHANNELAGENTCALLBACK
explicit nsSpeechTask(SpeechSynthesisUtterance* aUtterance);
nsSpeechTask(float aVolume, const nsAString& aText);
@ -52,8 +49,6 @@ public:
void SetChosenVoiceURI(const nsAString& aUri);
virtual void SetAudioOutputVolume(uint32_t aVolume);
bool IsPreCanceled()
{
return mPreCanceled;
@ -107,22 +102,18 @@ private:
nsresult DispatchEndInner(float aElapsedTime, uint32_t aCharIndex);
void CreateAudioChannelAgent();
void DestroyAudioChannelAgent();
nsRefPtr<SourceMediaStream> mStream;
nsRefPtr<MediaInputPort> mPort;
nsCOMPtr<nsISpeechTaskCallback> mCallback;
nsCOMPtr<nsIAudioChannelAgent> mAudioChannelAgent;
uint32_t mChannels;
nsRefPtr<SpeechSynthesis> mSpeechSynthesis;
bool mIndirectAudio;
nsString mChosenVoiceURI;
};