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 |
(...skipping 18 matching lines...) Expand all Loading... | |
29 class MediaStreamAudioTrackSink; | 29 class MediaStreamAudioTrackSink; |
30 class WebAudioCapturerSource; | 30 class WebAudioCapturerSource; |
31 class WebRtcAudioCapturer; | 31 class WebRtcAudioCapturer; |
32 class WebRtcLocalAudioTrackAdapter; | 32 class WebRtcLocalAudioTrackAdapter; |
33 | 33 |
34 // A WebRtcLocalAudioTrack instance contains the implementations of | 34 // A WebRtcLocalAudioTrack instance contains the implementations of |
35 // MediaStreamTrackExtraData. | 35 // MediaStreamTrackExtraData. |
36 // When an instance is created, it will register itself as a track to the | 36 // When an instance is created, it will register itself as a track to the |
37 // WebRtcAudioCapturer to get the captured data, and forward the data to | 37 // WebRtcAudioCapturer to get the captured data, and forward the data to |
38 // its |sinks_|. The data flow can be stopped by disabling the audio track. | 38 // its |sinks_|. The data flow can be stopped by disabling the audio track. |
39 class CONTENT_EXPORT WebRtcLocalAudioTrack | 39 class CONTENT_EXPORT WebRtcLocalAudioTrack |
perkj_chrome
2015/12/11 12:31:38
todo rename to match your MediaStreamRemoteAudioTr
tommi (sloooow) - chröme
2015/12/11 15:36:51
Done. (added TODO since the full separation is a l
| |
40 : NON_EXPORTED_BASE(public MediaStreamTrack) { | 40 : NON_EXPORTED_BASE(public MediaStreamAudioTrack) { |
41 public: | 41 public: |
42 WebRtcLocalAudioTrack(WebRtcLocalAudioTrackAdapter* adapter, | 42 WebRtcLocalAudioTrack(WebRtcLocalAudioTrackAdapter* adapter, |
43 const scoped_refptr<WebRtcAudioCapturer>& capturer, | 43 const scoped_refptr<WebRtcAudioCapturer>& capturer, |
44 WebAudioCapturerSource* webaudio_source); | 44 WebAudioCapturerSource* webaudio_source); |
45 | 45 |
46 ~WebRtcLocalAudioTrack() override; | 46 ~WebRtcLocalAudioTrack() override; |
47 | 47 |
48 // Add a sink to the track. This function will trigger a OnSetFormat() | 48 // Add a sink to the track. This function will trigger a OnSetFormat() |
49 // call on the |sink|. | 49 // call on the |sink|. |
50 // Called on the main render thread. | 50 // Called on the main render thread. |
51 void AddSink(MediaStreamAudioSink* sink); | 51 void AddSink(MediaStreamAudioSink* sink) override; |
52 | 52 |
53 // Remove a sink from the track. | 53 // Remove a sink from the track. |
54 // Called on the main render thread. | 54 // Called on the main render thread. |
55 void RemoveSink(MediaStreamAudioSink* sink); | 55 void RemoveSink(MediaStreamAudioSink* sink) override; |
56 | 56 |
57 // Starts the local audio track. Called on the main render thread and | 57 // Starts the local audio track. Called on the main render thread and |
58 // should be called only once when audio track is created. | 58 // should be called only once when audio track is created. |
59 void Start(); | 59 void Start(); |
60 | 60 |
61 // Overrides for MediaStreamTrack. | 61 // Overrides for MediaStreamTrack. |
62 | 62 |
63 void SetEnabled(bool enabled) override; | 63 void SetEnabled(bool enabled) override; |
64 | 64 |
65 // Stops the local audio track. Called on the main render thread and | 65 // Stops the local audio track. Called on the main render thread and |
66 // should be called only once when audio track going away. | 66 // should be called only once when audio track going away. |
67 void Stop() override; | 67 void Stop() override; |
68 | 68 |
69 webrtc::AudioTrackInterface* GetAudioAdapter() override; | 69 webrtc::AudioTrackInterface* GetAudioAdapter() override; |
70 | 70 |
71 // Returns the output format of the capture source. May return an invalid | 71 // Returns the output format of the capture source. May return an invalid |
72 // AudioParameters if the format is not yet available. | 72 // AudioParameters if the format is not yet available. |
73 // Called on the main render thread. | 73 // Called on the main render thread. |
74 media::AudioParameters GetOutputFormat() const; | 74 media::AudioParameters GetOutputFormat() const override; |
75 | 75 |
76 // Method called by the capturer to deliver the capture data. | 76 // Method called by the capturer to deliver the capture data. |
77 // Called on the capture audio thread. | 77 // Called on the capture audio thread. |
78 void Capture(const media::AudioBus& audio_bus, | 78 void Capture(const media::AudioBus& audio_bus, |
79 base::TimeTicks estimated_capture_time, | 79 base::TimeTicks estimated_capture_time, |
80 bool force_report_nonzero_energy); | 80 bool force_report_nonzero_energy); |
81 | 81 |
82 // Method called by the capturer to set the audio parameters used by source | 82 // Method called by the capturer to set the audio parameters used by source |
83 // of the capture data.. | 83 // of the capture data.. |
84 // Called on the capture audio thread. | 84 // Called on the capture audio thread. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 // Used to calculate the signal level that shows in the UI. | 125 // Used to calculate the signal level that shows in the UI. |
126 // Accessed on only the audio thread. | 126 // Accessed on only the audio thread. |
127 scoped_ptr<MediaStreamAudioLevelCalculator> level_calculator_; | 127 scoped_ptr<MediaStreamAudioLevelCalculator> level_calculator_; |
128 | 128 |
129 DISALLOW_COPY_AND_ASSIGN(WebRtcLocalAudioTrack); | 129 DISALLOW_COPY_AND_ASSIGN(WebRtcLocalAudioTrack); |
130 }; | 130 }; |
131 | 131 |
132 } // namespace content | 132 } // namespace content |
133 | 133 |
134 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_TRACK_H_ | 134 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_TRACK_H_ |
OLD | NEW |