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