Chromium Code Reviews| 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 386 if (!mediaStream) { | 386 if (!mediaStream) { |
| 387 exceptionState.throwDOMException( | 387 exceptionState.throwDOMException( |
| 388 InvalidStateError, | 388 InvalidStateError, |
| 389 "invalid MediaStream source"); | 389 "invalid MediaStream source"); |
| 390 return nullptr; | 390 return nullptr; |
| 391 } | 391 } |
| 392 | 392 |
| 393 ASSERT(isMainThread()); | 393 ASSERT(isMainThread()); |
| 394 lazyInitialize(); | 394 lazyInitialize(); |
| 395 | 395 |
| 396 AudioSourceProvider* provider = 0; | |
| 397 | |
| 398 MediaStreamTrackVector audioTracks = mediaStream->getAudioTracks(); | 396 MediaStreamTrackVector audioTracks = mediaStream->getAudioTracks(); |
| 399 RefPtr<MediaStreamTrack> audioTrack; | 397 if (audioTracks.isEmpty()) { |
| 400 | 398 exceptionState.throwDOMException( |
| 401 // FIXME: get a provider for non-local MediaStreams (like from a remote peer ). | 399 InvalidStateError, |
| 402 for (size_t i = 0; i < audioTracks.size(); ++i) { | 400 "MediaStream has no audio track"); |
| 403 audioTrack = audioTracks[i]; | 401 return nullptr; |
| 404 if (audioTrack->component()->audioSourceProvider()) { | |
| 405 provider = audioTrack->component()->audioSourceProvider(); | |
| 406 break; | |
| 407 } | |
| 408 } | 402 } |
| 409 | 403 |
| 410 RefPtr<MediaStreamAudioSourceNode> node = MediaStreamAudioSourceNode::create (this, mediaStream, audioTrack.get(), provider); | 404 // Use the first audio track in the media stream. |
| 405 RefPtr<MediaStreamTrack> audioTrack = audioTracks[0]; | |
| 406 OwnPtr<AudioSourceProvider> provider = audioTrack->createWebAudioSource(); | |
|
Raymond Toy
2014/03/25 22:35:41
Are lines 405-406 here the same as the original li
no longer working on chromium
2014/03/26 13:31:11
Yes, they are the same.
Chrome guarantees that the
Raymond Toy
2014/03/26 17:04:46
Thanks for the very detailed explanation. This sou
| |
| 407 RefPtr<MediaStreamAudioSourceNode> node = MediaStreamAudioSourceNode::create (this, mediaStream, audioTrack.get(), provider.release()); | |
| 411 | 408 |
| 412 // 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. |
| 413 node->setFormat(2, sampleRate()); | 410 node->setFormat(2, sampleRate()); |
| 414 | 411 |
| 415 refNode(node.get()); // context keeps reference until node is disconnected | 412 refNode(node.get()); // context keeps reference until node is disconnected |
| 416 return node; | 413 return node; |
| 417 } | 414 } |
| 418 | 415 |
| 419 PassRefPtr<MediaStreamAudioDestinationNode> AudioContext::createMediaStreamDesti nation() | 416 PassRefPtr<MediaStreamAudioDestinationNode> AudioContext::createMediaStreamDesti nation() |
| 420 { | 417 { |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1038 } | 1035 } |
| 1039 | 1036 |
| 1040 void AudioContext::decrementActiveSourceCount() | 1037 void AudioContext::decrementActiveSourceCount() |
| 1041 { | 1038 { |
| 1042 atomicDecrement(&m_activeSourceCount); | 1039 atomicDecrement(&m_activeSourceCount); |
| 1043 } | 1040 } |
| 1044 | 1041 |
| 1045 } // namespace WebCore | 1042 } // namespace WebCore |
| 1046 | 1043 |
| 1047 #endif // ENABLE(WEB_AUDIO) | 1044 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |