mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
6e0ee8992d
- Bug 1189506. Remove no-longer-used TimeVarying.h. r=karlt (8d2cec3e0c)
- Bug 1189506. Set mStartBlocking in UpdateCurrentTimeForStreams to indicate that blocking time has been processed. r=karlt (22495c3d57)
- Bug 1189506. Remove INCLUDE_TRAILING_BLOCKED_INTERVAL from PlayVideo. r=karlt (5b748ce70c)
- Bug 1189506. Call StreamTimeToGraphTime in MediaStreamGraphImpl::UpdateCurrentTimeForStreams, since we know blocking has been taken account of already there. r=karlt (cffde8399d)
- Bug 1189506. Call GraphTimeToStreamTime in DecodedStreamGraphListener::NotifyOutput, since there's no blocking pending there. r=karlt (dd620d1eb5)
- Bug 1189506. Call GraphTimeToStreamTime in AudioNodeExternalInputStream. r=karlt (840ec52c58)
- Bug 1189506. Use GraphTimeToStreamTime in PrepareUpdatesToMainThreadState. r=karlt (5f19765ab5)
- Bug 1189506. Relax assertions a bit. karlt (a75421cc9e)
- Bug 1189506. Make PlayVideo use GraphTimeToStreamTime/StreamTimeToGraphTime and remove StreamTimeToGraphTimeWithBlocking. r=karlt (09e05f2197)
- Bug 1189506. Make PlayAudio use GraphTimeToStreamTime. r=karlt (2e220a691b)
- Bug 1218593 - switch back to the AudioCallbackDriver when there is new audio again. r=padenot (4f8a192db8)
- bug 1217625 remove unused MessageQueue() and document message queue thread access r=padenot (6c1b342c9b)
- bug 1217625 remove declarations of undefined methods r=padenot (989b7691ed)
- Bug 1215699. Ensure that AudioGraphDriver uses the MediaStreamGraph's AudioChannel. r=padenot (455fcf6847)
- Bug 1196451 - tweak comment in nsRefPtr.h to be more clear; r=botond (4838f7b333)
- bug 1214864 - fixup SetCaret() changes on windows (8fbf8a53fb)
- bug 1192353 - make HyperTextProxyAccessibleWrap inherit from (bf4756be27)
- bug 1192330 - move static text change data from HyperTextAccessibleWrap to ia2AccessibleText r=surkov (b10597a5d5)
- Bug 1192330 - remove ia2AccessibleText::GetModifiedText() r=surkov (e24f7208a4)
- bug 1192330 - add ia2AccessibleText::UpdateTextChangeData r=surkov (46ca279dcb)
- bug 120684 may have changed which .cpp files are compiled together in unified builds causing ScreenOrientation.cpp to not compile on Windows, a=bustage, CLOSED TREE (67b5220301)
- bug 120684, add ChromeNodeList so that chrome JS can create proper NodeList objects, r=baku (05a628700c)
- Bug 120684 - use ChromeNodeList in toolkit's listboxes' selectedItems implementation, r=dao,smaug (ee185e34e9)
- Bug 120684 - followup: adjust DOM interface test, implied-r=smaug,bustage (4ca143acf4)
- missing byRef subsitution of Bug 1207245 - part 3 (97150a9786)
- bug 1217625 add a means to schedule a callback after processing on the graph thread r=padenot (810d14b96b)
- bug 1217625 remove ADD_STREAM_SUSPENDED r=padenot (872586f13d)
- Bug 1216417 - Add logging for audio and video output changes in MSG. r=roc (59bad99c2c)
- align pointer type to FF/TFF (856841ec9b)
- Bug 1152298 - Implement AutoDriver for CanvasCaptureMediaStream. r=mt (b57c7be8be)
- Bug 912342 - Move code MediaOperationTask from .h to .cpp. r=jesup (45a16b4b72)
- Bug 912342 - Change capture resolution. r=jesup (12d7a036c6)
- Bug 912342 - Pass in Audio/VideoDevice in place of Audio/VideoSource. r=jesup (788fced553)
- Bug 1152381 - implement mediaDevices.getSupportedConstraints. r=smaug, r=jesup (04dda577ed)
- Bug 1186198 - s/unexpected/unanticipated/. r=drno (02dab80572)
- Bug 1191296 - Revert use of .includes() to .indexOf() != -1. r=jesup (99234d311b)
- Bug 1181896 - rename .constraintName to .constraint in MediaStreamError r=jesup,bz (7b799900d7)
- Bug 1191298 - don't fail on unknown audio constraints e.g. getUserMedia({ audio: {} }) (regression) r=jesup (8d5b9173a6)
- Bug 1181883 - Add serializer on MediaDeviceInfo. r=smaug (ac6baa26e8)
- Bug 1186209 - Check for VTYPE_EMPTY_ARRAY in enumerateDevices + test. r=jesup (4a158a5d5b)
- Bug 1161615 - Clean up gUM mochitest to use promises. r=mt (8823d4466d)
- Bug 1181896 - make gUM fail w/OverconstrainedError and candidate argument r=jesup (a146b6150f)
- Bug 912342 - Move code SelectSettings to MediaConstraintsHelper. r=jesup (3bfe2277bc)
- Bug 1195951 - fix heap type on stack error in MediaUtils' Pledge class. r=jesup (0a4ab1f26f)
- Bug 912342 - get Promise out. r=jesup (983b58ce56)
- Bug 1170958 - Refactor DOMMediaStream to contain a 3-stage track chain. r=roc (ae86da997c)
- bug 1210267 remove custom AudioParam::Release and disconnect in destructor r=baku (16b7be9ddc)
- Bug 1192170 - Remove media capture indicator when all tracks have ended. r=jib (d9864efcaf)
- Bug 1103188 - Always call MediaManager::NotifyFinished/NotifyRemoved on main thread. r=jib (5754c8c562)
- Bug 1103188 - Keep track of capture stop only in gUM stream listener. r=jib (7759b218f7)
- Bug 1103188 - Keep track of stopped tracks in gUM stream listener. r=jib (97b176edb5)
- Bug 1210852 - do SelectSettings of device capabilities on media thread. r=jesup (b2b2eb0374)
- Bug 1213738 - media::NewRunnableFrom() and media::NewTaskFrom() move lambda arg instead of copying it. r=jesup (0e73aef22b)
- Bug 1213738 - media::Pledge.Then() moves lambda args instead of copying them. r=jesup (07a9dcb150)
- and convert back some malloc/realloc/free to use the one with moz_ prefix
151 lines
4.2 KiB
C++
151 lines
4.2 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* 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 "AudioParam.h"
|
|
#include "mozilla/dom/AudioParamBinding.h"
|
|
#include "AudioNodeEngine.h"
|
|
#include "AudioNodeStream.h"
|
|
#include "AudioContext.h"
|
|
|
|
namespace mozilla {
|
|
namespace dom {
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(AudioParam)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(AudioParam)
|
|
tmp->DisconnectFromGraphAndDestroyStream();
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mNode)
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(AudioParam)
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNode)
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(AudioParam)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_NATIVE_ADDREF(AudioParam)
|
|
NS_IMPL_CYCLE_COLLECTING_NATIVE_RELEASE(AudioParam)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(AudioParam, AddRef)
|
|
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AudioParam, Release)
|
|
|
|
AudioParam::AudioParam(AudioNode* aNode,
|
|
uint32_t aIndex,
|
|
float aDefaultValue,
|
|
const char* aName)
|
|
: AudioParamTimeline(aDefaultValue)
|
|
, mNode(aNode)
|
|
, mName(aName)
|
|
, mIndex(aIndex)
|
|
, mDefaultValue(aDefaultValue)
|
|
{
|
|
}
|
|
|
|
AudioParam::~AudioParam()
|
|
{
|
|
DisconnectFromGraphAndDestroyStream();
|
|
}
|
|
|
|
JSObject*
|
|
AudioParam::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
|
{
|
|
return AudioParamBinding::Wrap(aCx, this, aGivenProto);
|
|
}
|
|
|
|
void
|
|
AudioParam::DisconnectFromGraphAndDestroyStream()
|
|
{
|
|
MOZ_ASSERT(mRefCnt.get() > mInputNodes.Length(),
|
|
"Caller should be holding a reference or have called "
|
|
"mRefCnt.stabilizeForDeletion()");
|
|
|
|
while (!mInputNodes.IsEmpty()) {
|
|
uint32_t i = mInputNodes.Length() - 1;
|
|
RefPtr<AudioNode> input = mInputNodes[i].mInputNode;
|
|
mInputNodes.RemoveElementAt(i);
|
|
input->RemoveOutputParam(this);
|
|
}
|
|
|
|
if (mNodeStreamPort) {
|
|
mNodeStreamPort->Destroy();
|
|
mNodeStreamPort = nullptr;
|
|
}
|
|
|
|
if (mStream) {
|
|
mStream->Destroy();
|
|
mStream = nullptr;
|
|
}
|
|
}
|
|
|
|
MediaStream*
|
|
AudioParam::Stream()
|
|
{
|
|
if (mStream) {
|
|
return mStream;
|
|
}
|
|
|
|
AudioNodeEngine* engine = new AudioNodeEngine(nullptr);
|
|
RefPtr<AudioNodeStream> stream =
|
|
AudioNodeStream::Create(mNode->Context(), engine,
|
|
AudioNodeStream::NO_STREAM_FLAGS);
|
|
|
|
// Force the input to have only one channel, and make it down-mix using
|
|
// the speaker rules if needed.
|
|
stream->SetChannelMixingParametersImpl(1, ChannelCountMode::Explicit, ChannelInterpretation::Speakers);
|
|
// Mark as an AudioParam helper stream
|
|
stream->SetAudioParamHelperStream();
|
|
|
|
mStream = stream.forget();
|
|
|
|
// Setup the AudioParam's stream as an input to the owner AudioNode's stream
|
|
AudioNodeStream* nodeStream = mNode->GetStream();
|
|
if (nodeStream) {
|
|
mNodeStreamPort =
|
|
nodeStream->AllocateInputPort(mStream, AudioNodeStream::AUDIO_TRACK);
|
|
}
|
|
|
|
// Send the stream to the timeline on the MSG side.
|
|
AudioTimelineEvent event(mStream);
|
|
SendEventToEngine(event);
|
|
|
|
return mStream;
|
|
}
|
|
|
|
void
|
|
AudioParam::SendEventToEngine(const AudioTimelineEvent& aEvent)
|
|
{
|
|
AudioNodeStream* stream = mNode->GetStream();
|
|
if (stream) {
|
|
stream->SendTimelineEvent(mIndex, aEvent);
|
|
}
|
|
}
|
|
|
|
float
|
|
AudioParamTimeline::AudioNodeInputValue(size_t aCounter) const
|
|
{
|
|
MOZ_ASSERT(mStream);
|
|
|
|
// If we have a chunk produced by the AudioNode inputs to the AudioParam,
|
|
// get its value now. We use aCounter to tell us which frame of the last
|
|
// AudioChunk to look at.
|
|
float audioNodeInputValue = 0.0f;
|
|
const AudioBlock& lastAudioNodeChunk =
|
|
static_cast<AudioNodeStream*>(mStream.get())->LastChunks()[0];
|
|
if (!lastAudioNodeChunk.IsNull()) {
|
|
MOZ_ASSERT(lastAudioNodeChunk.GetDuration() == WEBAUDIO_BLOCK_SIZE);
|
|
audioNodeInputValue =
|
|
static_cast<const float*>(lastAudioNodeChunk.mChannelData[0])[aCounter];
|
|
audioNodeInputValue *= lastAudioNodeChunk.mVolume;
|
|
}
|
|
|
|
return audioNodeInputValue;
|
|
}
|
|
|
|
} // namespace dom
|
|
} // namespace mozilla
|
|
|