| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010, Google Inc. All rights reserved. | 2 * Copyright (C) 2010, 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 ec = INVALID_STATE_ERR; | 383 ec = INVALID_STATE_ERR; |
| 384 return 0; | 384 return 0; |
| 385 } | 385 } |
| 386 | 386 |
| 387 ASSERT(isMainThread()); | 387 ASSERT(isMainThread()); |
| 388 lazyInitialize(); | 388 lazyInitialize(); |
| 389 | 389 |
| 390 AudioSourceProvider* provider = 0; | 390 AudioSourceProvider* provider = 0; |
| 391 | 391 |
| 392 MediaStreamTrackVector audioTracks = mediaStream->getAudioTracks(); | 392 MediaStreamTrackVector audioTracks = mediaStream->getAudioTracks(); |
| 393 if (mediaStream->isLocal() && audioTracks.size()) { | 393 |
| 394 // Enable input for the specific local audio device specified in the Med
iaStreamSource. | 394 // FIXME: get a provider for non-local MediaStreams (like from a remote peer
). |
| 395 RefPtr<MediaStreamTrack> localAudio = audioTracks[0]; | 395 for (size_t i = 0; i < audioTracks.size(); ++i) { |
| 396 RefPtr<MediaStreamTrack> localAudio = audioTracks[i]; |
| 396 MediaStreamSource* source = localAudio->component()->source(); | 397 MediaStreamSource* source = localAudio->component()->source(); |
| 397 destination()->enableInput(source->deviceId()); | 398 if (!source->deviceId().isEmpty()) { |
| 398 provider = destination()->localAudioInputProvider(); | 399 destination()->enableInput(source->deviceId()); |
| 399 } else { | 400 provider = destination()->localAudioInputProvider(); |
| 400 // FIXME: get a provider for non-local MediaStreams (like from a remote
peer). | 401 break; |
| 401 provider = 0; | 402 } |
| 402 } | 403 } |
| 403 | 404 |
| 404 RefPtr<MediaStreamAudioSourceNode> node = MediaStreamAudioSourceNode::create
(this, mediaStream, provider); | 405 RefPtr<MediaStreamAudioSourceNode> node = MediaStreamAudioSourceNode::create
(this, mediaStream, provider); |
| 405 | 406 |
| 406 // FIXME: Only stereo streams are supported right now. We should be able to
accept multi-channel streams. | 407 // FIXME: Only stereo streams are supported right now. We should be able to
accept multi-channel streams. |
| 407 node->setFormat(2, sampleRate()); | 408 node->setFormat(2, sampleRate()); |
| 408 | 409 |
| 409 refNode(node.get()); // context keeps reference until node is disconnected | 410 refNode(node.get()); // context keeps reference until node is disconnected |
| 410 return node; | 411 return node; |
| 411 } | 412 } |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 info.addMember(m_deferredFinishDerefList, "deferredFinishDerefList"); | 991 info.addMember(m_deferredFinishDerefList, "deferredFinishDerefList"); |
| 991 info.addMember(m_hrtfDatabaseLoader, "hrtfDatabaseLoader"); | 992 info.addMember(m_hrtfDatabaseLoader, "hrtfDatabaseLoader"); |
| 992 info.addMember(m_eventTargetData, "eventTargetData"); | 993 info.addMember(m_eventTargetData, "eventTargetData"); |
| 993 info.addMember(m_renderTarget, "renderTarget"); | 994 info.addMember(m_renderTarget, "renderTarget"); |
| 994 info.addMember(m_audioDecoder, "audioDecoder"); | 995 info.addMember(m_audioDecoder, "audioDecoder"); |
| 995 } | 996 } |
| 996 | 997 |
| 997 } // namespace WebCore | 998 } // namespace WebCore |
| 998 | 999 |
| 999 #endif // ENABLE(WEB_AUDIO) | 1000 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |