OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 return (can_insert_dtmf_tracks_.count(track_label) != 0); | 78 return (can_insert_dtmf_tracks_.count(track_label) != 0); |
79 } | 79 } |
80 | 80 |
81 bool InsertDtmf(const std::string& track_label, | 81 bool InsertDtmf(const std::string& track_label, |
82 int code, | 82 int code, |
83 int duration) override { | 83 int duration) override { |
84 int gap = 0; | 84 int gap = 0; |
85 // TODO(ronghuawu): Make the timer (basically the rtc::TimeNanos) | 85 // TODO(ronghuawu): Make the timer (basically the rtc::TimeNanos) |
86 // mockable and use a fake timer in the unit tests. | 86 // mockable and use a fake timer in the unit tests. |
87 if (last_insert_dtmf_call_ > 0) { | 87 if (last_insert_dtmf_call_ > 0) { |
88 gap = static_cast<int>(rtc::Time() - last_insert_dtmf_call_); | 88 gap = static_cast<int>(rtc::TimeMillis() - last_insert_dtmf_call_); |
89 } | 89 } |
90 last_insert_dtmf_call_ = rtc::Time(); | 90 last_insert_dtmf_call_ = rtc::TimeMillis(); |
91 | 91 |
92 LOG(LS_VERBOSE) << "FakeDtmfProvider::InsertDtmf code=" << code | 92 LOG(LS_VERBOSE) << "FakeDtmfProvider::InsertDtmf code=" << code |
93 << " duration=" << duration | 93 << " duration=" << duration |
94 << " gap=" << gap << "."; | 94 << " gap=" << gap << "."; |
95 dtmf_info_queue_.push_back(DtmfInfo(code, duration, gap)); | 95 dtmf_info_queue_.push_back(DtmfInfo(code, duration, gap)); |
96 return true; | 96 return true; |
97 } | 97 } |
98 | 98 |
99 sigslot::signal0<>* GetOnDestroyedSignal() override { | 99 sigslot::signal0<>* GetOnDestroyedSignal() override { |
100 return &SignalDestroyed; | 100 return &SignalDestroyed; |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 std::string tones = "3,4"; | 334 std::string tones = "3,4"; |
335 int duration = 100; | 335 int duration = 100; |
336 int inter_tone_gap = 50; | 336 int inter_tone_gap = 50; |
337 | 337 |
338 EXPECT_FALSE(dtmf_->InsertDtmf(tones, 6001, inter_tone_gap)); | 338 EXPECT_FALSE(dtmf_->InsertDtmf(tones, 6001, inter_tone_gap)); |
339 EXPECT_FALSE(dtmf_->InsertDtmf(tones, 69, inter_tone_gap)); | 339 EXPECT_FALSE(dtmf_->InsertDtmf(tones, 69, inter_tone_gap)); |
340 EXPECT_FALSE(dtmf_->InsertDtmf(tones, duration, 49)); | 340 EXPECT_FALSE(dtmf_->InsertDtmf(tones, duration, 49)); |
341 | 341 |
342 EXPECT_TRUE(dtmf_->InsertDtmf(tones, duration, inter_tone_gap)); | 342 EXPECT_TRUE(dtmf_->InsertDtmf(tones, duration, inter_tone_gap)); |
343 } | 343 } |
OLD | NEW |