Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_WEBRTC_LOCAL_AUDIO_TRACK_ADAPTER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_LOCAL_AUDIO_TRACK_ADAPTER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_LOCAL_AUDIO_TRACK_ADAPTER_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_LOCAL_AUDIO_TRACK_ADAPTER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
| 12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "third_party/libjingle/source/talk/app/webrtc/mediastreamtrack.h" | 14 #include "third_party/libjingle/source/talk/app/webrtc/mediastreamtrack.h" |
| 15 #include "third_party/libjingle/source/talk/media/base/audiorenderer.h" | 15 #include "third_party/libjingle/source/talk/media/base/audiorenderer.h" |
| 16 | 16 |
| 17 namespace cricket { | 17 namespace cricket { |
| 18 class AudioRenderer; | 18 class AudioRenderer; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace webrtc { | 21 namespace webrtc { |
| 22 class AudioSourceInterface; | 22 class AudioSourceInterface; |
| 23 class AudioProcessorInterface; | |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace content { | 26 namespace content { |
| 26 | 27 |
| 27 class WebRtcAudioSinkAdapter; | 28 class WebRtcAudioSinkAdapter; |
| 28 class WebRtcLocalAudioTrack; | 29 class WebRtcLocalAudioTrack; |
| 29 | 30 |
| 30 class CONTENT_EXPORT WebRtcLocalAudioTrackAdapter | 31 class CONTENT_EXPORT WebRtcLocalAudioTrackAdapter |
| 31 : NON_EXPORTED_BASE(public cricket::AudioRenderer), | 32 : NON_EXPORTED_BASE(public cricket::AudioRenderer), |
| 32 NON_EXPORTED_BASE( | 33 NON_EXPORTED_BASE( |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 43 virtual ~WebRtcLocalAudioTrackAdapter(); | 44 virtual ~WebRtcLocalAudioTrackAdapter(); |
| 44 | 45 |
| 45 void Initialize(WebRtcLocalAudioTrack* owner); | 46 void Initialize(WebRtcLocalAudioTrack* owner); |
| 46 | 47 |
| 47 std::vector<int> VoeChannels() const; | 48 std::vector<int> VoeChannels() const; |
| 48 | 49 |
| 49 // Called on the audio thread by the WebRtcLocalAudioTrack to set the signal | 50 // Called on the audio thread by the WebRtcLocalAudioTrack to set the signal |
| 50 // level of the audio data. | 51 // level of the audio data. |
| 51 void SetSignalLevel(int signal_level); | 52 void SetSignalLevel(int signal_level); |
| 52 | 53 |
| 54 // Method called by the WebRtcLocalAudioTrack to set the processor that | |
| 55 // applies signal processing on the data of the track. | |
| 56 // This class will keep a reference of the |processor|. | |
| 57 // Called on the main render thread. | |
| 58 void SetAudioProcessor( | |
| 59 talk_base::scoped_refptr<webrtc::AudioProcessorInterface> processor); | |
|
tommi (sloooow) - chröme
2014/03/04 17:33:54
do we need to use talk_base::scoped_refptr here?
I
no longer working on chromium
2014/03/04 18:54:07
Done.
Actually it is not a problem since adapter
| |
| 60 | |
| 53 private: | 61 private: |
| 54 // webrtc::MediaStreamTrack implementation. | 62 // webrtc::MediaStreamTrack implementation. |
| 55 virtual std::string kind() const OVERRIDE; | 63 virtual std::string kind() const OVERRIDE; |
| 56 | 64 |
| 57 // webrtc::AudioTrackInterface implementation. | 65 // webrtc::AudioTrackInterface implementation. |
| 58 virtual void AddSink(webrtc::AudioTrackSinkInterface* sink) OVERRIDE; | 66 virtual void AddSink(webrtc::AudioTrackSinkInterface* sink) OVERRIDE; |
| 59 virtual void RemoveSink(webrtc::AudioTrackSinkInterface* sink) OVERRIDE; | 67 virtual void RemoveSink(webrtc::AudioTrackSinkInterface* sink) OVERRIDE; |
| 68 virtual bool GetSignalLevel(int* level) OVERRIDE; | |
| 69 virtual talk_base::scoped_refptr<webrtc::AudioProcessorInterface> | |
| 70 GetAudioProcessor() OVERRIDE; | |
| 60 | 71 |
| 61 // cricket::AudioCapturer implementation. | 72 // cricket::AudioCapturer implementation. |
| 62 virtual void AddChannel(int channel_id) OVERRIDE; | 73 virtual void AddChannel(int channel_id) OVERRIDE; |
| 63 virtual void RemoveChannel(int channel_id) OVERRIDE; | 74 virtual void RemoveChannel(int channel_id) OVERRIDE; |
| 64 | 75 |
| 65 // webrtc::AudioTrackInterface implementation. | 76 // webrtc::AudioTrackInterface implementation. |
| 66 virtual webrtc::AudioSourceInterface* GetSource() const OVERRIDE; | 77 virtual webrtc::AudioSourceInterface* GetSource() const OVERRIDE; |
| 67 virtual cricket::AudioRenderer* GetRenderer() OVERRIDE; | 78 virtual cricket::AudioRenderer* GetRenderer() OVERRIDE; |
| 68 | 79 |
| 69 // Weak reference. | 80 // Weak reference. |
| 70 WebRtcLocalAudioTrack* owner_; | 81 WebRtcLocalAudioTrack* owner_; |
| 71 | 82 |
| 72 // The source of the audio track which handles the audio constraints. | 83 // The source of the audio track which handles the audio constraints. |
| 73 // TODO(xians): merge |track_source_| to |capturer_| in WebRtcLocalAudioTrack. | 84 // TODO(xians): merge |track_source_| to |capturer_| in WebRtcLocalAudioTrack. |
| 74 talk_base::scoped_refptr<webrtc::AudioSourceInterface> track_source_; | 85 talk_base::scoped_refptr<webrtc::AudioSourceInterface> track_source_; |
| 75 | 86 |
| 87 // The audio processsor that applies audio processing on the data of audio | |
| 88 // track. | |
| 89 talk_base::scoped_refptr<webrtc::AudioProcessorInterface> audio_processor_; | |
|
tommi (sloooow) - chröme
2014/03/04 17:33:54
scoped_refptr here as well
no longer working on chromium
2014/03/04 18:54:07
Done.
| |
| 90 | |
| 76 // A vector of WebRtc VoE channels that the capturer sends data to. | 91 // A vector of WebRtc VoE channels that the capturer sends data to. |
| 77 std::vector<int> voe_channels_; | 92 std::vector<int> voe_channels_; |
| 78 | 93 |
| 79 // A vector of the peer connection sink adapters which receive the audio data | 94 // A vector of the peer connection sink adapters which receive the audio data |
| 80 // from the audio track. | 95 // from the audio track. |
| 81 ScopedVector<WebRtcAudioSinkAdapter> sink_adapters_; | 96 ScopedVector<WebRtcAudioSinkAdapter> sink_adapters_; |
| 82 | 97 |
| 83 // Protects |voe_channels_|. | 98 // The amplitude of the signal. |
| 99 int signal_level_; | |
| 100 | |
| 101 // Protects |voe_channels_|, |audio_processor_| and |signal_level_|. | |
| 84 mutable base::Lock lock_; | 102 mutable base::Lock lock_; |
| 85 }; | 103 }; |
| 86 | 104 |
| 87 } // namespace content | 105 } // namespace content |
| 88 | 106 |
| 89 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_LOCAL_AUDIO_TRACK_ADAPTER_H_ | 107 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_LOCAL_AUDIO_TRACK_ADAPTER_H_ |
| OLD | NEW |