| 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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 "invalid MediaStream source")); | 430 "invalid MediaStream source")); |
| 431 return 0; | 431 return 0; |
| 432 } | 432 } |
| 433 | 433 |
| 434 ASSERT(isMainThread()); | 434 ASSERT(isMainThread()); |
| 435 lazyInitialize(); | 435 lazyInitialize(); |
| 436 | 436 |
| 437 AudioSourceProvider* provider = 0; | 437 AudioSourceProvider* provider = 0; |
| 438 | 438 |
| 439 MediaStreamTrackVector audioTracks = mediaStream->getAudioTracks(); | 439 MediaStreamTrackVector audioTracks = mediaStream->getAudioTracks(); |
| 440 RefPtr<MediaStreamTrack> audioTrack; |
| 440 | 441 |
| 441 // FIXME: get a provider for non-local MediaStreams (like from a remote peer
). | 442 // FIXME: get a provider for non-local MediaStreams (like from a remote peer
). |
| 442 for (size_t i = 0; i < audioTracks.size(); ++i) { | 443 for (size_t i = 0; i < audioTracks.size(); ++i) { |
| 443 RefPtr<MediaStreamTrack> localAudio = audioTracks[i]; | 444 audioTrack = audioTracks[i]; |
| 444 if (localAudio->component()->audioSourceProvider()) { | 445 if (audioTrack->component()->audioSourceProvider()) { |
| 445 provider = localAudio->component()->audioSourceProvider(); | 446 provider = audioTrack->component()->audioSourceProvider(); |
| 446 break; | 447 break; |
| 447 } | 448 } |
| 448 } | 449 } |
| 449 | 450 |
| 450 RefPtr<MediaStreamAudioSourceNode> node = MediaStreamAudioSourceNode::create
(this, mediaStream, provider); | 451 RefPtr<MediaStreamAudioSourceNode> node = MediaStreamAudioSourceNode::create
(this, mediaStream, audioTrack.get(), provider); |
| 451 | 452 |
| 452 // FIXME: Only stereo streams are supported right now. We should be able to
accept multi-channel streams. | 453 // FIXME: Only stereo streams are supported right now. We should be able to
accept multi-channel streams. |
| 453 node->setFormat(2, sampleRate()); | 454 node->setFormat(2, sampleRate()); |
| 454 | 455 |
| 455 refNode(node.get()); // context keeps reference until node is disconnected | 456 refNode(node.get()); // context keeps reference until node is disconnected |
| 456 return node; | 457 return node; |
| 457 } | 458 } |
| 458 | 459 |
| 459 PassRefPtr<MediaStreamAudioDestinationNode> AudioContext::createMediaStreamDesti
nation() | 460 PassRefPtr<MediaStreamAudioDestinationNode> AudioContext::createMediaStreamDesti
nation() |
| 460 { | 461 { |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1101 } | 1102 } |
| 1102 | 1103 |
| 1103 void AudioContext::decrementActiveSourceCount() | 1104 void AudioContext::decrementActiveSourceCount() |
| 1104 { | 1105 { |
| 1105 atomicDecrement(&m_activeSourceCount); | 1106 atomicDecrement(&m_activeSourceCount); |
| 1106 } | 1107 } |
| 1107 | 1108 |
| 1108 } // namespace WebCore | 1109 } // namespace WebCore |
| 1109 | 1110 |
| 1110 #endif // ENABLE(WEB_AUDIO) | 1111 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |