This source file includes following definitions.
- create
- m_mixBus
- process
#include "config.h"
#if ENABLE(WEB_AUDIO)
#include "modules/webaudio/MediaStreamAudioDestinationNode.h"
#include "modules/webaudio/AudioContext.h"
#include "modules/webaudio/AudioNodeInput.h"
#include "platform/UUID.h"
#include "platform/mediastream/MediaStreamCenter.h"
#include "public/platform/WebRTCPeerConnectionHandler.h"
#include "wtf/Locker.h"
namespace WebCore {
PassRefPtr<MediaStreamAudioDestinationNode> MediaStreamAudioDestinationNode::create(AudioContext* context, size_t numberOfChannels)
{
return adoptRef(new MediaStreamAudioDestinationNode(context, numberOfChannels));
}
MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode(AudioContext* context, size_t numberOfChannels)
: AudioBasicInspectorNode(context, context->sampleRate(), numberOfChannels)
, m_mixBus(AudioBus::create(numberOfChannels, ProcessingSizeInFrames))
{
ScriptWrappable::init(this);
setNodeType(NodeTypeMediaStreamAudioDestination);
m_source = MediaStreamSource::create("WebAudio-" + createCanonicalUUIDString(), MediaStreamSource::TypeAudio, "MediaStreamAudioDestinationNode", MediaStreamSource::ReadyStateLive, true);
MediaStreamSourceVector audioSources;
audioSources.append(m_source);
MediaStreamSourceVector videoSources;
m_stream = MediaStream::create(context->executionContext(), MediaStreamDescriptor::create(audioSources, videoSources));
MediaStreamCenter::instance().didCreateMediaStreamAndTracks(m_stream->descriptor());
m_source->setAudioFormat(numberOfChannels, context->sampleRate());
initialize();
}
MediaStreamAudioDestinationNode::~MediaStreamAudioDestinationNode()
{
uninitialize();
}
void MediaStreamAudioDestinationNode::process(size_t numberOfFrames)
{
m_mixBus->copyFrom(*input(0)->bus());
m_source->consumeAudio(m_mixBus.get(), numberOfFrames);
}
}
#endif