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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 | 395 |
396 MediaStreamTrackVector audioTracks = mediaStream->getAudioTracks(); | 396 MediaStreamTrackVector audioTracks = mediaStream->getAudioTracks(); |
397 if (audioTracks.isEmpty()) { | 397 if (audioTracks.isEmpty()) { |
398 exceptionState.throwDOMException( | 398 exceptionState.throwDOMException( |
399 InvalidStateError, | 399 InvalidStateError, |
400 "MediaStream has no audio track"); | 400 "MediaStream has no audio track"); |
401 return nullptr; | 401 return nullptr; |
402 } | 402 } |
403 | 403 |
404 // Use the first audio track in the media stream. | 404 // Use the first audio track in the media stream. |
405 RefPtr<MediaStreamTrack> audioTrack = audioTracks[0]; | 405 RefPtrWillBeRawPtr<MediaStreamTrack> audioTrack = audioTracks[0]; |
406 OwnPtr<AudioSourceProvider> provider = audioTrack->createWebAudioSource(); | 406 OwnPtr<AudioSourceProvider> provider = audioTrack->createWebAudioSource(); |
407 RefPtr<MediaStreamAudioSourceNode> node = MediaStreamAudioSourceNode::create
(this, mediaStream, audioTrack.get(), provider.release()); | 407 RefPtr<MediaStreamAudioSourceNode> node = MediaStreamAudioSourceNode::create
(this, mediaStream, audioTrack.get(), provider.release()); |
408 | 408 |
409 // FIXME: Only stereo streams are supported right now. We should be able to
accept multi-channel streams. | 409 // FIXME: Only stereo streams are supported right now. We should be able to
accept multi-channel streams. |
410 node->setFormat(2, sampleRate()); | 410 node->setFormat(2, sampleRate()); |
411 | 411 |
412 refNode(node.get()); // context keeps reference until node is disconnected | 412 refNode(node.get()); // context keeps reference until node is disconnected |
413 return node; | 413 return node; |
414 } | 414 } |
415 | 415 |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 } | 1019 } |
1020 | 1020 |
1021 void AudioContext::decrementActiveSourceCount() | 1021 void AudioContext::decrementActiveSourceCount() |
1022 { | 1022 { |
1023 atomicDecrement(&m_activeSourceCount); | 1023 atomicDecrement(&m_activeSourceCount); |
1024 } | 1024 } |
1025 | 1025 |
1026 } // namespace WebCore | 1026 } // namespace WebCore |
1027 | 1027 |
1028 #endif // ENABLE(WEB_AUDIO) | 1028 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |