OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 1, | 108 1, |
109 kFrequencyHz, | 109 kFrequencyHz, |
110 0, | 110 0, |
111 0, | 111 0, |
112 0, | 112 0, |
113 false, | 113 false, |
114 new_mic_level)); | 114 new_mic_level)); |
115 uint32_t samples_needed = kFrequencyHz / 100; | 115 uint32_t samples_needed = kFrequencyHz / 100; |
116 int64_t now_ms = clock_->TimeInMilliseconds(); | 116 int64_t now_ms = clock_->TimeInMilliseconds(); |
117 uint32_t time_since_last_playout_ms = now_ms - last_playout_ms_; | 117 uint32_t time_since_last_playout_ms = now_ms - last_playout_ms_; |
118 if (last_playout_ms_ > 0 && time_since_last_playout_ms > 0) | 118 if (last_playout_ms_ > 0 && time_since_last_playout_ms > 0) { |
119 samples_needed = std::min(kFrequencyHz / time_since_last_playout_ms, | 119 samples_needed = std::min(kFrequencyHz / time_since_last_playout_ms, |
120 kBufferSizeBytes / 2); | 120 kBufferSizeBytes / 2); |
| 121 } |
121 uint32_t samples_out = 0; | 122 uint32_t samples_out = 0; |
122 int64_t elapsed_time_ms = -1; | 123 int64_t elapsed_time_ms = -1; |
123 int64_t ntp_time_ms = -1; | 124 int64_t ntp_time_ms = -1; |
124 EXPECT_EQ(0, | 125 EXPECT_EQ(0, |
125 audio_callback_->NeedMorePlayData(samples_needed, | 126 audio_callback_->NeedMorePlayData(samples_needed, |
126 2, | 127 2, |
127 1, | 128 1, |
128 kFrequencyHz, | 129 kFrequencyHz, |
129 playout_buffer_, | 130 playout_buffer_, |
130 samples_out, | 131 samples_out, |
131 &elapsed_time_ms, | 132 &elapsed_time_ms, |
132 &ntp_time_ms)); | 133 &ntp_time_ms)); |
133 } | 134 } |
134 } | 135 } |
135 tick_->Wait(WEBRTC_EVENT_INFINITE); | 136 tick_->Wait(WEBRTC_EVENT_INFINITE); |
136 } | 137 } |
137 | 138 |
138 void FakeAudioDevice::Start() { | 139 void FakeAudioDevice::Start() { |
139 rtc::CritScope cs(&lock_); | 140 rtc::CritScope cs(&lock_); |
140 capturing_ = true; | 141 capturing_ = true; |
141 } | 142 } |
142 | 143 |
143 void FakeAudioDevice::Stop() { | 144 void FakeAudioDevice::Stop() { |
144 rtc::CritScope cs(&lock_); | 145 rtc::CritScope cs(&lock_); |
145 capturing_ = false; | 146 capturing_ = false; |
146 } | 147 } |
147 } // namespace test | 148 } // namespace test |
148 } // namespace webrtc | 149 } // namespace webrtc |
OLD | NEW |