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 |
11 #ifndef TALK_SESSION_MEDIA_AUDIOMONITOR_H_ | 11 #ifndef WEBRTC_PC_AUDIOMONITOR_H_ |
12 #define TALK_SESSION_MEDIA_AUDIOMONITOR_H_ | 12 #define WEBRTC_PC_AUDIOMONITOR_H_ |
13 | 13 |
14 #include <vector> | 14 #include <vector> |
| 15 #include <utility> |
| 16 |
15 #include "webrtc/base/sigslot.h" | 17 #include "webrtc/base/sigslot.h" |
16 #include "webrtc/base/thread.h" | 18 #include "webrtc/base/thread.h" |
17 #include "webrtc/p2p/base/port.h" | 19 #include "webrtc/p2p/base/port.h" |
18 | 20 |
19 namespace cricket { | 21 namespace cricket { |
20 | 22 |
21 class VoiceChannel; | 23 class VoiceChannel; |
22 | 24 |
23 struct AudioInfo { | 25 struct AudioInfo { |
24 int input_level; | 26 int input_level; |
25 int output_level; | 27 int output_level; |
26 typedef std::vector<std::pair<uint32_t, int> > StreamList; | 28 typedef std::vector<std::pair<uint32_t, int> > StreamList; |
27 StreamList active_streams; // ssrcs contributing to output_level | 29 StreamList active_streams; // ssrcs contributing to output_level |
28 }; | 30 }; |
29 | 31 |
30 class AudioMonitor : public rtc::MessageHandler, | 32 class AudioMonitor : public rtc::MessageHandler, |
31 public sigslot::has_slots<> { | 33 public sigslot::has_slots<> { |
32 public: | 34 public: |
33 AudioMonitor(VoiceChannel* voice_channel, rtc::Thread *monitor_thread); | 35 AudioMonitor(VoiceChannel* voice_channel, rtc::Thread *monitor_thread); |
34 ~AudioMonitor(); | 36 ~AudioMonitor(); |
35 | 37 |
36 void Start(int cms); | 38 void Start(int cms); |
37 void Stop(); | 39 void Stop(); |
38 | 40 |
39 VoiceChannel* voice_channel(); | 41 VoiceChannel* voice_channel(); |
40 rtc::Thread *monitor_thread(); | 42 rtc::Thread *monitor_thread(); |
41 | 43 |
42 sigslot::signal2<AudioMonitor*, const AudioInfo&> SignalUpdate; | 44 sigslot::signal2<AudioMonitor*, const AudioInfo&> SignalUpdate; |
43 | 45 |
44 protected: | 46 protected: |
45 void OnMessage(rtc::Message *message); | 47 void OnMessage(rtc::Message *message); |
46 void PollVoiceChannel(); | 48 void PollVoiceChannel(); |
47 | 49 |
48 AudioInfo audio_info_; | 50 AudioInfo audio_info_; |
49 VoiceChannel* voice_channel_; | 51 VoiceChannel* voice_channel_; |
50 rtc::Thread* monitoring_thread_; | 52 rtc::Thread* monitoring_thread_; |
51 rtc::CriticalSection crit_; | 53 rtc::CriticalSection crit_; |
52 uint32_t rate_; | 54 uint32_t rate_; |
53 bool monitoring_; | 55 bool monitoring_; |
54 }; | 56 }; |
55 | 57 |
56 } | 58 } // namespace cricket |
57 | 59 |
58 #endif // TALK_SESSION_MEDIA_AUDIOMONITOR_H_ | 60 #endif // WEBRTC_PC_AUDIOMONITOR_H_ |
OLD | NEW |