OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 58 matching lines...) Loading... |
69 ~CurrentSpeakerMonitor(); | 69 ~CurrentSpeakerMonitor(); |
70 | 70 |
71 BaseSession* session() const { return session_; } | 71 BaseSession* session() const { return session_; } |
72 | 72 |
73 void Start(); | 73 void Start(); |
74 void Stop(); | 74 void Stop(); |
75 | 75 |
76 // Used by tests. Note that the actual minimum time between switches | 76 // Used by tests. Note that the actual minimum time between switches |
77 // enforced by the monitor will be the given value plus or minus the | 77 // enforced by the monitor will be the given value plus or minus the |
78 // resolution of the system clock. | 78 // resolution of the system clock. |
79 void set_min_time_between_switches(uint32 min_time_between_switches); | 79 void set_min_time_between_switches(uint32_t min_time_between_switches); |
80 | 80 |
81 // This is fired when the current speaker changes, and provides his audio | 81 // This is fired when the current speaker changes, and provides his audio |
82 // SSRC. This only fires after the audio monitor on the underlying | 82 // SSRC. This only fires after the audio monitor on the underlying |
83 // AudioSourceContext has been started. | 83 // AudioSourceContext has been started. |
84 sigslot::signal2<CurrentSpeakerMonitor*, uint32> SignalUpdate; | 84 sigslot::signal2<CurrentSpeakerMonitor*, uint32_t> SignalUpdate; |
85 | 85 |
86 private: | 86 private: |
87 void OnAudioMonitor(AudioSourceContext* audio_source_context, | 87 void OnAudioMonitor(AudioSourceContext* audio_source_context, |
88 const AudioInfo& info); | 88 const AudioInfo& info); |
89 void OnMediaStreamsUpdate(AudioSourceContext* audio_source_context, | 89 void OnMediaStreamsUpdate(AudioSourceContext* audio_source_context, |
90 BaseSession* session, | 90 BaseSession* session, |
91 const MediaStreams& added, | 91 const MediaStreams& added, |
92 const MediaStreams& removed); | 92 const MediaStreams& removed); |
93 void OnMediaStreamsReset(AudioSourceContext* audio_source_context, | 93 void OnMediaStreamsReset(AudioSourceContext* audio_source_context, |
94 BaseSession* session); | 94 BaseSession* session); |
95 | 95 |
96 // These are states that a participant will pass through so that we gradually | 96 // These are states that a participant will pass through so that we gradually |
97 // recognize that they have started and stopped speaking. This avoids | 97 // recognize that they have started and stopped speaking. This avoids |
98 // "twitchiness". | 98 // "twitchiness". |
99 enum SpeakingState { | 99 enum SpeakingState { |
100 SS_NOT_SPEAKING, | 100 SS_NOT_SPEAKING, |
101 SS_MIGHT_BE_SPEAKING, | 101 SS_MIGHT_BE_SPEAKING, |
102 SS_SPEAKING, | 102 SS_SPEAKING, |
103 SS_WAS_SPEAKING_RECENTLY1, | 103 SS_WAS_SPEAKING_RECENTLY1, |
104 SS_WAS_SPEAKING_RECENTLY2 | 104 SS_WAS_SPEAKING_RECENTLY2 |
105 }; | 105 }; |
106 | 106 |
107 bool started_; | 107 bool started_; |
108 AudioSourceContext* audio_source_context_; | 108 AudioSourceContext* audio_source_context_; |
109 BaseSession* session_; | 109 BaseSession* session_; |
110 std::map<uint32, SpeakingState> ssrc_to_speaking_state_map_; | 110 std::map<uint32_t, SpeakingState> ssrc_to_speaking_state_map_; |
111 uint32 current_speaker_ssrc_; | 111 uint32_t current_speaker_ssrc_; |
112 // To prevent overswitching, switching is disabled for some time after a | 112 // To prevent overswitching, switching is disabled for some time after a |
113 // switch is made. This gives us the earliest time a switch is permitted. | 113 // switch is made. This gives us the earliest time a switch is permitted. |
114 uint32 earliest_permitted_switch_time_; | 114 uint32_t earliest_permitted_switch_time_; |
115 uint32 min_time_between_switches_; | 115 uint32_t min_time_between_switches_; |
116 }; | 116 }; |
117 | 117 |
118 } | 118 } |
119 | 119 |
120 #endif // TALK_SESSION_MEDIA_CURRENTSPEAKERMONITOR_H_ | 120 #endif // TALK_SESSION_MEDIA_CURRENTSPEAKERMONITOR_H_ |
OLD | NEW |