OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 MediaStreamAudioDestinationNode* MediaStreamAudioDestinationNode::create(AudioCo
ntext* context, size_t numberOfChannels) | 38 MediaStreamAudioDestinationNode* MediaStreamAudioDestinationNode::create(AudioCo
ntext* context, size_t numberOfChannels) |
39 { | 39 { |
40 return adoptRefCountedGarbageCollectedWillBeNoop(new MediaStreamAudioDestina
tionNode(context, numberOfChannels)); | 40 return adoptRefCountedGarbageCollectedWillBeNoop(new MediaStreamAudioDestina
tionNode(context, numberOfChannels)); |
41 } | 41 } |
42 | 42 |
43 MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode(AudioContext* c
ontext, size_t numberOfChannels) | 43 MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode(AudioContext* c
ontext, size_t numberOfChannels) |
44 : AudioBasicInspectorNode(context, context->sampleRate(), numberOfChannels) | 44 : AudioBasicInspectorNode(context, context->sampleRate(), numberOfChannels) |
45 , m_mixBus(AudioBus::create(numberOfChannels, ProcessingSizeInFrames)) | 45 , m_mixBus(AudioBus::create(numberOfChannels, ProcessingSizeInFrames)) |
46 { | 46 { |
47 ScriptWrappable::init(this); | |
48 setNodeType(NodeTypeMediaStreamAudioDestination); | 47 setNodeType(NodeTypeMediaStreamAudioDestination); |
49 | 48 |
50 m_source = MediaStreamSource::create("WebAudio-" + createCanonicalUUIDString
(), MediaStreamSource::TypeAudio, "MediaStreamAudioDestinationNode", MediaStream
Source::ReadyStateLive, true); | 49 m_source = MediaStreamSource::create("WebAudio-" + createCanonicalUUIDString
(), MediaStreamSource::TypeAudio, "MediaStreamAudioDestinationNode", MediaStream
Source::ReadyStateLive, true); |
51 MediaStreamSourceVector audioSources; | 50 MediaStreamSourceVector audioSources; |
52 audioSources.append(m_source); | 51 audioSources.append(m_source); |
53 MediaStreamSourceVector videoSources; | 52 MediaStreamSourceVector videoSources; |
54 m_stream = MediaStream::create(context->executionContext(), MediaStreamDescr
iptor::create(audioSources, videoSources)); | 53 m_stream = MediaStream::create(context->executionContext(), MediaStreamDescr
iptor::create(audioSources, videoSources)); |
55 MediaStreamCenter::instance().didCreateMediaStreamAndTracks(m_stream->descri
ptor()); | 54 MediaStreamCenter::instance().didCreateMediaStreamAndTracks(m_stream->descri
ptor()); |
56 | 55 |
57 m_source->setAudioFormat(numberOfChannels, context->sampleRate()); | 56 m_source->setAudioFormat(numberOfChannels, context->sampleRate()); |
(...skipping 20 matching lines...) Expand all Loading... |
78 | 77 |
79 void MediaStreamAudioDestinationNode::process(size_t numberOfFrames) | 78 void MediaStreamAudioDestinationNode::process(size_t numberOfFrames) |
80 { | 79 { |
81 m_mixBus->copyFrom(*input(0)->bus()); | 80 m_mixBus->copyFrom(*input(0)->bus()); |
82 m_source->consumeAudio(m_mixBus.get(), numberOfFrames); | 81 m_source->consumeAudio(m_mixBus.get(), numberOfFrames); |
83 } | 82 } |
84 | 83 |
85 } // namespace blink | 84 } // namespace blink |
86 | 85 |
87 #endif // ENABLE(WEB_AUDIO) | 86 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |