OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/media/media_stream_dependency_factory.h" | 5 #include "content/renderer/media/media_stream_dependency_factory.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 // TODO(xians): Merge |source| to the capturer(). We can't do this today | 560 // TODO(xians): Merge |source| to the capturer(). We can't do this today |
561 // because only one capturer() is supported while one |source| is created | 561 // because only one capturer() is supported while one |source| is created |
562 // for each audio track. | 562 // for each audio track. |
563 scoped_ptr<WebRtcLocalAudioTrack> audio_track( | 563 scoped_ptr<WebRtcLocalAudioTrack> audio_track( |
564 new WebRtcLocalAudioTrack(adapter, | 564 new WebRtcLocalAudioTrack(adapter, |
565 source_data->GetAudioCapturer(), | 565 source_data->GetAudioCapturer(), |
566 webaudio_source)); | 566 webaudio_source)); |
567 | 567 |
568 StartLocalAudioTrack(audio_track.get()); | 568 StartLocalAudioTrack(audio_track.get()); |
569 | 569 |
570 // Pass the pointer of the source provider to the blink audio track. | 570 // Pass the ownership of the native local audio track to the blink track. |
571 blink::WebMediaStreamTrack writable_track = track; | 571 blink::WebMediaStreamTrack writable_track = track; |
572 writable_track.setSourceProvider(audio_track->audio_source_provider()); | |
573 | |
574 // Pass the ownership of the native local audio track to the blink track. | |
575 writable_track.setExtraData(audio_track.release()); | 572 writable_track.setExtraData(audio_track.release()); |
576 } | 573 } |
577 | 574 |
578 void MediaStreamDependencyFactory::StartLocalAudioTrack( | 575 void MediaStreamDependencyFactory::StartLocalAudioTrack( |
579 WebRtcLocalAudioTrack* audio_track) { | 576 WebRtcLocalAudioTrack* audio_track) { |
580 // Add the WebRtcAudioDevice as the sink to the local audio track. | 577 // Add the WebRtcAudioDevice as the sink to the local audio track. |
581 // TODO(xians): Implement a PeerConnection sink adapter and remove this | 578 // TODO(xians): Implement a PeerConnection sink adapter and remove this |
582 // AddSink() call. | 579 // AddSink() call. |
583 audio_track->AddSink(GetWebRtcAudioDevice()); | 580 audio_track->AddSink(GetWebRtcAudioDevice()); |
584 // Start the audio track. This will hook the |audio_track| to the capturer | 581 // Start the audio track. This will hook the |audio_track| to the capturer |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 } | 789 } |
793 | 790 |
794 void MediaStreamDependencyFactory::EnsureWebRtcAudioDeviceImpl() { | 791 void MediaStreamDependencyFactory::EnsureWebRtcAudioDeviceImpl() { |
795 if (audio_device_) | 792 if (audio_device_) |
796 return; | 793 return; |
797 | 794 |
798 audio_device_ = new WebRtcAudioDeviceImpl(); | 795 audio_device_ = new WebRtcAudioDeviceImpl(); |
799 } | 796 } |
800 | 797 |
801 } // namespace content | 798 } // namespace content |
OLD | NEW |