зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1346880 - Always initialize an AudioChannelAgent when initializing an AudioContext. r=alwu
Differential Revision: https://phabricator.services.mozilla.com/D92644
This commit is contained in:
Родитель
70251b3778
Коммит
fb3387d796
|
@ -176,6 +176,7 @@ AudioContext::AudioContext(nsPIDOMWindowInner* aWindow, bool aIsOffline,
|
|||
const bool allowedToStart = AutoplayPolicy::IsAllowedToPlay(*this);
|
||||
mDestination = new AudioDestinationNode(this, aIsOffline, allowedToStart,
|
||||
aNumberOfChannels, aLength);
|
||||
mDestination->Init();
|
||||
// If an AudioContext is not allowed to start, we would postpone its state
|
||||
// transition from `suspended` to `running` until sites explicitly call
|
||||
// AudioContext.resume() or AudioScheduledSourceNode.start().
|
||||
|
|
|
@ -321,6 +321,18 @@ AudioDestinationNode::AudioDestinationNode(AudioContext* aContext,
|
|||
}
|
||||
}
|
||||
|
||||
void AudioDestinationNode::Init() {
|
||||
if (!mIsOffline) {
|
||||
CreateAudioChannelAgent();
|
||||
nsresult rv = mAudioChannelAgent->NotifyStartedPlaying(
|
||||
AudioChannelService::AudibleState::eNotAudible);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return;
|
||||
}
|
||||
mAudioChannelAgent->PullInitialUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
AudioDestinationNode::~AudioDestinationNode() {
|
||||
ReleaseAudioWakeLockIfExists();
|
||||
}
|
||||
|
|
|
@ -42,6 +42,8 @@ class AudioDestinationNode final : public AudioNode,
|
|||
uint32_t MaxChannelCount() const;
|
||||
void SetChannelCount(uint32_t aChannelCount, ErrorResult& aRv) override;
|
||||
|
||||
void Init();
|
||||
|
||||
// Returns the track or null after unlink.
|
||||
AudioNodeTrack* Track();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче