OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 AudioMonitor::~AudioMonitor() { | 29 AudioMonitor::~AudioMonitor() { |
30 voice_channel_->worker_thread()->Clear(this); | 30 voice_channel_->worker_thread()->Clear(this); |
31 monitoring_thread_->Clear(this); | 31 monitoring_thread_->Clear(this); |
32 } | 32 } |
33 | 33 |
34 void AudioMonitor::Start(int milliseconds) { | 34 void AudioMonitor::Start(int milliseconds) { |
35 rate_ = milliseconds; | 35 rate_ = milliseconds; |
36 if (rate_ < 100) | 36 if (rate_ < 100) |
37 rate_ = 100; | 37 rate_ = 100; |
38 voice_channel_->worker_thread()->Post(this, MSG_MONITOR_START); | 38 voice_channel_->worker_thread()->Post(RTC_FROM_HERE, this, MSG_MONITOR_START); |
39 } | 39 } |
40 | 40 |
41 void AudioMonitor::Stop() { | 41 void AudioMonitor::Stop() { |
42 voice_channel_->worker_thread()->Post(this, MSG_MONITOR_STOP); | 42 voice_channel_->worker_thread()->Post(RTC_FROM_HERE, this, MSG_MONITOR_STOP); |
43 } | 43 } |
44 | 44 |
45 void AudioMonitor::OnMessage(rtc::Message *message) { | 45 void AudioMonitor::OnMessage(rtc::Message *message) { |
46 rtc::CritScope cs(&crit_); | 46 rtc::CritScope cs(&crit_); |
47 | 47 |
48 switch (message->message_id) { | 48 switch (message->message_id) { |
49 case MSG_MONITOR_START: | 49 case MSG_MONITOR_START: |
50 assert(rtc::Thread::Current() == voice_channel_->worker_thread()); | 50 assert(rtc::Thread::Current() == voice_channel_->worker_thread()); |
51 if (!monitoring_) { | 51 if (!monitoring_) { |
52 monitoring_ = true; | 52 monitoring_ = true; |
(...skipping 29 matching lines...) Expand all Loading... |
82 void AudioMonitor::PollVoiceChannel() { | 82 void AudioMonitor::PollVoiceChannel() { |
83 rtc::CritScope cs(&crit_); | 83 rtc::CritScope cs(&crit_); |
84 assert(rtc::Thread::Current() == voice_channel_->worker_thread()); | 84 assert(rtc::Thread::Current() == voice_channel_->worker_thread()); |
85 | 85 |
86 // Gather connection infos | 86 // Gather connection infos |
87 audio_info_.input_level = voice_channel_->GetInputLevel_w(); | 87 audio_info_.input_level = voice_channel_->GetInputLevel_w(); |
88 audio_info_.output_level = voice_channel_->GetOutputLevel_w(); | 88 audio_info_.output_level = voice_channel_->GetOutputLevel_w(); |
89 voice_channel_->GetActiveStreams_w(&audio_info_.active_streams); | 89 voice_channel_->GetActiveStreams_w(&audio_info_.active_streams); |
90 | 90 |
91 // Signal the monitoring thread, start another poll timer | 91 // Signal the monitoring thread, start another poll timer |
92 monitoring_thread_->Post(this, MSG_MONITOR_SIGNAL); | 92 monitoring_thread_->Post(RTC_FROM_HERE, this, MSG_MONITOR_SIGNAL); |
93 voice_channel_->worker_thread()->PostDelayed(rate_, this, MSG_MONITOR_POLL); | 93 voice_channel_->worker_thread()->PostDelayed(RTC_FROM_HERE, rate_, this, |
| 94 MSG_MONITOR_POLL); |
94 } | 95 } |
95 | 96 |
96 VoiceChannel *AudioMonitor::voice_channel() { | 97 VoiceChannel *AudioMonitor::voice_channel() { |
97 return voice_channel_; | 98 return voice_channel_; |
98 } | 99 } |
99 | 100 |
100 rtc::Thread *AudioMonitor::monitor_thread() { | 101 rtc::Thread *AudioMonitor::monitor_thread() { |
101 return monitoring_thread_; | 102 return monitoring_thread_; |
102 } | 103 } |
103 | 104 |
104 } // namespace cricket | 105 } // namespace cricket |
OLD | NEW |