| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_TRACK_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_TRACK_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_TRACK_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_TRACK_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
| 13 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
| 14 #include "content/renderer/media/media_stream_track.h" | 14 #include "content/renderer/media/media_stream_track.h" |
| 15 #include "content/renderer/media/tagged_list.h" | 15 #include "content/renderer/media/tagged_list.h" |
| 16 #include "content/renderer/media/webrtc_audio_device_impl.h" | 16 #include "content/renderer/media/webrtc_audio_device_impl.h" |
| 17 #include "content/renderer/media/webrtc_local_audio_source_provider.h" | 17 #include "content/renderer/media/webrtc_local_audio_source_provider.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 | 20 |
| 21 class MediaStreamAudioProcessor; |
| 21 class MediaStreamAudioSink; | 22 class MediaStreamAudioSink; |
| 22 class MediaStreamAudioSinkOwner; | 23 class MediaStreamAudioSinkOwner; |
| 23 class MediaStreamAudioTrackSink; | 24 class MediaStreamAudioTrackSink; |
| 24 class PeerConnectionAudioSink; | 25 class PeerConnectionAudioSink; |
| 25 class WebAudioCapturerSource; | 26 class WebAudioCapturerSource; |
| 26 class WebRtcAudioCapturer; | 27 class WebRtcAudioCapturer; |
| 27 class WebRtcLocalAudioTrackAdapter; | 28 class WebRtcLocalAudioTrackAdapter; |
| 28 | 29 |
| 29 // A WebRtcLocalAudioTrack instance contains the implementations of | 30 // A WebRtcLocalAudioTrack instance contains the implementations of |
| 30 // MediaStreamTrackExtraData. | 31 // MediaStreamTrackExtraData. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 57 | 58 |
| 58 // Starts the local audio track. Called on the main render thread and | 59 // Starts the local audio track. Called on the main render thread and |
| 59 // should be called only once when audio track is created. | 60 // should be called only once when audio track is created. |
| 60 void Start(); | 61 void Start(); |
| 61 | 62 |
| 62 // Stops the local audio track. Called on the main render thread and | 63 // Stops the local audio track. Called on the main render thread and |
| 63 // should be called only once when audio track going away. | 64 // should be called only once when audio track going away. |
| 64 void Stop(); | 65 void Stop(); |
| 65 | 66 |
| 66 // Method called by the capturer to deliver the capture data. | 67 // Method called by the capturer to deliver the capture data. |
| 67 // Call on the capture audio thread. | 68 // Called on the capture audio thread. |
| 68 void Capture(const int16* audio_data, | 69 void Capture(const int16* audio_data, |
| 69 base::TimeDelta delay, | 70 base::TimeDelta delay, |
| 70 int volume, | 71 int volume, |
| 71 bool key_pressed, | 72 bool key_pressed, |
| 72 bool need_audio_processing); | 73 bool need_audio_processing); |
| 73 | 74 |
| 74 // Method called by the capturer to set the audio parameters used by source | 75 // Method called by the capturer to set the audio parameters used by source |
| 75 // of the capture data.. | 76 // of the capture data.. |
| 76 // Call on the capture audio thread. | 77 // Called on the capture audio thread. |
| 77 void OnSetFormat(const media::AudioParameters& params); | 78 void OnSetFormat(const media::AudioParameters& params); |
| 78 | 79 |
| 80 // Method called by the capturer to set the processor that applies signal |
| 81 // processing on the data of the track. |
| 82 // Called on the capture audio thread. |
| 83 void SetAudioProcessor( |
| 84 const scoped_refptr<MediaStreamAudioProcessor>& processor); |
| 85 |
| 79 blink::WebAudioSourceProvider* audio_source_provider() const { | 86 blink::WebAudioSourceProvider* audio_source_provider() const { |
| 80 return source_provider_.get(); | 87 return source_provider_.get(); |
| 81 } | 88 } |
| 82 | 89 |
| 83 private: | 90 private: |
| 84 typedef TaggedList<MediaStreamAudioTrackSink> SinkList; | 91 typedef TaggedList<MediaStreamAudioTrackSink> SinkList; |
| 85 | 92 |
| 86 // All usage of libjingle is through this adapter. The adapter holds | 93 // All usage of libjingle is through this adapter. The adapter holds |
| 87 // a reference on this object, but not vice versa. | 94 // a reference on this object, but not vice versa. |
| 88 WebRtcLocalAudioTrackAdapter* adapter_; | 95 WebRtcLocalAudioTrackAdapter* adapter_; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 115 // The source provider to feed the track data to other clients like | 122 // The source provider to feed the track data to other clients like |
| 116 // WebAudio. | 123 // WebAudio. |
| 117 scoped_ptr<WebRtcLocalAudioSourceProvider> source_provider_; | 124 scoped_ptr<WebRtcLocalAudioSourceProvider> source_provider_; |
| 118 | 125 |
| 119 DISALLOW_COPY_AND_ASSIGN(WebRtcLocalAudioTrack); | 126 DISALLOW_COPY_AND_ASSIGN(WebRtcLocalAudioTrack); |
| 120 }; | 127 }; |
| 121 | 128 |
| 122 } // namespace content | 129 } // namespace content |
| 123 | 130 |
| 124 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_TRACK_H_ | 131 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_TRACK_H_ |
| OLD | NEW |