| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2011 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 // CurrentSpeakerMonitor monitors the audio levels for a session and determines | 11 // CurrentSpeakerMonitor monitors the audio levels for a session and determines |
| 12 // which participant is currently speaking. | 12 // which participant is currently speaking. |
| 13 | 13 |
| 14 #ifndef TALK_SESSION_MEDIA_CURRENTSPEAKERMONITOR_H_ | 14 #ifndef WEBRTC_PC_CURRENTSPEAKERMONITOR_H_ |
| 15 #define TALK_SESSION_MEDIA_CURRENTSPEAKERMONITOR_H_ | 15 #define WEBRTC_PC_CURRENTSPEAKERMONITOR_H_ |
| 16 | 16 |
| 17 #include <map> | 17 #include <map> |
| 18 | 18 |
| 19 #include "webrtc/base/basictypes.h" | 19 #include "webrtc/base/basictypes.h" |
| 20 #include "webrtc/base/sigslot.h" | 20 #include "webrtc/base/sigslot.h" |
| 21 | 21 |
| 22 namespace cricket { | 22 namespace cricket { |
| 23 | 23 |
| 24 struct AudioInfo; | 24 struct AudioInfo; |
| 25 struct MediaStreams; | 25 struct MediaStreams; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 38 // many audio-sources and report on changes in the loudest audio-source. | 38 // many audio-sources and report on changes in the loudest audio-source. |
| 39 // Its a generic type and relies on an AudioSourceContext which is aware of | 39 // Its a generic type and relies on an AudioSourceContext which is aware of |
| 40 // the audio-sources. AudioSourceContext needs to provide two signals namely | 40 // the audio-sources. AudioSourceContext needs to provide two signals namely |
| 41 // SignalAudioInfoMonitor - provides audio info of the all current speakers. | 41 // SignalAudioInfoMonitor - provides audio info of the all current speakers. |
| 42 // SignalMediaSourcesUpdated - provides updates when a speaker leaves or joins. | 42 // SignalMediaSourcesUpdated - provides updates when a speaker leaves or joins. |
| 43 // Note that the AudioSourceContext's audio monitor must be started | 43 // Note that the AudioSourceContext's audio monitor must be started |
| 44 // before this is started. | 44 // before this is started. |
| 45 // It's recommended that the audio monitor be started with a 100 ms period. | 45 // It's recommended that the audio monitor be started with a 100 ms period. |
| 46 class CurrentSpeakerMonitor : public sigslot::has_slots<> { | 46 class CurrentSpeakerMonitor : public sigslot::has_slots<> { |
| 47 public: | 47 public: |
| 48 CurrentSpeakerMonitor(AudioSourceContext* audio_source_context); | 48 explicit CurrentSpeakerMonitor(AudioSourceContext* audio_source_context); |
| 49 ~CurrentSpeakerMonitor(); | 49 ~CurrentSpeakerMonitor(); |
| 50 | 50 |
| 51 void Start(); | 51 void Start(); |
| 52 void Stop(); | 52 void Stop(); |
| 53 | 53 |
| 54 // Used by tests. Note that the actual minimum time between switches | 54 // Used by tests. Note that the actual minimum time between switches |
| 55 // enforced by the monitor will be the given value plus or minus the | 55 // enforced by the monitor will be the given value plus or minus the |
| 56 // resolution of the system clock. | 56 // resolution of the system clock. |
| 57 void set_min_time_between_switches(uint32_t min_time_between_switches); | 57 void set_min_time_between_switches(uint32_t min_time_between_switches); |
| 58 | 58 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 83 bool started_; | 83 bool started_; |
| 84 AudioSourceContext* audio_source_context_; | 84 AudioSourceContext* audio_source_context_; |
| 85 std::map<uint32_t, SpeakingState> ssrc_to_speaking_state_map_; | 85 std::map<uint32_t, SpeakingState> ssrc_to_speaking_state_map_; |
| 86 uint32_t current_speaker_ssrc_; | 86 uint32_t current_speaker_ssrc_; |
| 87 // To prevent overswitching, switching is disabled for some time after a | 87 // To prevent overswitching, switching is disabled for some time after a |
| 88 // switch is made. This gives us the earliest time a switch is permitted. | 88 // switch is made. This gives us the earliest time a switch is permitted. |
| 89 uint32_t earliest_permitted_switch_time_; | 89 uint32_t earliest_permitted_switch_time_; |
| 90 uint32_t min_time_between_switches_; | 90 uint32_t min_time_between_switches_; |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 } | 93 } // namespace cricket |
| 94 | 94 |
| 95 #endif // TALK_SESSION_MEDIA_CURRENTSPEAKERMONITOR_H_ | 95 #endif // WEBRTC_PC_CURRENTSPEAKERMONITOR_H_ |
| OLD | NEW |