Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: content/renderer/media/webrtc_local_audio_track.h

Issue 221863003: Notify the track before source provider goes away. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed the comments. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
18 17
19 namespace content { 18 namespace content {
20 19
21 class MediaStreamAudioLevelCalculator; 20 class MediaStreamAudioLevelCalculator;
22 class MediaStreamAudioProcessor; 21 class MediaStreamAudioProcessor;
23 class MediaStreamAudioSink; 22 class MediaStreamAudioSink;
24 class MediaStreamAudioSinkOwner; 23 class MediaStreamAudioSinkOwner;
25 class MediaStreamAudioTrackSink; 24 class MediaStreamAudioTrackSink;
26 class PeerConnectionAudioSink; 25 class PeerConnectionAudioSink;
27 class WebAudioCapturerSource; 26 class WebAudioCapturerSource;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // of the capture data.. 76 // of the capture data..
78 // Called on the capture audio thread. 77 // Called on the capture audio thread.
79 void OnSetFormat(const media::AudioParameters& params); 78 void OnSetFormat(const media::AudioParameters& params);
80 79
81 // Method called by the capturer to set the processor that applies signal 80 // Method called by the capturer to set the processor that applies signal
82 // processing on the data of the track. 81 // processing on the data of the track.
83 // Called on the capture audio thread. 82 // Called on the capture audio thread.
84 void SetAudioProcessor( 83 void SetAudioProcessor(
85 const scoped_refptr<MediaStreamAudioProcessor>& processor); 84 const scoped_refptr<MediaStreamAudioProcessor>& processor);
86 85
87 blink::WebAudioSourceProvider* audio_source_provider() const {
88 return source_provider_.get();
89 }
90
91 private: 86 private:
92 typedef TaggedList<MediaStreamAudioTrackSink> SinkList; 87 typedef TaggedList<MediaStreamAudioTrackSink> SinkList;
93 88
94 // All usage of libjingle is through this adapter. The adapter holds 89 // All usage of libjingle is through this adapter. The adapter holds
95 // a reference on this object, but not vice versa. 90 // a reference on this object, but not vice versa.
96 WebRtcLocalAudioTrackAdapter* adapter_; 91 WebRtcLocalAudioTrackAdapter* adapter_;
97 92
98 // The provider of captured data to render. 93 // The provider of captured data to render.
99 scoped_refptr<WebRtcAudioCapturer> capturer_; 94 scoped_refptr<WebRtcAudioCapturer> capturer_;
100 95
(...skipping 12 matching lines...) Expand all
113 // Used to DCHECK that some methods are called on the capture audio thread. 108 // Used to DCHECK that some methods are called on the capture audio thread.
114 base::ThreadChecker capture_thread_checker_; 109 base::ThreadChecker capture_thread_checker_;
115 110
116 // Protects |params_| and |sinks_|. 111 // Protects |params_| and |sinks_|.
117 mutable base::Lock lock_; 112 mutable base::Lock lock_;
118 113
119 // Audio parameters of the audio capture stream. 114 // Audio parameters of the audio capture stream.
120 // Accessed on only the audio capture thread. 115 // Accessed on only the audio capture thread.
121 media::AudioParameters audio_parameters_; 116 media::AudioParameters audio_parameters_;
122 117
123 // The source provider to feed the track data to other clients like
124 // WebAudio.
125 scoped_ptr<WebRtcLocalAudioSourceProvider> source_provider_;
126
127 // Used to calculate the signal level that shows in the UI. 118 // Used to calculate the signal level that shows in the UI.
128 // Accessed on only the audio thread. 119 // Accessed on only the audio thread.
129 scoped_ptr<MediaStreamAudioLevelCalculator> level_calculator_; 120 scoped_ptr<MediaStreamAudioLevelCalculator> level_calculator_;
130 121
131 DISALLOW_COPY_AND_ASSIGN(WebRtcLocalAudioTrack); 122 DISALLOW_COPY_AND_ASSIGN(WebRtcLocalAudioTrack);
132 }; 123 };
133 124
134 } // namespace content 125 } // namespace content
135 126
136 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_TRACK_H_ 127 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_TRACK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698