Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: webrtc/pc/currentspeakermonitor.cc

Issue 1835053002: Change default timestamp to 64 bits in all webrtc directories. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Address comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 audio_source_context_->SignalMediaStreamsUpdate.disconnect(this); 54 audio_source_context_->SignalMediaStreamsUpdate.disconnect(this);
55 55
56 started_ = false; 56 started_ = false;
57 ssrc_to_speaking_state_map_.clear(); 57 ssrc_to_speaking_state_map_.clear();
58 current_speaker_ssrc_ = 0; 58 current_speaker_ssrc_ = 0;
59 earliest_permitted_switch_time_ = 0; 59 earliest_permitted_switch_time_ = 0;
60 } 60 }
61 } 61 }
62 62
63 void CurrentSpeakerMonitor::set_min_time_between_switches( 63 void CurrentSpeakerMonitor::set_min_time_between_switches(
64 uint32_t min_time_between_switches) { 64 int min_time_between_switches) {
65 min_time_between_switches_ = min_time_between_switches; 65 min_time_between_switches_ = min_time_between_switches;
66 } 66 }
67 67
68 void CurrentSpeakerMonitor::OnAudioMonitor( 68 void CurrentSpeakerMonitor::OnAudioMonitor(
69 AudioSourceContext* audio_source_context, const AudioInfo& info) { 69 AudioSourceContext* audio_source_context, const AudioInfo& info) {
70 std::map<uint32_t, int> active_ssrc_to_level_map; 70 std::map<uint32_t, int> active_ssrc_to_level_map;
71 cricket::AudioInfo::StreamList::const_iterator stream_list_it; 71 cricket::AudioInfo::StreamList::const_iterator stream_list_it;
72 for (stream_list_it = info.active_streams.begin(); 72 for (stream_list_it = info.active_streams.begin();
73 stream_list_it != info.active_streams.end(); ++stream_list_it) { 73 stream_list_it != info.active_streams.end(); ++stream_list_it) {
74 uint32_t ssrc = stream_list_it->first; 74 uint32_t ssrc = stream_list_it->first;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 loudest_speaker_ssrc = state_it->first; 156 loudest_speaker_ssrc = state_it->first;
157 max_level = level; 157 max_level = level;
158 } else if (level > 0 && level == max_level && is_previous_speaker) { 158 } else if (level > 0 && level == max_level && is_previous_speaker) {
159 // Favor continuity of loudest speakers if audio levels are equal. 159 // Favor continuity of loudest speakers if audio levels are equal.
160 loudest_speaker_ssrc = state_it->first; 160 loudest_speaker_ssrc = state_it->first;
161 } 161 }
162 } 162 }
163 163
164 // We avoid over-switching by disabling switching for a period of time after 164 // We avoid over-switching by disabling switching for a period of time after
165 // a switch is done. 165 // a switch is done.
166 uint32_t now = rtc::Time(); 166 int64_t now = rtc::Time();
167 if (earliest_permitted_switch_time_ <= now && 167 if (earliest_permitted_switch_time_ <= now &&
168 current_speaker_ssrc_ != loudest_speaker_ssrc) { 168 current_speaker_ssrc_ != loudest_speaker_ssrc) {
169 current_speaker_ssrc_ = loudest_speaker_ssrc; 169 current_speaker_ssrc_ = loudest_speaker_ssrc;
170 LOG(LS_INFO) << "Current speaker changed to " << current_speaker_ssrc_; 170 LOG(LS_INFO) << "Current speaker changed to " << current_speaker_ssrc_;
171 earliest_permitted_switch_time_ = now + min_time_between_switches_; 171 earliest_permitted_switch_time_ = now + min_time_between_switches_;
172 SignalUpdate(this, current_speaker_ssrc_); 172 SignalUpdate(this, current_speaker_ssrc_);
173 } 173 }
174 } 174 }
175 175
176 void CurrentSpeakerMonitor::OnMediaStreamsUpdate( 176 void CurrentSpeakerMonitor::OnMediaStreamsUpdate(
(...skipping 15 matching lines...) Expand all
192 } 192 }
193 193
194 void CurrentSpeakerMonitor::OnMediaStreamsReset( 194 void CurrentSpeakerMonitor::OnMediaStreamsReset(
195 AudioSourceContext* audio_source_context) { 195 AudioSourceContext* audio_source_context) {
196 if (audio_source_context == audio_source_context_) { 196 if (audio_source_context == audio_source_context_) {
197 ssrc_to_speaking_state_map_.clear(); 197 ssrc_to_speaking_state_map_.clear();
198 } 198 }
199 } 199 }
200 200
201 } // namespace cricket 201 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698