| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 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 |
| 11 #include "webrtc/modules/audio_coding/test/APITest.h" | 11 #include "webrtc/modules/audio_coding/test/APITest.h" |
| 12 | 12 |
| 13 #include <ctype.h> | 13 #include <ctype.h> |
| 14 #include <stdio.h> | 14 #include <stdio.h> |
| 15 #include <stdlib.h> | 15 #include <stdlib.h> |
| 16 #include <string.h> | 16 #include <string.h> |
| 17 | 17 |
| 18 #include <iostream> | 18 #include <iostream> |
| 19 #include <ostream> | 19 #include <ostream> |
| 20 #include <string> | 20 #include <string> |
| 21 | 21 |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 23 #include "webrtc/base/platform_thread.h" | 23 #include "webrtc/base/platform_thread.h" |
| 24 #include "webrtc/base/timeutils.h" |
| 24 #include "webrtc/common.h" | 25 #include "webrtc/common.h" |
| 25 #include "webrtc/common_types.h" | 26 #include "webrtc/common_types.h" |
| 26 #include "webrtc/engine_configurations.h" | 27 #include "webrtc/engine_configurations.h" |
| 27 #include "webrtc/modules/audio_coding/acm2/acm_common_defs.h" | 28 #include "webrtc/modules/audio_coding/acm2/acm_common_defs.h" |
| 28 #include "webrtc/modules/audio_coding/test/utility.h" | 29 #include "webrtc/modules/audio_coding/test/utility.h" |
| 29 #include "webrtc/system_wrappers/include/event_wrapper.h" | 30 #include "webrtc/system_wrappers/include/event_wrapper.h" |
| 30 #include "webrtc/system_wrappers/include/tick_util.h" | |
| 31 #include "webrtc/system_wrappers/include/trace.h" | 31 #include "webrtc/system_wrappers/include/trace.h" |
| 32 #include "webrtc/test/testsupport/fileutils.h" | 32 #include "webrtc/test/testsupport/fileutils.h" |
| 33 | 33 |
| 34 namespace webrtc { | 34 namespace webrtc { |
| 35 | 35 |
| 36 #define TEST_DURATION_SEC 600 | 36 #define TEST_DURATION_SEC 600 |
| 37 #define NUMBER_OF_SENDER_TESTS 6 | 37 #define NUMBER_OF_SENDER_TESTS 6 |
| 38 #define MAX_FILE_NAME_LENGTH_BYTE 500 | 38 #define MAX_FILE_NAME_LENGTH_BYTE 500 |
| 39 | 39 |
| 40 void APITest::Wait(uint32_t waitLengthMs) { | 40 void APITest::Wait(uint32_t waitLengthMs) { |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 | 553 |
| 554 _pullEventA->StartTimer(true, 10); | 554 _pullEventA->StartTimer(true, 10); |
| 555 _pullEventB->StartTimer(true, 10); | 555 _pullEventB->StartTimer(true, 10); |
| 556 | 556 |
| 557 _pushEventA->StartTimer(true, 10); | 557 _pushEventA->StartTimer(true, 10); |
| 558 _pushEventB->StartTimer(true, 10); | 558 _pushEventB->StartTimer(true, 10); |
| 559 | 559 |
| 560 // Keep main thread waiting for sender/receiver | 560 // Keep main thread waiting for sender/receiver |
| 561 // threads to complete | 561 // threads to complete |
| 562 EventWrapper* completeEvent = EventWrapper::Create(); | 562 EventWrapper* completeEvent = EventWrapper::Create(); |
| 563 uint64_t startTime = TickTime::MillisecondTimestamp(); | 563 uint64_t startTime = rtc::TimeMillis(); |
| 564 uint64_t currentTime; | 564 uint64_t currentTime; |
| 565 // Run test in 2 minutes (120000 ms). | 565 // Run test in 2 minutes (120000 ms). |
| 566 do { | 566 do { |
| 567 { | 567 { |
| 568 //ReadLockScoped rl(_apiTestRWLock); | 568 //ReadLockScoped rl(_apiTestRWLock); |
| 569 //fprintf(stderr, "\r%s", _movingDot); | 569 //fprintf(stderr, "\r%s", _movingDot); |
| 570 } | 570 } |
| 571 //fflush(stderr); | 571 //fflush(stderr); |
| 572 completeEvent->Wait(50); | 572 completeEvent->Wait(50); |
| 573 currentTime = TickTime::MillisecondTimestamp(); | 573 currentTime = rtc::TimeMillis(); |
| 574 } while ((currentTime - startTime) < 120000); | 574 } while ((currentTime - startTime) < 120000); |
| 575 | 575 |
| 576 //completeEvent->Wait(0xFFFFFFFF); | 576 //completeEvent->Wait(0xFFFFFFFF); |
| 577 //(unsigned long)((unsigned long)TEST_DURATION_SEC * (unsigned long)1000)); | 577 //(unsigned long)((unsigned long)TEST_DURATION_SEC * (unsigned long)1000)); |
| 578 delete completeEvent; | 578 delete completeEvent; |
| 579 | 579 |
| 580 myPushAudioThreadA.Stop(); | 580 myPushAudioThreadA.Stop(); |
| 581 myPullAudioThreadA.Stop(); | 581 myPullAudioThreadA.Stop(); |
| 582 myProcessThreadA.Stop(); | 582 myProcessThreadA.Stop(); |
| 583 myAPIThreadA.Stop(); | 583 myAPIThreadA.Stop(); |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1096 CHECK_ERROR_MT(myACM->RegisterSendCodec(myCodec)); | 1096 CHECK_ERROR_MT(myACM->RegisterSendCodec(myCodec)); |
| 1097 myChannel->ResetStats(); | 1097 myChannel->ResetStats(); |
| 1098 { | 1098 { |
| 1099 WriteLockScoped wl(_apiTestRWLock); | 1099 WriteLockScoped wl(_apiTestRWLock); |
| 1100 *thereIsEncoder = true; | 1100 *thereIsEncoder = true; |
| 1101 } | 1101 } |
| 1102 Wait(500); | 1102 Wait(500); |
| 1103 } | 1103 } |
| 1104 | 1104 |
| 1105 } // namespace webrtc | 1105 } // namespace webrtc |
| OLD | NEW |