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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 | 387 |
388 MediaStreamTrackVector audioTracks = mediaStream->getAudioTracks(); | 388 MediaStreamTrackVector audioTracks = mediaStream->getAudioTracks(); |
389 if (audioTracks.isEmpty()) { | 389 if (audioTracks.isEmpty()) { |
390 exceptionState.throwDOMException( | 390 exceptionState.throwDOMException( |
391 InvalidStateError, | 391 InvalidStateError, |
392 "MediaStream has no audio track"); | 392 "MediaStream has no audio track"); |
393 return nullptr; | 393 return nullptr; |
394 } | 394 } |
395 | 395 |
396 // Use the first audio track in the media stream. | 396 // Use the first audio track in the media stream. |
397 RefPtr<MediaStreamTrack> audioTrack = audioTracks[0]; | 397 RefPtrWillBeRawPtr<MediaStreamTrack> audioTrack = audioTracks[0]; |
398 OwnPtr<AudioSourceProvider> provider = audioTrack->createWebAudioSource(); | 398 OwnPtr<AudioSourceProvider> provider = audioTrack->createWebAudioSource(); |
399 RefPtr<MediaStreamAudioSourceNode> node = MediaStreamAudioSourceNode::create
(this, mediaStream, audioTrack.get(), provider.release()); | 399 RefPtr<MediaStreamAudioSourceNode> node = MediaStreamAudioSourceNode::create
(this, mediaStream, audioTrack.get(), provider.release()); |
400 | 400 |
401 // FIXME: Only stereo streams are supported right now. We should be able to
accept multi-channel streams. | 401 // FIXME: Only stereo streams are supported right now. We should be able to
accept multi-channel streams. |
402 node->setFormat(2, sampleRate()); | 402 node->setFormat(2, sampleRate()); |
403 | 403 |
404 refNode(node.get()); // context keeps reference until node is disconnected | 404 refNode(node.get()); // context keeps reference until node is disconnected |
405 return node; | 405 return node; |
406 } | 406 } |
407 | 407 |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 // Avoid firing the event if the document has already gone away. | 1001 // Avoid firing the event if the document has already gone away. |
1002 if (executionContext()) { | 1002 if (executionContext()) { |
1003 // Call the offline rendering completion event listener. | 1003 // Call the offline rendering completion event listener. |
1004 dispatchEvent(OfflineAudioCompletionEvent::create(renderedBuffer)); | 1004 dispatchEvent(OfflineAudioCompletionEvent::create(renderedBuffer)); |
1005 } | 1005 } |
1006 } | 1006 } |
1007 | 1007 |
1008 } // namespace WebCore | 1008 } // namespace WebCore |
1009 | 1009 |
1010 #endif // ENABLE(WEB_AUDIO) | 1010 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |