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

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: rebased 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
« no previous file with comments | « content/renderer/media/webrtc_local_audio_track.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_level_calculator.h" 8 #include "content/renderer/media/media_stream_audio_level_calculator.h"
9 #include "content/renderer/media/media_stream_audio_processor.h"
9 #include "content/renderer/media/media_stream_audio_sink_owner.h" 10 #include "content/renderer/media/media_stream_audio_sink_owner.h"
10 #include "content/renderer/media/media_stream_audio_track_sink.h" 11 #include "content/renderer/media/media_stream_audio_track_sink.h"
11 #include "content/renderer/media/peer_connection_audio_sink_owner.h" 12 #include "content/renderer/media/peer_connection_audio_sink_owner.h"
12 #include "content/renderer/media/webaudio_capturer_source.h" 13 #include "content/renderer/media/webaudio_capturer_source.h"
13 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" 14 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h"
14 #include "content/renderer/media/webrtc_audio_capturer.h" 15 #include "content/renderer/media/webrtc_audio_capturer.h"
15 16
16 namespace content { 17 namespace content {
17 18
18 WebRtcLocalAudioTrack::WebRtcLocalAudioTrack( 19 WebRtcLocalAudioTrack::WebRtcLocalAudioTrack(
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 DCHECK(capture_thread_checker_.CalledOnValidThread()); 107 DCHECK(capture_thread_checker_.CalledOnValidThread());
107 108
108 audio_parameters_ = params; 109 audio_parameters_ = params;
109 level_calculator_.reset(new MediaStreamAudioLevelCalculator()); 110 level_calculator_.reset(new MediaStreamAudioLevelCalculator());
110 111
111 base::AutoLock auto_lock(lock_); 112 base::AutoLock auto_lock(lock_);
112 // Remember to notify all sinks of the new format. 113 // Remember to notify all sinks of the new format.
113 sinks_.TagAll(); 114 sinks_.TagAll();
114 } 115 }
115 116
117 void WebRtcLocalAudioTrack::SetAudioProcessor(
118 const scoped_refptr<MediaStreamAudioProcessor>& processor) {
119 // if the |processor| does not have audio processing, which can happen if
120 // kEnableAudioTrackProcessing is not set or all the constraints in
121 // the |processor| are turned off. In such case, we pass NULL to the
122 // adapter to indicate that no stats can be gotten from the processor.
123 adapter_->SetAudioProcessor(processor->has_audio_processing() ?
124 processor : NULL);
125 }
126
116 void WebRtcLocalAudioTrack::AddSink(MediaStreamAudioSink* sink) { 127 void WebRtcLocalAudioTrack::AddSink(MediaStreamAudioSink* sink) {
117 DCHECK(main_render_thread_checker_.CalledOnValidThread()); 128 DCHECK(main_render_thread_checker_.CalledOnValidThread());
118 DVLOG(1) << "WebRtcLocalAudioTrack::AddSink()"; 129 DVLOG(1) << "WebRtcLocalAudioTrack::AddSink()";
119 base::AutoLock auto_lock(lock_); 130 base::AutoLock auto_lock(lock_);
120 131
121 // Verify that |sink| is not already added to the list. 132 // Verify that |sink| is not already added to the list.
122 DCHECK(!sinks_.Contains( 133 DCHECK(!sinks_.Contains(
123 MediaStreamAudioTrackSink::WrapsMediaStreamSink(sink))); 134 MediaStreamAudioTrackSink::WrapsMediaStreamSink(sink)));
124 135
125 // Create (and add to the list) a new MediaStreamAudioTrackSink 136 // Create (and add to the list) a new MediaStreamAudioTrackSink
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 246
236 for (SinkList::ItemList::const_iterator it = sinks.begin(); 247 for (SinkList::ItemList::const_iterator it = sinks.begin();
237 it != sinks.end(); 248 it != sinks.end();
238 ++it){ 249 ++it){
239 (*it)->OnReadyStateChanged(blink::WebMediaStreamSource::ReadyStateEnded); 250 (*it)->OnReadyStateChanged(blink::WebMediaStreamSource::ReadyStateEnded);
240 (*it)->Reset(); 251 (*it)->Reset();
241 } 252 }
242 } 253 }
243 254
244 } // namespace content 255 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc_local_audio_track.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698