| 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 MediaStreamAudioLevelCalculator; | 21 class MediaStreamAudioLevelCalculator; |
| 22 class MediaStreamAudioProcessor; |
| 22 class MediaStreamAudioSink; | 23 class MediaStreamAudioSink; |
| 23 class MediaStreamAudioSinkOwner; | 24 class MediaStreamAudioSinkOwner; |
| 24 class MediaStreamAudioTrackSink; | 25 class MediaStreamAudioTrackSink; |
| 25 class PeerConnectionAudioSink; | 26 class PeerConnectionAudioSink; |
| 26 class WebAudioCapturerSource; | 27 class WebAudioCapturerSource; |
| 27 class WebRtcAudioCapturer; | 28 class WebRtcAudioCapturer; |
| 28 class WebRtcLocalAudioTrackAdapter; | 29 class WebRtcLocalAudioTrackAdapter; |
| 29 | 30 |
| 30 // A WebRtcLocalAudioTrack instance contains the implementations of | 31 // A WebRtcLocalAudioTrack instance contains the implementations of |
| 31 // MediaStreamTrackExtraData. | 32 // MediaStreamTrackExtraData. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 58 | 59 |
| 59 // Starts the local audio track. Called on the main render thread and | 60 // Starts the local audio track. Called on the main render thread and |
| 60 // should be called only once when audio track is created. | 61 // should be called only once when audio track is created. |
| 61 void Start(); | 62 void Start(); |
| 62 | 63 |
| 63 // Stops the local audio track. Called on the main render thread and | 64 // Stops the local audio track. Called on the main render thread and |
| 64 // should be called only once when audio track going away. | 65 // should be called only once when audio track going away. |
| 65 void Stop(); | 66 void Stop(); |
| 66 | 67 |
| 67 // Method called by the capturer to deliver the capture data. | 68 // Method called by the capturer to deliver the capture data. |
| 68 // Call on the capture audio thread. | 69 // Called on the capture audio thread. |
| 69 void Capture(const int16* audio_data, | 70 void Capture(const int16* audio_data, |
| 70 base::TimeDelta delay, | 71 base::TimeDelta delay, |
| 71 int volume, | 72 int volume, |
| 72 bool key_pressed, | 73 bool key_pressed, |
| 73 bool need_audio_processing); | 74 bool need_audio_processing); |
| 74 | 75 |
| 75 // Method called by the capturer to set the audio parameters used by source | 76 // Method called by the capturer to set the audio parameters used by source |
| 76 // of the capture data.. | 77 // of the capture data.. |
| 77 // Call on the capture audio thread. | 78 // Called on the capture audio thread. |
| 78 void OnSetFormat(const media::AudioParameters& params); | 79 void OnSetFormat(const media::AudioParameters& params); |
| 79 | 80 |
| 81 // Method called by the capturer to set the processor that applies signal |
| 82 // processing on the data of the track. |
| 83 // Called on the capture audio thread. |
| 84 void SetAudioProcessor( |
| 85 const scoped_refptr<MediaStreamAudioProcessor>& processor); |
| 86 |
| 80 blink::WebAudioSourceProvider* audio_source_provider() const { | 87 blink::WebAudioSourceProvider* audio_source_provider() const { |
| 81 return source_provider_.get(); | 88 return source_provider_.get(); |
| 82 } | 89 } |
| 83 | 90 |
| 84 private: | 91 private: |
| 85 typedef TaggedList<MediaStreamAudioTrackSink> SinkList; | 92 typedef TaggedList<MediaStreamAudioTrackSink> SinkList; |
| 86 | 93 |
| 87 // All usage of libjingle is through this adapter. The adapter holds | 94 // All usage of libjingle is through this adapter. The adapter holds |
| 88 // a reference on this object, but not vice versa. | 95 // a reference on this object, but not vice versa. |
| 89 WebRtcLocalAudioTrackAdapter* adapter_; | 96 WebRtcLocalAudioTrackAdapter* adapter_; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 120 // Used to calculate the signal level that shows in the UI. | 127 // Used to calculate the signal level that shows in the UI. |
| 121 // Accessed on only the audio thread. | 128 // Accessed on only the audio thread. |
| 122 scoped_ptr<MediaStreamAudioLevelCalculator> level_calculator_; | 129 scoped_ptr<MediaStreamAudioLevelCalculator> level_calculator_; |
| 123 | 130 |
| 124 DISALLOW_COPY_AND_ASSIGN(WebRtcLocalAudioTrack); | 131 DISALLOW_COPY_AND_ASSIGN(WebRtcLocalAudioTrack); |
| 125 }; | 132 }; |
| 126 | 133 |
| 127 } // namespace content | 134 } // namespace content |
| 128 | 135 |
| 129 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_TRACK_H_ | 136 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_TRACK_H_ |
| OLD | NEW |