| 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 | 366 |
| 367 MediaStreamTrackVector audioTracks = mediaStream->getAudioTracks(); | 367 MediaStreamTrackVector audioTracks = mediaStream->getAudioTracks(); |
| 368 if (audioTracks.isEmpty()) { | 368 if (audioTracks.isEmpty()) { |
| 369 exceptionState.throwDOMException( | 369 exceptionState.throwDOMException( |
| 370 InvalidStateError, | 370 InvalidStateError, |
| 371 "MediaStream has no audio track"); | 371 "MediaStream has no audio track"); |
| 372 return nullptr; | 372 return nullptr; |
| 373 } | 373 } |
| 374 | 374 |
| 375 // Use the first audio track in the media stream. | 375 // Use the first audio track in the media stream. |
| 376 RefPtr<MediaStreamTrack> audioTrack = audioTracks[0]; | 376 RefPtrWillBeRawPtr<MediaStreamTrack> audioTrack = audioTracks[0]; |
| 377 OwnPtr<AudioSourceProvider> provider = audioTrack->createWebAudioSource(); | 377 OwnPtr<AudioSourceProvider> provider = audioTrack->createWebAudioSource(); |
| 378 RefPtr<MediaStreamAudioSourceNode> node = MediaStreamAudioSourceNode::create
(this, mediaStream, audioTrack.get(), provider.release()); | 378 RefPtr<MediaStreamAudioSourceNode> node = MediaStreamAudioSourceNode::create
(this, mediaStream, audioTrack.get(), provider.release()); |
| 379 | 379 |
| 380 // FIXME: Only stereo streams are supported right now. We should be able to
accept multi-channel streams. | 380 // FIXME: Only stereo streams are supported right now. We should be able to
accept multi-channel streams. |
| 381 node->setFormat(2, sampleRate()); | 381 node->setFormat(2, sampleRate()); |
| 382 | 382 |
| 383 refNode(node.get()); // context keeps reference until node is disconnected | 383 refNode(node.get()); // context keeps reference until node is disconnected |
| 384 return node; | 384 return node; |
| 385 } | 385 } |
| 386 | 386 |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 // Avoid firing the event if the document has already gone away. | 980 // Avoid firing the event if the document has already gone away. |
| 981 if (executionContext()) { | 981 if (executionContext()) { |
| 982 // Call the offline rendering completion event listener. | 982 // Call the offline rendering completion event listener. |
| 983 dispatchEvent(OfflineAudioCompletionEvent::create(renderedBuffer)); | 983 dispatchEvent(OfflineAudioCompletionEvent::create(renderedBuffer)); |
| 984 } | 984 } |
| 985 } | 985 } |
| 986 | 986 |
| 987 } // namespace WebCore | 987 } // namespace WebCore |
| 988 | 988 |
| 989 #endif // ENABLE(WEB_AUDIO) | 989 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |