OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 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 28 matching lines...) Expand all Loading... |
39 // actually require more or less time between switches than that specified | 39 // actually require more or less time between switches than that specified |
40 // in the call to set_min_time_between_switches. To be safe, we sleep for | 40 // in the call to set_min_time_between_switches. To be safe, we sleep for |
41 // 90 ms more than the min time between switches before checking for a switch. | 41 // 90 ms more than the min time between switches before checking for a switch. |
42 // I am assuming system clocks do not have a coarser resolution than 90 ms. | 42 // I am assuming system clocks do not have a coarser resolution than 90 ms. |
43 static const uint32_t kSleepTimeBetweenSwitches = 100; | 43 static const uint32_t kSleepTimeBetweenSwitches = 100; |
44 | 44 |
45 class CurrentSpeakerMonitorTest : public testing::Test, | 45 class CurrentSpeakerMonitorTest : public testing::Test, |
46 public sigslot::has_slots<> { | 46 public sigslot::has_slots<> { |
47 public: | 47 public: |
48 CurrentSpeakerMonitorTest() { | 48 CurrentSpeakerMonitorTest() { |
49 monitor_ = new CurrentSpeakerMonitor(&source_, NULL); | 49 monitor_ = new CurrentSpeakerMonitor(&source_); |
50 // Shrink the minimum time betweeen switches to 10 ms so we don't have to | 50 // Shrink the minimum time betweeen switches to 10 ms so we don't have to |
51 // slow down our tests. | 51 // slow down our tests. |
52 monitor_->set_min_time_between_switches(kMinTimeBetweenSwitches); | 52 monitor_->set_min_time_between_switches(kMinTimeBetweenSwitches); |
53 monitor_->SignalUpdate.connect(this, &CurrentSpeakerMonitorTest::OnUpdate); | 53 monitor_->SignalUpdate.connect(this, &CurrentSpeakerMonitorTest::OnUpdate); |
54 current_speaker_ = 0; | 54 current_speaker_ = 0; |
55 num_changes_ = 0; | 55 num_changes_ = 0; |
56 monitor_->Start(); | 56 monitor_->Start(); |
57 } | 57 } |
58 | 58 |
59 ~CurrentSpeakerMonitorTest() { | 59 ~CurrentSpeakerMonitorTest() { |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 info.active_streams.push_back(std::make_pair(kSsrc1, 3)); | 217 info.active_streams.push_back(std::make_pair(kSsrc1, 3)); |
218 info.active_streams.push_back(std::make_pair(kSsrc2, 0)); | 218 info.active_streams.push_back(std::make_pair(kSsrc2, 0)); |
219 SignalAudioMonitor(info); | 219 SignalAudioMonitor(info); |
220 | 220 |
221 // At this point, we should have concluded that SSRC2 stopped speaking. | 221 // At this point, we should have concluded that SSRC2 stopped speaking. |
222 EXPECT_EQ(current_speaker_, kSsrc1); | 222 EXPECT_EQ(current_speaker_, kSsrc1); |
223 EXPECT_EQ(num_changes_, 2); | 223 EXPECT_EQ(num_changes_, 2); |
224 } | 224 } |
225 | 225 |
226 } // namespace cricket | 226 } // namespace cricket |
OLD | NEW |