128e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org/* 228e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * libjingle 328e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * Copyright 2004 Google Inc. 428e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * 528e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * Redistribution and use in source and binary forms, with or without 628e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * modification, are permitted provided that the following conditions are met: 728e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * 828e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * 1. Redistributions of source code must retain the above copyright notice, 928e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * this list of conditions and the following disclaimer. 1028e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * 2. Redistributions in binary form must reproduce the above copyright notice, 1128e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * this list of conditions and the following disclaimer in the documentation 1228e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * and/or other materials provided with the distribution. 1328e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * 3. The name of the author may not be used to endorse or promote products 1428e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * derived from this software without specific prior written permission. 1528e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * 1628e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 1728e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1828e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 1928e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2028e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 2128e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 2228e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 2328e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 2428e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 2528e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2628e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org */ 2728e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org 2828e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org#ifndef TALK_SESSION_MEDIA_AUDIOMONITOR_H_ 2928e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org#define TALK_SESSION_MEDIA_AUDIOMONITOR_H_ 3028e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org 31a09a99950ec40aef6421e4ba35eee7196b7a6e68buildbot@webrtc.org#include <vector> 32269fb4bc90b79bebbb8311da0110ccd6803fd0a8henrike@webrtc.org#include "webrtc/p2p/base/port.h" 33d4e598d57aed714a599444a7eab5e8fdde52a950buildbot@webrtc.org#include "webrtc/base/sigslot.h" 34d4e598d57aed714a599444a7eab5e8fdde52a950buildbot@webrtc.org#include "webrtc/base/thread.h" 3528e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org 3628e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.orgnamespace cricket { 3728e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org 3828e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.orgclass VoiceChannel; 3928e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org 4028e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.orgstruct AudioInfo { 4128e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org int input_level; 4228e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org int output_level; 430c4e06b4c6107a1b94f764e279e4fb4161e905b0Peter Boström typedef std::vector<std::pair<uint32_t, int> > StreamList; 4428e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org StreamList active_streams; // ssrcs contributing to output_level 4528e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org}; 4628e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org 47d4e598d57aed714a599444a7eab5e8fdde52a950buildbot@webrtc.orgclass AudioMonitor : public rtc::MessageHandler, 4828e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org public sigslot::has_slots<> { 4928e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org public: 50d4e598d57aed714a599444a7eab5e8fdde52a950buildbot@webrtc.org AudioMonitor(VoiceChannel* voice_channel, rtc::Thread *monitor_thread); 5128e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org ~AudioMonitor(); 5228e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org 5328e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org void Start(int cms); 5428e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org void Stop(); 5528e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org 5628e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org VoiceChannel* voice_channel(); 57d4e598d57aed714a599444a7eab5e8fdde52a950buildbot@webrtc.org rtc::Thread *monitor_thread(); 5828e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org 5928e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org sigslot::signal2<AudioMonitor*, const AudioInfo&> SignalUpdate; 6028e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org 6128e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org protected: 62d4e598d57aed714a599444a7eab5e8fdde52a950buildbot@webrtc.org void OnMessage(rtc::Message *message); 6328e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org void PollVoiceChannel(); 6428e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org 6528e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org AudioInfo audio_info_; 6628e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org VoiceChannel* voice_channel_; 67d4e598d57aed714a599444a7eab5e8fdde52a950buildbot@webrtc.org rtc::Thread* monitoring_thread_; 68d4e598d57aed714a599444a7eab5e8fdde52a950buildbot@webrtc.org rtc::CriticalSection crit_; 690c4e06b4c6107a1b94f764e279e4fb4161e905b0Peter Boström uint32_t rate_; 7028e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org bool monitoring_; 7128e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org}; 7228e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org 7328e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org} 7428e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org 7528e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org#endif // TALK_SESSION_MEDIA_AUDIOMONITOR_H_ 76