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

Side by Side Diff: content/renderer/media/webrtc/webrtc_local_audio_track_adapter.cc

Issue 178223013: Calculate the signal level on the media stream local audio track (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: ready for review. Created 6 years, 10 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 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 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" 5 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/renderer/media/webrtc_local_audio_track.h" 8 #include "content/renderer/media/webrtc_local_audio_track.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 static const char kAudioTrackKind[] = "audio"; 12 static const char kAudioTrackKind[] = "audio";
13 13
14 scoped_refptr<WebRtcLocalAudioTrackAdapter> 14 scoped_refptr<WebRtcLocalAudioTrackAdapter>
15 WebRtcLocalAudioTrackAdapter::Create( 15 WebRtcLocalAudioTrackAdapter::Create(
16 const std::string& label, 16 const std::string& label,
17 webrtc::AudioSourceInterface* track_source) { 17 webrtc::AudioSourceInterface* track_source) {
18 talk_base::RefCountedObject<WebRtcLocalAudioTrackAdapter>* adapter = 18 talk_base::RefCountedObject<WebRtcLocalAudioTrackAdapter>* adapter =
19 new talk_base::RefCountedObject<WebRtcLocalAudioTrackAdapter>( 19 new talk_base::RefCountedObject<WebRtcLocalAudioTrackAdapter>(
20 label, track_source); 20 label, track_source);
21 return adapter; 21 return adapter;
22 } 22 }
23 23
24 WebRtcLocalAudioTrackAdapter::WebRtcLocalAudioTrackAdapter( 24 WebRtcLocalAudioTrackAdapter::WebRtcLocalAudioTrackAdapter(
25 const std::string& label, 25 const std::string& label,
26 webrtc::AudioSourceInterface* track_source) 26 webrtc::AudioSourceInterface* track_source)
27 : webrtc::MediaStreamTrack<webrtc::AudioTrackInterface>(label), 27 : webrtc::MediaStreamTrack<webrtc::AudioTrackInterface>(label),
28 owner_(NULL), 28 owner_(NULL),
29 track_source_(track_source) { 29 track_source_(track_source),
30 signal_level_(0) {
30 } 31 }
31 32
32 WebRtcLocalAudioTrackAdapter::~WebRtcLocalAudioTrackAdapter() { 33 WebRtcLocalAudioTrackAdapter::~WebRtcLocalAudioTrackAdapter() {
33 } 34 }
34 35
35 void WebRtcLocalAudioTrackAdapter::Initialize(WebRtcLocalAudioTrack* owner) { 36 void WebRtcLocalAudioTrackAdapter::Initialize(WebRtcLocalAudioTrack* owner) {
36 DCHECK(!owner_); 37 DCHECK(!owner_);
37 DCHECK(owner); 38 DCHECK(owner);
38 owner_ = owner; 39 owner_ = owner;
39 } 40 }
40 41
41 std::string WebRtcLocalAudioTrackAdapter::kind() const { 42 std::string WebRtcLocalAudioTrackAdapter::kind() const {
42 return kAudioTrackKind; 43 return kAudioTrackKind;
43 } 44 }
44 45
45 std::vector<int> WebRtcLocalAudioTrackAdapter::VoeChannels() const { 46 std::vector<int> WebRtcLocalAudioTrackAdapter::VoeChannels() const {
46 base::AutoLock auto_lock(lock_); 47 base::AutoLock auto_lock(lock_);
47 return voe_channels_; 48 return voe_channels_;
48 } 49 }
49 50
51 void WebRtcLocalAudioTrackAdapter::SetSignalLevel(int signal_level) {
tommi (sloooow) - chröme 2014/02/27 08:39:43 document on which thread this is called?
no longer working on chromium 2014/02/28 08:16:25 Done with adding a comment in the header file.
52 base::AutoLock auto_lock(lock_);
53 signal_level_ = signal_level;
54 }
55
50 void WebRtcLocalAudioTrackAdapter::AddChannel(int channel_id) { 56 void WebRtcLocalAudioTrackAdapter::AddChannel(int channel_id) {
51 DVLOG(1) << "WebRtcLocalAudioTrack::AddChannel(channel_id=" 57 DVLOG(1) << "WebRtcLocalAudioTrack::AddChannel(channel_id="
52 << channel_id << ")"; 58 << channel_id << ")";
53 base::AutoLock auto_lock(lock_); 59 base::AutoLock auto_lock(lock_);
54 if (std::find(voe_channels_.begin(), voe_channels_.end(), channel_id) != 60 if (std::find(voe_channels_.begin(), voe_channels_.end(), channel_id) !=
55 voe_channels_.end()) { 61 voe_channels_.end()) {
56 // We need to handle the case when the same channel is connected to the 62 // We need to handle the case when the same channel is connected to the
57 // track more than once. 63 // track more than once.
58 return; 64 return;
59 } 65 }
(...skipping 13 matching lines...) Expand all
73 79
74 webrtc::AudioSourceInterface* WebRtcLocalAudioTrackAdapter::GetSource() const { 80 webrtc::AudioSourceInterface* WebRtcLocalAudioTrackAdapter::GetSource() const {
75 return track_source_; 81 return track_source_;
76 } 82 }
77 83
78 cricket::AudioRenderer* WebRtcLocalAudioTrackAdapter::GetRenderer() { 84 cricket::AudioRenderer* WebRtcLocalAudioTrackAdapter::GetRenderer() {
79 return this; 85 return this;
80 } 86 }
81 87
82 } // namespace content 88 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698