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

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

Issue 185413009: Implements the GetSignalLevel and GetStats interface for the local audio track. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "content/renderer/media/webrtc_local_audio_track.h" 5 #include "content/renderer/media/webrtc_local_audio_track.h"
6 6
7 #include "content/public/renderer/media_stream_audio_sink.h" 7 #include "content/public/renderer/media_stream_audio_sink.h"
8 #include "content/renderer/media/media_stream_audio_processor.h"
8 #include "content/renderer/media/media_stream_audio_sink_owner.h" 9 #include "content/renderer/media/media_stream_audio_sink_owner.h"
9 #include "content/renderer/media/media_stream_audio_track_sink.h" 10 #include "content/renderer/media/media_stream_audio_track_sink.h"
10 #include "content/renderer/media/peer_connection_audio_sink_owner.h" 11 #include "content/renderer/media/peer_connection_audio_sink_owner.h"
11 #include "content/renderer/media/webaudio_capturer_source.h" 12 #include "content/renderer/media/webaudio_capturer_source.h"
12 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" 13 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h"
13 #include "content/renderer/media/webrtc_audio_capturer.h" 14 #include "content/renderer/media/webrtc_audio_capturer.h"
14 15
15 namespace content { 16 namespace content {
16 17
17 WebRtcLocalAudioTrack::WebRtcLocalAudioTrack( 18 WebRtcLocalAudioTrack::WebRtcLocalAudioTrack(
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 capture_thread_checker_.DetachFromThread(); 98 capture_thread_checker_.DetachFromThread();
98 DCHECK(capture_thread_checker_.CalledOnValidThread()); 99 DCHECK(capture_thread_checker_.CalledOnValidThread());
99 100
100 audio_parameters_ = params; 101 audio_parameters_ = params;
101 102
102 base::AutoLock auto_lock(lock_); 103 base::AutoLock auto_lock(lock_);
103 // Remember to notify all sinks of the new format. 104 // Remember to notify all sinks of the new format.
104 sinks_.TagAll(); 105 sinks_.TagAll();
105 } 106 }
106 107
108 void WebRtcLocalAudioTrack::SetAudioProcessor(
109 const scoped_refptr<MediaStreamAudioProcessor>& processor) {
110 // if the |processor| does not have the audio processing, which can happen if
tommi (sloooow) - chröme 2014/03/03 15:25:18 does not have audio processing
no longer working on chromium 2014/03/04 15:48:59 Done.
111 // the kEnableAudioTrackProcessing is not set or all the constraints in
tommi (sloooow) - chröme 2014/03/03 15:25:18 s/the kEnableAudioTrackProcessing/kEnableAudioTrac
no longer working on chromium 2014/03/04 15:48:59 Done.
112 // the |processor| are turned off. In such case, we pass a NULL to the
tommi (sloooow) - chröme 2014/03/03 15:25:18 In such a case, we pass NULL to the
no longer working on chromium 2014/03/04 15:48:59 Done.
113 // adapter to indicate that no stats can be got from the processor.
tommi (sloooow) - chröme 2014/03/03 15:25:18 can be gotten
no longer working on chromium 2014/03/04 15:48:59 Done.
114 if (processor->has_audio_processing())
115 adapter_->SetAudioProcessor(processor.get());
116 else
117 adapter_->SetAudioProcessor(NULL);
118 }
119
107 void WebRtcLocalAudioTrack::AddSink(MediaStreamAudioSink* sink) { 120 void WebRtcLocalAudioTrack::AddSink(MediaStreamAudioSink* sink) {
108 DCHECK(main_render_thread_checker_.CalledOnValidThread()); 121 DCHECK(main_render_thread_checker_.CalledOnValidThread());
109 DVLOG(1) << "WebRtcLocalAudioTrack::AddSink()"; 122 DVLOG(1) << "WebRtcLocalAudioTrack::AddSink()";
110 base::AutoLock auto_lock(lock_); 123 base::AutoLock auto_lock(lock_);
111 124
112 // Verify that |sink| is not already added to the list. 125 // Verify that |sink| is not already added to the list.
113 DCHECK(!sinks_.Contains( 126 DCHECK(!sinks_.Contains(
114 MediaStreamAudioTrackSink::WrapsMediaStreamSink(sink))); 127 MediaStreamAudioTrackSink::WrapsMediaStreamSink(sink)));
115 128
116 // Create (and add to the list) a new MediaStreamAudioTrackSink 129 // Create (and add to the list) a new MediaStreamAudioTrackSink
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 239
227 for (SinkList::ItemList::const_iterator it = sinks.begin(); 240 for (SinkList::ItemList::const_iterator it = sinks.begin();
228 it != sinks.end(); 241 it != sinks.end();
229 ++it){ 242 ++it){
230 (*it)->OnReadyStateChanged(blink::WebMediaStreamSource::ReadyStateEnded); 243 (*it)->OnReadyStateChanged(blink::WebMediaStreamSource::ReadyStateEnded);
231 (*it)->Reset(); 244 (*it)->Reset();
232 } 245 }
233 } 246 }
234 247
235 } // namespace content 248 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698